Author Topic: C::B on snow leopard, gdb issue  (Read 5496 times)

Offline spectrum

  • Multiple posting newcomer
  • *
  • Posts: 16
C::B on snow leopard, gdb issue
« on: August 04, 2011, 04:53:35 pm »
Hello all,

i am facing a very strange issue, trying to debug a wxWidget program from inside C::B:
i get this error just after gdb start:

Building to ensure sources are up-to-date
Build succeeded
Selecting target:
debug
Adding source dir: /Users/angelo/barix/tools/bsd/
Adding source dir: /Users/angelo/barix/tools/bsd/
Adding file: bin/debug/bsd
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.3.50-20050815 (Apple version gdb-1461.2) (Fri Mar  5 04:43:10 UTC 2010)
Program received signal SIGTRAP, Trace/breakpoint trap.
In __dyld_dyld_fatal_error () ()

Backtrace:
#0  0x8fe01065 in __dyld_dyld_fatal_error ()
#1  0x8fe04fa5 in __dyld__ZN4dyld4haltEPKc ()
#2  0x8fe0796b in __dyld__ZN4dyld5_mainEPK12macho_headermiPPKcS5_S5_ ()
#3  0x8fe018b1 in __dyld__ZN13dyldbootstrap5startEPK12macho_headeriPPKcl ()
#4  0x8fe01057 in __dyld__dyld_start ()


Looking with ps, i see C::B is invoking gdb with:
/usr/libexec/gdb/gdb-i386-apple-darwin -nx -fullname -quiet -args bin/debug/bsd

