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:
The 1234 is the pid of codeblocks.exe which can be found in the Task manager window.
Then using the command:
I can get the call stack with line information:
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.