Author Topic: error alert message when using ThreadSearch Plugin  (Read 15661 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
error alert message when using ThreadSearch Plugin
« on: July 30, 2022, 10:25:00 am »
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

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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #1 on: July 30, 2022, 10:29:30 am »
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;
}


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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #2 on: July 30, 2022, 10:44:22 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.

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.

So, does our exchndl.dll have the libbfd.a included? I guess it's not.  :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: error alert message when using ThreadSearch Plugin
« Reply #3 on: July 30, 2022, 11:17:38 am »
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......}

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.
« Last Edit: July 30, 2022, 11:19:57 am by AndrewCot »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #4 on: July 30, 2022, 01:32:31 pm »
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
« Last Edit: July 30, 2022, 04:11:05 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: error alert message when using ThreadSearch Plugin
« Reply #5 on: July 31, 2022, 12:05:28 am »
Please investigate future in this. Line numbers would be AWSOME

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: error alert message when using ThreadSearch Plugin
« Reply #6 on: July 31, 2022, 03:47:00 am »
Hope this is of some use.
I updated to the latest https://github.com/jrfonseca/drmingw/releases DrMingw 0.9.5 x64 last night and today in the rpt it has code and line numbers in it as per the RPT snippet below.

The compiler setup I am using is:
  • MYS2 MinGW64
  • gcc (Rev3, Built by MSYS2 project) 12.1.0
  • The debug compiler flags used were -g -O0 -ggdb
  • I built using gnu++17 option
The following is a compilation line from the build log for the src build:

Code
g++.exe -Wall -std=gnu++17 -m64 -g -O0 -ggdb -pipe -fmessage-length=0 -fexceptions -Winvalid-pch -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DwxUSE_UNICODE -D_WIN64 -DCB_EXPERIMENTAL_BUILD -DEXPORT_LIB -DWXMAKINGDLL_SCI -DEXPORT_EVENTS -iquoteD:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\.objs32_64\CodeBlocks\include -ID:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\.objs32_64\CodeBlocks\include -I. -ID:\Andrew_Development\Libraries\wxWidgets-3.2.0_win64\include -ID:\Andrew_Development\Libraries\wxWidgets-3.2.0_win64\lib\gcc_dll\mswud -ID:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\sdk\wxscintilla\include -ID:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\include\tinyxml -ID:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\include -ID:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\include\scripting\include -ID:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\exchndl\win_10\win64\include -c D:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\src\app.cpp -o D:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\.objs32_64\CodeBlocks\src\app.o
Crash RPT Snippet:


Code
-------------------

Error occurred on Sunday, July 31, 2022 at 11:00:29.

CodeBlocks.exe caused an Access Violation at location 00007FFFFAAAC2DC in module codeblocks.dll Reading from location FFFFFFFFFFFFFFFF.

AddrPC           Params
00007FFFFAAAC2DC 00000120EBD30BE0 0000001A76BFED50 00000000000005E9  codeblocks.dll!wxPostEvent+0x9c  [D:/Andrew_Development/Libraries/wxWidgets-3.2.0_win64/include/wx/event.h @ 4169]
  4167:     wxCHECK_RET( dest, "need an object to post event to" );
  4168:
> 4169:     dest->AddPendingEvent(event);
  4170: }
  4171:
00007FFFFA8BD86B 00000120F3EED750 00007FFF000049E8 0000000000000000  codeblocks.dll!PipedProcess::OnTerminate+0xd7  [D:/Andrew_Development/Work_Installers/CodeBLocks_Private_Experimental_GCC/src/sdk/pipedprocess.cpp @ 235]
   233:     event.SetInt(status);
   234:     event.SetX(m_Index);
>  235:     wxPostEvent(m_Parent, event);
   236:
   237:     if (m_pvThis)
00007FFFC2B555A6 00000000002309D0 0000000000002B10 0000000000000000  wxmsw32ud_gcc_cb.dll!wxExecuteWindowCbk+0xaf  [D:/Andrew_Development/Libraries/wxWidgets-3.2.0_win64/build/msw/../../src/msw/utilsexc.cpp @ 341]
   339:         if ( data->handler )
   340:         {
>  341:             data->handler->OnTerminate((int)data->dwProcessId,
   342:                                        (int)data->dwExitCode);
   343:         }

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #7 on: July 31, 2022, 06:01:35 am »
Hi, AndrewCot, thanks for the help.