Using this same command with gdb from the console, program get loaded correctly and can run.
`--> /usr/libexec/gdb/gdb-i386-apple-darwin -nx -fullname -quiet -args bin/debug/bsd
Reading symbols for shared libraries ...................... done
(gdb) run
Starting program: /Users/angelo/barix/tools/bsd/bin/debug/bsd
Reading symbols for shared libraries .+++++++++++++++++++++..................................................................................................
..

It's really strange, like if gdb launched from C::B is not able to load some dynamic libraries.

Every help is very appreciated.
Many thanks and Regards.
angelo















Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B on snow leopard, gdb issue
« Reply #1 on: August 04, 2011, 05:46:10 pm »
Inspect the debugger's debug log (the log with the actual commands sent to the debugger), the setting to show the log is in settings->compiler & debugger -> debugger
Keep in mind that this gdb is extremely old.
C::B is made to work best with gdb 6.8+.
Please see if you can update your gdb, I know this is a bit problematic for MacOSX users.
(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 spectrum

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: C::B on snow leopard, gdb issue
« Reply #2 on: August 04, 2011, 06:26:58 pm »
Thanks,

well, i am anti-mac, for several reasons, but this time issue seems to be in C::B,
in the way it launch GDB, since gdb works fine from the console.

The gdb log says :

DYLD_LIBRARY_PATH=.:/opt/local/lib:/usr/local/lib:
Command-line: /usr/bin/gdb -nx -fullname  -quiet -args bin/debug/bsd

.....

then the error.

And the issue is that in DYLD_LIBRARY_PATH forced from CodeBlock /lib/sw folder is missing.
I tried to find if this env var setup is configurable, but i still don't find anything.

every help is appreciated

thanks
angelo






Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B on snow leopard, gdb issue
« Reply #3 on: August 04, 2011, 06:52:50 pm »
You've not read my post, haven't you?
Read it. And then inspect the log, you'll see that C::B executes many commands you don't see in the normal log.
Execute the same commands in command line gdb and you'll see that it breaks the same way.
Some of the commands are known to break older gdbs (catch c++ exceptions is know to not work with 6.8 and c only projects, for example).

p.s. Please use code tags for pastes of logs/code. It makes post more readable.
(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 spectrum

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: C::B on snow leopard, gdb issue
« Reply #4 on: August 04, 2011, 07:13:15 pm »
hi,

well we are probably both reading posts too fast and entering a misundertanding loop :)
I explain better:

I enabled as you sayd the codeblocks debugger log.
It shows:

Code

DYLD_LIBRARY_PATH=.:/opt/local/lib:/usr/local/lib:
Command-line: /usr/bin/gdb -nx -fullname  -quiet -args bin/debug/bsd
...


And in particular the line
"DYLD_LIBRARY_PATH=.:/opt/local/lib:/usr/local/lib:"
is causing the issue.


As you said, launching the debugger from the console, if i do the same thing that codeblocks do ("DYLD_LIBRARY_PATH=.:/opt/local/lib:/usr/local/lib:")  this break gdb.

GDB is old, but stable, and works fine, except if you are forcing DYLD_LIBRARY_PATH with a wrong path.

regards



Offline spectrum

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: C::B on snow leopard, gdb issue
« Reply #5 on: August 04, 2011, 07:26:13 pm »
i finally solved, there was a quite hidden option in "project settings->debugger" that block C::B from setting this variable.

Thanks for the hints.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: C::B on snow leopard, gdb issue
« Reply #6 on: August 04, 2011, 08:49:19 pm »
i finally solved, there was a quite hidden option in "project settings->debugger" that block C::B from setting this variable.

Thanks for the hints.
It would be nice, if you could post what you did exactly.
This might help others, who stumble over the same problem.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B on snow leopard, gdb issue
« Reply #7 on: August 04, 2011, 10:45:44 pm »
He should have enabled the option "Do not adjust the LD_LIBRARY_PATH variable, before starting the debugger"

spectrum: Can you paste the full log, so I can inspect it a bit? This behaviour is pretty strange.
(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 spectrum

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: C::B on snow leopard, gdb issue
« Reply #8 on: August 04, 2011, 11:21:24 pm »
Hi,

well, i "disabled" the option "Do NOT adjust LD__LIBRARY__PATH before launching the debugger", in Project->Properties->debugger tab.

The entire long is quite long since there are many warnings (unrelated to the issue), anyway, here it is:

Code
DYLD_LIBRARY_PATH=.:/opt/local/lib:/usr/local/lib:
Command-line: /usr/bin/gdb -nx -fullname  -quiet -args bin/debug/bsd
Working dir : /Users/angelo/barix/tools/bsd/
> set prompt >>>>>>cb_gdb:
Reading symbols for shared libraries ...................... done
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb 6.3.50-20050815 (Apple version gdb-1461.2) (Fri Mar  5 04:43:10 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
>>>>>>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 disassembly-flavor intel
>>>>>>cb_gdb:
> catch throw
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> source /Applications/CodeBlocks.app/Contents/Resources/share/codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> DYLD_LIBRARY_PATH=.:/opt/local/lib:/usr/local/lib:sw/lib:
Undefined command: "DYLD".  Try "help".
>>>>>>cb_gdb:
> directory /Users/angelo/barix/tools/bsd/
>>>>>>cb_gdb:
> set args sudo
>>>>>>cb_gdb:
> run
Reading symbols for shared libraries
.+++++++++++++++++++++.
...
......
.
...
.......
.
..
..
......
.
..
.
..
.
..
...
....
..
..
...
.
.
..
..
.......
..
...
....
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_x11_mesa/mesa/work/Mesa-7.11-rc3/src/glu/sgi/libutil/error.o" - no debug information available for "libutil/error.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_x11_mesa/mesa/work/Mesa-7.11-rc3/src/glu/sgi/libutil/glue.o" - no debug information available for "libutil/glue.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/info.o" - no debug information available for "info.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/floor1.o" - no debug information available for "floor1.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/floor0.o" - no debug information available for "floor0.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/res0.o" - no debug information available for "res0.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/mapping0.o" - no debug information available for "mapping0.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/registry.o" - no debug information available for "registry.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/codebook.o" - no debug information available for "codebook.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/sharedbook.o" - no debug information available for "sharedbook.c".
warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_audio_libvorbis/work/libvorbis-1.3.2/lib/.libs/bitrate.o" - no debug information available for "bitrate.c".
...... done
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Program received signal SIGTRAP, Trace/breakpoint trap.
0x8fe01065 in __dyld_dyld_fatal_error ()
>>>>>>cb_gdb:


The issue is on the first line, the correct working variable must be :
DYLD_LIBRARY_PATH=/sw/lib:$DYLD_LIBRARY_PATH

regards
angelo