Author Topic: GDB Crash when using wxWidgets 2.9.x  (Read 11450 times)

Offline Feneck91

  • Multiple posting newcomer
  • *
  • Posts: 112
GDB Crash when using wxWidgets 2.9.x
« on: July 18, 2011, 05:50:45 pm »
I make a project with wxWidgets 2.8.12, all working fine.
But... to be able to use wxAny (see topic here) and prepare my project to use the future wxWidgets 3.0 release, I have modified all my application to use wxWidgets 2.9.3.
After corrected all crash due to wxWidgets interface modifications, all working fine.
Can run the app in debug mode without debugger.
Can run the app in debug mode with debugger running without code::blocks.
But cannot run gdb inside Code::Blocks (svn 7286, but other version have same problems), the debugger crash.

WxWidgets compilation batch (in build\Win32 folder):
Code
@ECHO OFF

REM Record current folder path
pushd .
cd ../../
CALL Build/Win32/Settings.bat

ECHO WxWidgets path = %WXWIN%
cd /D %WX_DIR%\build\msw

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1 clean
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1 clean

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1

REM Restore initial path
popd

pause
Setting.bat
Code
@ECHO OFF
REM ------------------
REM     SETTINGS
REM ------------------

REM ------------------
REM       MINGW
PATH=C:\MinGW\bin;C:\MinGW\mingw32\bin

REM ------------------
REM      TTGEST
SET TTGEST_ROOT_PATH=%cd%

REM ------------------
REM     WXWIDGETS
SET WX_WIDGETS_VERSION=2.9.2
SET WXWIN=%TTGEST_ROOT_PATH%\wxWidgets-%WX_WIDGETS_VERSION%
ECHO WXWIN=%WXWIN%
SET WX_DIR=%WXWIN%
SET WX_WIDGETS_VENDOR_NAME=TTGEST
All wxWidgets compilation is working fine. May I miss some new options ? It works with wxWidgets 2.8.12

Debugger window :
Code
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Win32 Unicode Debug
Adding source dir: D:\Dev\TTGest\trunk\TTGest\
Adding source dir: D:\Dev\TTGest\trunk\TTGest\
Adding file: ..\Application\Debug\TTGestd.exe
Starting debugger:
done
Registered new type: STL WString
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.0.50.20100202
Debugger finished with status 1