My cb_release_type is much simple: "-g".

I just search for a while, it looks "-O0" is the default gcc compiler if I don't set any "-Ox"

About the other option "-ggdb", some search result shows it is mainly the same as "-g" under Windows.

But anyway, I will try to rebuild C::B again with the option "-g -O0 -ggdb" as the "cb_release_type".

BTW: for me, I only put a dll (for example, the clangd_client.dll) which contains the debug information in my final testing C::B, I mean my C::B (such as codeblocks.exe) is stripped, while only one dll is not stripped.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: error alert message when using ThreadSearch Plugin
« Reply #8 on: July 31, 2022, 06:14:56 am »
When I googled and looked up the options there were some sites saying you needed this and not that and other said something different so I choose to include all three options to ensure I got exactly what I wanted.
On Windows my build/install process does not strip anything as I want to see where issues occur as you will appreciate I am trying a bunch of different bleeding edge changes and integrating allot of different things in my build.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: error alert message when using ThreadSearch Plugin
« Reply #9 on: July 31, 2022, 12:43:15 pm »
I have just commited a possible fix for the issue described in the original post. Ollydbg, can you check if this works?

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: error alert message when using ThreadSearch Plugin
« Reply #10 on: July 31, 2022, 12:55:46 pm »
Regarding the Dr. MinGW part, recent versions do not run on Windows 7.

Offline AndrewCot

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 678
Re: error alert message when using ThreadSearch Plugin
« Reply #11 on: July 31, 2022, 01:29:38 pm »
If you need to run on Win 7 or XP then you can grab the files in sub directories from the following directory to save time figuring out which Dr Mingw you need:

https://github.com/acotty/CodeBlocks_Unofficial_Testing/tree/master/src/exchndl

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #12 on: July 31, 2022, 01:30:56 pm »
Regarding the Dr. MinGW part, recent versions do not run on Windows 7.
Thanks, do you know which is the latest version of Dr MinGW which support Windows 7. Or maybe there are someone which supply a better JIT debugger?

I have follow the way(use the -O0 and -ggdb option) AndrewCot did, and I have downloaded several release version of Dr.MinGW, and they did not give me the call stack.

drmingw-0.9.5-win64, does not work, no call stack crash report.
drmingw-0.9.4-win64, does not work, no call stack crash report.
drmingw-0.9.3-win64, I can't start C::B if I use this dll, it report some api-ms-win-downlevel-kernel32-l2-1-0.dll is missing

drmingw-0.9.2-win64, it works, but not the full call stack is printed, I got only two lines, like below:

Code
codeblocks.exe caused a Breakpoint at location 000007FECAE102D7 in module wxmsw317u_gcc_cb.dll.

AddrPC           Params
000007FECAE102D7 0000000007374C92 0000000007374BF0 000000000C4FEEB0  wxmsw317u_gcc_cb.dll!wxUniChar::ToHi8bit
000007FEB609C194 0000000000006210 0000000000000051 0000000000000132  ThreadSearch.dll!To8bit

So, it looks like the only version is the 0.9.1 which is in our SVN repo, but it can't print the line info of the call stack.  :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #13 on: July 31, 2022, 01:32:29 pm »
If you need to run on Win 7 or XP then you can grab the files in sub directories from the following directory to save time figuring out which Dr Mingw you need:

https://github.com/acotty/CodeBlocks_Unofficial_Testing/tree/master/src/exchndl

Many thanks, I will download and try it and report back.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #14 on: July 31, 2022, 03:28:45 pm »
If you need to run on Win 7 or XP then you can grab the files in sub directories from the following directory to save time figuring out which Dr Mingw you need:

https://github.com/acotty/CodeBlocks_Unofficial_Testing/tree/master/src/exchndl

Many thanks, I will download and try it and report back.

