Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

error alert message when using ThreadSearch Plugin

(1/6) > >>

ollydbg:
When search by thread search plugin, I got a alert message, and I press the "Yes", C::B crashes. (If I press "Cancel", C::B can continue to run)



--- Code: ---codeblocks.exe caused a Breakpoint at location 000007FEDC0902D7 in module wxmsw317u_gcc_cb.dll.

AddrPC           Params
000007FEDC0902D7 00000000070A761E 00000000070A75A0 000000000D63EB40  wxmsw317u_gcc_cb.dll!wxUniChar::ToHi8bit
000007FED98DC194 000000000000FF0C 000000000000003F 0000000000000132  ThreadSearch.dll!wxUniChar::To8bit
000007FED98E1319 000000000D63EBE8 000000000000003F 0000000000000000  ThreadSearch.dll!wxUniChar::operator char
000007FED9897A8D 000000000711B7B0 0000000006971878 000000000D63ED00  ThreadSearch.dll!TextFileSearcherText::MatchLine
000007FED9896BE3 000000000711B7B0 000000000255C158 0000000006971850  ThreadSearch.dll!TextFileSearcher::FindInFile
000007FED98B7ED0 0000000006971730 000000000255C158 000000000725DD50  ThreadSearch.dll!ThreadSearchThread::FindInFile
000007FED98B7988 0000000006971730 0000000000000000 0000000000000000  ThreadSearch.dll!ThreadSearchThread::Entry
000007FEDC0EB932 0000000006971730 0000000000000001 0000000000000000  wxmsw317u_gcc_cb.dll!wxThread::CallEntry
000007FEDC0F6228 0000000006971730 00000000070FB6E0 0000000000000000  wxmsw317u_gcc_cb.dll!wxThreadInternal::DoThreadStart
000007FEDC0F6380 000000000B264B00 0000000000000000 0000000000000000  wxmsw317u_gcc_cb.dll!wxThreadInternal::WinThreadStart
000007FEFF1B415F 000007FEFF241EA0 000000000B264B00 0000000000000000  msvcrt.dll!srand
000007FEFF1B6EBD 0000000000000000 0000000000000000 0000000000000000  msvcrt.dll!_ftime64_s
000000007782556D 0000000000000000 0000000000000000 0000000000000000  kernel32.dll!BaseThreadInitThunk
0000000077BC385D 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart

--- End code ---

I'm not sure how the call stack is generated. I put a ThreadSearch.dll (from the src\devel31_64\share\CodeBlocks\plugins) which should contains all the debug information, but the call stack does not contain the source file and line information.

ollydbg:

--- Code: ---bool TextFileSearcherText::MatchLine(std::vector<int> *outMatchedPositions,
                                     const wxString &originalLine)
{
    wxString line;
    if ( m_MatchCase == false )
    {
        line = originalLine.Lower();
    }
    else
    {
        line = originalLine;
    }

    wxString::size_type start = 0;
    int count = 0;

    const std::vector<int>::size_type countIdx = outMatchedPositions->size();

    do
    {
        // "TestTest Test"
        // start word [0;4], [9;4]
        // match word [9;4]
        // none [0;4] [4;4] [9;4]

        wxString::size_type pos = line.find(m_SearchText, start);
        if (pos == wxString::npos)
            break;

        if ((m_MatchWordBegin || m_MatchWord) && pos > 0)
        {
            // Try to see if this is the start of the word.
            const char prevChar = line.GetChar(pos - 1);
            if (isalnum(prevChar) || prevChar == '_')
            {
                start++;
                continue;
            }
        }

        if (m_MatchWord && (pos + m_SearchText.length() < line.length()))
        {
            // Try to see if this is the end of the word.
            const char nextChar = line.GetChar(pos + m_SearchText.length());
            if (isalnum(nextChar) || nextChar == '_')
            {
                start++;
                continue;
            }
        }

        // We have a match add positions for it.
        if (count == 0)
            outMatchedPositions->push_back(0);
        ++count;
        outMatchedPositions->push_back(pos);
        outMatchedPositions->push_back(m_SearchText.length());

        start = pos + m_SearchText.length();
    } while (1);

    if (count > 0)
    {
        (*outMatchedPositions)[countIdx] = count;
        return true;
    }
    else
        return false;
}


--- End code ---

I guess the issue is that if a non ASCII char (for example, a Chinese character) is converted to a char, which cause the issue.

ollydbg:

--- Quote from: ollydbg on July 30, 2022, 10:25:00 am ---...
I'm not sure how the call stack is generated. I put a ThreadSearch.dll (from the src\devel31_64\share\CodeBlocks\plugins) which should contains all the debug information, but the call stack does not contain the source file and line information.

--- End quote ---

I just found that in this link: https://vroby.ddns.net/Public/sdlBasic/MinGW/doc/drmingw/drmingw.html

It said, if we want to got the file and line debug information, the libbfd library is needed. So, can we have this library linked?


--- Quote ---Using ExcHndl for you own purposes

If you incorporate ExcHndl in you own programs, especially those that you release to others, you can have almost the same exception information that you would get with Dr. Mingw, but with no need of the end user to have Dr. Mingw installed.

You can use ExcHndl in two ways:

    linking exchndl.o and libbfd.a with your program objects
    linking exchndl.o and libfd.a in the EXCHNDL.DLL and dinamically loading it at run-time. This can be done by linking just exchndl2.o or explicitly calling LoadLibrary("exchndl.dll")

The latter method is preferred because you have smaller executables and don't need to link the BFD library in all builds. The application wont fail if the EXCHNDL.DLL is missing.

--- End quote ---

So, does our exchndl.dll have the libbfd.a included? I guess it's not.  :(

AndrewCot:
My understanding is that the exchndl.dll is from https://github.com/jrfonseca/drmingw/releases

I have not looked at it more than that. I have had to grab the 32 bit release in order to incorporate it so you can run the 32 bit C::B without removing the code in app.cpp.
Dr MinGW is "linked" in via the following call in app.cpp:

--- Code: ---void CodeBlocksApp::InitExceptionHandler()
{
#ifdef __WXMSW__
    ExcHndlInit();
.... code removed......}


--- End code ---
You could try using the latest version to see if it works better than the one you have. You can do this by updating the DLL's and yes file as I have done this before and it worked.

ollydbg:
I download the latest release:
0.9.5 from github.com/jrfonseca/drmingw site.

And I paste the dlls and other files in the bin folder to the codeblocks' root folder. Then I make the crash, but it does not generate the RPT file.  :(

EDIT:

It looks like I have to rebuild the C::B (the src target)

EDIT2

It looks like the latest official release version 0.9.5 of drmingw can't catch the crash.

EDIT3

I will try to use this one from msys2 instead
Package: mingw-w64-x86_64-drmingw - MSYS2 Packages

Navigation

[0] Message Index

[#] Next page

Go to full version