And debugger log (activated into code::blocks debugger options)
Code
PATH=.;D:\Dev\TTGest\trunk\CAnsiPort\lib;D:\Dev\TTGest\trunk\wxETK\lib;D:\Dev\TTGest\trunk\wxCAnsiPortETK\lib;D:\Dev\TTGest\trunk\TTGestLib\lib;D:\Dev\TTGest\trunk\wxWidgets-2.9.2\lib\gcc_dll;C:\MinGW\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Subversion\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows Live\Shared;C:\Program Files\Internet Explorer
Command-line: C:\MinGW\bin\gdb.exe -nx -fullname  -quiet -args ../Application/Debug/TTGestd.exe
Working dir : D:\Dev\TTGest\trunk\TTGest\
> set prompt >>>>>>cb_gdb:
Reading symbols from D:\Dev\TTGest\trunk\TTGest/../Application/Debug/TTGestd.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.0.50.20100202
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> catch throw
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
../../gdb-7.0.50.20100202/gdb/breakpoint.c:6481: internal-error: expand_line_sal_maybe: Assertion `found' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

A way : if I remove "Catch C++ exception" the debugger run fine inside Code::Blocks.
Strange, isn't it ?



Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #1 on: July 18, 2011, 06:09:48 pm »
BTW, you probably want to use:

Code
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1 DEBUG_FLAG=0

for building release version (otherwise you will get wxDEBUG_LEVEL=1 in release build which enable assertions)

Eran


Offline Feneck91

  • Multiple posting newcomer
  • *
  • Posts: 112
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #2 on: July 18, 2011, 06:19:56 pm »
I build wxWidgets for several years like this :?
Ok, added. Is DEBUG_FLAG=1 must be set to build in debug mode ?

But, it is a release problem, my problem is in debug mode, using gdb under Code::Blocks.

Anyway, thanks for your reply, have update my build batch for release mode ;)
Code
@ECHO OFF

REM Record current folder path
pushd .
cd ../../
CALL Build/Win32/Settings.bat

ECHO WxWidgets path = %WXWIN%
cd /D %WX_DIR%\build\msw

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1 clean
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1 DEBUG_FLAG=0 clean

mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1
mingw32-make -f makefile.gcc MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release VENDOR=%WX_WIDGETS_VENDOR_NAME% USE_XRC=1 DEBUG_FLAG=0

REM Restore initial path
popd

pause

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #3 on: July 18, 2011, 06:33:09 pm »
I guess the problem is in GDB, not in C::B, please report it to the GDB devs, we can't do anything about it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Feneck91

  • Multiple posting newcomer
  • *
  • Posts: 112
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #4 on: July 18, 2011, 06:49:03 pm »
Ok, it is in GDB.
Why with wxWidgets 2.8.x it's work fine ?
Why with gdb out of Code::Blocks it's work fine ?
Why with "Catch C++ Exception" disabled inside Code::Blocks IDE it's work fine ?

I think it is a gdb configuration process into Code::Blocks that make it crashed.
Is gdb_types.script is up to date with wxWidgets 2.9.x and don't make exceptions ?
Strange, when remove C:\Program Files\CodeBlocks\share\CodeBlocks\scripts\gdb_types.script file, this doesn't remove the following lines when gdb start :
Code
Registered new type: STL WString
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector

I'm not sure it is only a gdb poblem else it will crash in the same way with wxWidgets 2.8.x, isn't it ?
Some peaple already report this kind of problem ?
« Last Edit: July 18, 2011, 06:51:01 pm by Feneck91 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #5 on: July 18, 2011, 07:45:12 pm »
Enable the full debugger's debug log (settings -> compiler & debugger -> debugger -> enable debugger's debug log (or something like that)).
Then execute the same commands in the stand alone gdb and see, which command is causing the problem.
Then report the problem to GDB devs.

But first update you GDB to something newer. Keep in mind that x.x.50 or x.x.90 are development release, not the stable releases of gdb.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Feneck91

  • Multiple posting newcomer
  • *
  • Posts: 112
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #6 on: July 18, 2011, 08:17:19 pm »
Stable gdb 7.2 download, same crash:
Code
PATH=.;D:\Dev\TTGest\trunk\CAnsiPort\lib;D:\Dev\TTGest\trunk\wxETK\lib;D:\Dev\TTGest\trunk\wxCAnsiPortETK\lib;D:\Dev\TTGest\trunk\TTGestLib\lib;D:\Dev\TTGest\trunk\wxWidgets-2.9.2\lib\gcc_dll;C:\MinGW\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Subversion\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows Live\Shared;C:\Program Files\Internet Explorer
Command-line: C:\MinGW\bin\gdb.exe -nx -fullname  -quiet -args ../Application/Debug/TTGestd.exe
Working dir : D:\Dev\TTGest\trunk\TTGest\
> set prompt >>>>>>cb_gdb:
Reading symbols from D:\Dev\TTGest\trunk\TTGest/../Application/Debug/TTGestd.exe...
done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
This binary was built by Equation Solution <http://www.Equation.com>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> catch throw
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
../../gdb-7.2/gdb/breakpoint.c:7129: internal-error: expand_line_sal_maybe: Assertion `found' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #7 on: July 18, 2011, 09:09:36 pm »
Looking at the log it is pretty clear, where is the problem :)
Please contact the GDB devs, so they can fix the problem...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #8 on: July 18, 2011, 10:39:33 pm »
Also, just an fyi I had the GDB crash on me because of some coding errors that compiled but would totally fail when run.