I just checked it and the Win7 folder contains the 0.9.1 version of Dr.MinGW, which can generate a full call stack, but no line information.  :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #15 on: August 02, 2022, 04:52:42 am »
I find another way to catch the crash call stack with line information.

When crash happens (a message box pop up)

I use the gdb's attach command, such as:

Code
attach 1234

The 1234 is the pid of codeblocks.exe which can be found in the Task manager window.

Then using the command:

Code
thread apply all bt

I can get the call stack with line information:
Code
Thread 18 (Thread 2420.0xc20):
#0  0x00000000776e8fda in WaitMessage () from C:\Windows\system32\user32.dll
#1  0x00000000776f4864 in USER32!GetComboBoxInfo () from C:\Windows\system32\user32.dll
#2  0x00000000776f4b85 in USER32!GetComboBoxInfo () from C:\Windows\system32\user32.dll
#3  0x0000000077742e30 in USER32!SoftModalMessageBox () from C:\Windows\system32\user32.dll
#4  0x0000000077742125 in USER32!MessageBoxIndirectW () from C:\Windows\system32\user32.dll
#5  0x000000007774197b in USER32!MessageBoxTimeoutW () from C:\Windows\system32\user32.dll
#6  0x0000000077741872 in USER32!MessageBoxW () from C:\Windows\system32\user32.dll
#7  0x000007fee0c731a6 in DoShowAssertDialog(wxString const&) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#8  0x000007fee0c735f0 in wxAppTraitsBase::ShowAssertDialog(wxString const&) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#9  0x000007fee0c76d82 in ShowAssertDialog(wxString const&, int, wxString const&, wxString const&, wxString const&, wxAppTraits*) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#10 0x000007fee0c77053 in wxAppConsoleBase::OnAssertFailure(wchar_t const*, int, wchar_t const*, wchar_t const*, wchar_t const*) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#11 0x000007fee0c77249 in wxDefaultAssertHandler(wxString const&, int, wxString const&, wxString const&, wxString const&) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#12 0x000007fee0c73e71 in wxOnAssert(char const*, int, char const*, char const*, char const*) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#13 0x000007fee0d402c8 in wxUniChar::ToHi8bit(unsigned int) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#14 0x000007fecb0ac194 in wxUniChar::To8bit (c=25104) at D:/code/wxWidgets-3.1.7/include/wx/unichar.h:200
#15 0x000007fecb0b1319 in wxUniChar::operator char (this=0xbf6ed68) at D:/code/wxWidgets-3.1.7/include/wx/unichar.h:126
#16 0x000007fecb067a8d in TextFileSearcherText::MatchLine (this=0x6e38e60, outMatchedPositions=0x58c028, originalLine=...) at D:\code\cbsource\cb_svn_git\src\plugins\contrib\ThreadSearch\TextFileSearcherText.cpp:57
#17 0x000007fecb066be3 in TextFileSearcher::FindInFile (this=0x6e38e60, filePath=..., foundLines=..., matchedPositions=std::vector of length 3, capacity 4 = {...}) at D:\code\cbsource\cb_svn_git\src\plugins\contrib\ThreadSearch\TextFileSearcher.cpp:147
#18 0x000007fecb087ed0 in ThreadSearchThread::FindInFile (this=0x58bee0, path=...) at D:\code\cbsource\cb_svn_git\src\plugins\contrib\ThreadSearch\ThreadSearchThread.cpp:284
#19 0x000007fecb087988 in ThreadSearchThread::Entry (this=0x58bee0) at D:\code\cbsource\cb_svn_git\src\plugins\contrib\ThreadSearch\ThreadSearchThread.cpp:219
#20 0x000007fee0d9b932 in wxThread::CallEntry() () from F:\code\cb\wxmsw317u_gcc_cb.dll
#21 0x000007fee0da6228 in wxThreadInternal::DoThreadStart(wxThread*) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#22 0x000007fee0da6380 in wxThreadInternal::WinThreadStart(void*) () from F:\code\cb\wxmsw317u_gcc_cb.dll
#23 0x000007feff1b415f in srand () from C:\Windows\system32\msvcrt.dll
#24 0x000007feff1b6ebd in msvcrt!_ftime64_s () from C:\Windows\system32\msvcrt.dll
#25 0x00000000775c556d in KERNEL32!BaseThreadInitThunk () from C:\Windows\system32\kernel32.dll
#26 0x000000007782372d in ntdll!RtlUserThreadStart () from C:\Windows\SYSTEM32\ntdll.dll
#27 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)