It's pretty bad when your debugger is like "Wtf is this? How did you even manage to do that?" lol

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #9 on: July 19, 2011, 03:55:58 am »
@feneck91
1, from the log, I see:
Quote
> show version
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
This binary was built by Equation Solution <http://www.Equation.com>.
You gdb is not official mingw build, so You can try a stable one from mingw.

2, If you would like to try a more recent gdb, you can try pcx's package:
http://pcxprj.googlecode.com/files/MinGW_gcc4.6.1release_static_win32.7z
it contains a gdb is about 201107XX, which is quite new. (but is is a trunk version), as stable gdb 7.3 is not released yet.

3, I guess mostly the crash is in GDB itself, you can try both run the same commands(in the debugger log) in a Windows console, to see it crashed again.

4, the final step is just read some gdb source code.
It sounds like the crash is under gdb's source line: ../../gdb-7.2/gdb/breakpoint.c:7129:
and see what's the problem in it. GDB's source code is quite module, and I think it's not hard to read. then you can even build a gdb under mingw.
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #10 on: July 19, 2011, 06:34:52 am »
Try to switch off (uncheck) "Catch C++ exceptions" in "Settings -> Compiler and debugger... -> Debugger settings".

Offline Feneck91

  • Multiple posting newcomer
  • *
  • Posts: 112
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #11 on: July 19, 2011, 10:41:51 am »
Try to switch off (uncheck) "Catch C++ exceptions" in "Settings -> Compiler and debugger... -> Debugger settings".
With removing "Catch C++ exceptions" in "Settings it work fine. I had already said it.
I agree with you, it is a GDB crash, no problem with this; but as I said into my firs post: Can run the app in debug mode with debugger running without code::blocks, so without Code::Blocks commands, it works fine.
I let this post opened for everyone who can have this kind of problem, will try to install last MinGW compiler, but with last version few month ago, I was not able to  compile wxWidgets.
And give feed back.

Offline Feneck91

  • Multiple posting newcomer
  • *
  • Posts: 112
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #12 on: July 19, 2011, 04:19:00 pm »
I have uninstalled MinGw and install last version.
Deleted wxWidgets 2.9.2 and re-build it again with this MinGW version.
Re-build all my project.
Now all is working fine with or without c+ exception. Strange, GDB should be linked with gcc version compiler ?
I put this topic to resolved.
Sorry to bother you.

Offline Feneck91

  • Multiple posting newcomer
  • *
  • Posts: 112
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #13 on: July 27, 2011, 03:02:07 pm »
I have see this post : http://code.google.com/p/qp-gcc/, it is exactly the problem I had before finding a fix.
Another thing : With this new version all work fine ... with wxWidgets 2.9.2.... but not with wxWidgets 2.8.12 that this mingw gdb version cannot compile, you must use TDM version, see topic here!
I remove all wxWidgets version, uninstall MinGW, install TDM Version, re-compile wxWidgets 2.8.12 & 2.9.2 and test if this work again.

All is working fine with TDM: compilation of wxWidgets 2.8.12 & 2.9.2 / debugging without any problems.
« Last Edit: July 29, 2011, 07:40:50 am by Feneck91 »

Offline Feneck91

  • Multiple posting newcomer
  • *
  • Posts: 112
Re: GDB Crash when using wxWidgets 2.9.x
« Reply #14 on: July 29, 2011, 07:55:54 am »
All is working fine with TDM: compilation of wxWidgets 2.8.12 & 2.9.2 / debugging without any problems.
.... too fine....
I no need anymore the mingwm10.dll to make my software run (remove the PATH "C:\MinGW\bin"), search everywhere, only one copy into C:\MinGW\bin
With last version of MinGW (without TDM), I need more two dll: "libgcc_s_dw2-1dll" and "libstdc++-6.dll" that don't need no more too.

Strange. No modifications about CodeBlocks projets where changed, TDM link C++ libs as static automatically ?