--------------------------------------
I report the drmingw issue in their github site: ExcHndl.dll can't print the crash call stack under Windows 7 Issue #71 jrfonseca/drmingw, it looks like they still support Windows 7.

@Miguel Gimenez
I will check your fix, thanks.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #16 on: August 03, 2022, 09:03:31 am »
I have just commited a possible fix for the issue described in the original post. Ollydbg, can you check if this works?

I just checked your fix in the SVN, and  I can confirm my reported wx warning dialog is gone, thanks!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: error alert message when using ThreadSearch Plugin
« Reply #17 on: August 03, 2022, 11:52:01 am »
Thank you for testing (I could not reproduce the issue).

I have just marked ticket 1275 as fixed.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #18 on: August 13, 2022, 08:48:38 am »
Please investigate future in this. Line numbers would be AWSOME

Here are some good news

I just found and fixed the bug in DrMinGW, and now it works correctly if the bug got fixed. In my local build of DrMinGW(the git master version, currently 0.9.6), it can report the call-stack with line information from the ExcHndl.dll.

See this github issue, especially the lastest comments.

ExcHndl.dll can't print the crash call stack under Windows 7 Issue #71 jrfonseca/drmingw

The correct RPT could looks like:

Code
-------------------

Error occurred on Saturday, August 13, 2022 at 14:42:33.

codeblocks.exe caused a Breakpoint at location 000007FEC83B02D7 in module wxmsw317u_gcc_cb.dll.

AddrPC           Params
000007FEC83B02D7 000000000790B072 000000000790AFD0 000000000C40EC60  wxmsw317u_gcc_cb.dll!wxUniChar::ToHi8bit+0x67
000007FEC9E7C194 0000000000006210 0000000000000051 0000000000000132  ThreadSearch.dll!wxUniChar::To8bit+0x24  [D:/code/wxWidgets-3.1.7/include/wx/unichar.h @ 200]
000007FEC9E81319 000000000C40ED08 0000000000000051 0000000000000000  ThreadSearch.dll!wxUniChar::operator char+0x19  [D:/code/wxWidgets-3.1.7/include/wx/unichar.h @ 126]
000007FEC9E37A8D 0000000007789F70 000000000053BB48 000000000C40EE20  ThreadSearch.dll!TextFileSearcherText::MatchLine+0x119  [D:/code/cbsource/cb_svn_git/src/plugins/contrib/ThreadSearch/TextFileSearcherText.cpp @ 57]
000007FEC9E36BE3 0000000007789F70 000000000257D858 000000000053BB20  ThreadSearch.dll!TextFileSearcher::FindInFile+0x485  [D:/code/cbsource/cb_svn_git/src/plugins/contrib/ThreadSearch/TextFileSearcher.cpp @ 147]
000007FEC9E57ED0 000000000053BA00 000000000257D858 00000000078CD550  ThreadSearch.dll!ThreadSearchThread::FindInFile+0x8c  [D:/code/cbsource/cb_svn_git/src/plugins/contrib/ThreadSearch/ThreadSearchThread.cpp @ 284]
000007FEC9E57988 000000000053BA00 0000000000000000 0000000000000000  ThreadSearch.dll!ThreadSearchThread::Entry+0xaae  [D:/code/cbsource/cb_svn_git/src/plugins/contrib/ThreadSearch/ThreadSearchThread.cpp @ 219]
000007FEC840B932 000000000053BA00 0000000000000001 0000000000000000  wxmsw317u_gcc_cb.dll!wxThread::CallEntry+0x72
000007FEC8416228 000000000053BA00 000000000774CE80 0000000000000000  wxmsw317u_gcc_cb.dll!wxThreadInternal::DoThreadStart+0x5f8
000007FEC8416380 00000000079E2A10 0000000000000000 0000000000000000  wxmsw317u_gcc_cb.dll!wxThreadInternal::WinThreadStart+0x40
000007FEFE54415F 000007FEFE5D1EA0 00000000079E2A10 0000000000000000  msvcrt.dll!srand+0x93
000007FEFE546EBD 0000000000000000 0000000000000000 0000000000000000  msvcrt.dll!_ftime64_s+0x1dd
00000000772E556D 0000000000000000 0000000000000000 0000000000000000  kernel32.dll!BaseThreadInitThunk+0xd
000000007754385D 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart+0x1d

000000013F650000-000000013F889000 codeblocks.exe 20.3.0.0
00000000774F0000-000000007768F000 ntdll.dll    6.1.7601.24524
...
...
...

Windows 6.1.7601
DrMingw 0.9.6
« Last Edit: August 13, 2022, 08:57:04 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #19 on: September 16, 2022, 05:49:12 am »
Hi, the drmingw has the new release 0.9.7, and it fixes the reading call-stack issue I reported in this thread.

Release 0.9.7 jrfonseca/drmingw

So, my guess is we have to update to this release in our code::blocks svn repo?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: error alert message when using ThreadSearch Plugin
« Reply #20 on: September 16, 2022, 07:53:13 am »
New releases do not support Windows 7, because they are linked to Windows 8+ DLL.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #21 on: September 16, 2022, 07:59:14 am »
New releases do not support Windows 7, because they are linked to Windows 8+ DLL.

I just replace the drmingw dll files in my win7's Code::Blocks folder, and I can start C::B without any issue.

I use the dependency walker to check the exchndl.dll, and it looks good. What is the Windows 8+ DLL?

EDIT

I just tested it, and it(exchndl.dll) can correctly catch the crash from a sample program and write the RPT file. So, it works on my Windows 7 64bit.
« Last Edit: September 16, 2022, 08:12:36 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: error alert message when using ThreadSearch Plugin
« Reply #22 on: September 16, 2022, 11:07:13 am »
Windows 8+ means Windows 8 and later.

The stock Windows 7 SP1 does not have the required DLL, but there is an optional KBxxxxx that installs it. I will check DrMinGW 0.9.7 on my system.

EDIT: I get problems with dependencies, the following files are not found:
Code
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-EVENTING-PROVIDER-L1-1-0.DLL
DCOMP.DLL
GPSVC.DLL
IESHIMS.DLL
« Last Edit: September 16, 2022, 11:46:43 am by Miguel Gimenez »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #23 on: September 16, 2022, 01:39:36 pm »
Windows 8+ means Windows 8 and later.

The stock Windows 7 SP1 does not have the required DLL, but there is an optional KBxxxxx that installs it. I will check DrMinGW 0.9.7 on my system.

EDIT: I get problems with dependencies, the following files are not found:
Code
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-EVENTING-PROVIDER-L1-1-0.DLL
DCOMP.DLL
GPSVC.DLL
IESHIMS.DLL


Which dll are requiring those missing dlls?

I think the exchndl.dll and mgwhelp.dll files are built from the drmingw project.
While, the dbgcore.dll, dbghelp.dll and symsrv.dll are mainly from the windows sdk(windows debugging tools)

So, we only need to update the exchndl.dll and mgwhelp.dll files?

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: error alert message when using ThreadSearch Plugin
« Reply #24 on: September 16, 2022, 02:07:00 pm »
Quote
Which dll are requiring those missing dlls?

exchndl.dll

We can recompile exchndl.dll for 0.9.7 using MinGW-w64 with win32 threading model, as recommended here.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: error alert message when using ThreadSearch Plugin
« Reply #25 on: October 15, 2022, 05:12:01 am »
Update:

The drmingw 0.9.8 is released.

Releases jrfonseca/drmingw

Let me ask the author (jrfonseca) that he can supply a version to support windows 7.

EDIT:

See my reported issue here:
What is the minimal OS to run the official drmingw release?  Issue #81 jrfonseca/drmingw

We need an updated Win7.
« Last Edit: October 15, 2022, 04:55:18 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.