0

I have this kind of message when I start gdb :

$ gdb a.out 
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov  3 21:59:02 UTC 2011)
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"...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_tarballs_ports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libstdc++-v3/src/../libsupc++/.libs/libsupc++convenience.a(array_type_info.o)" - no debug information available for "../../../../gcc-4.7.0/libstdc++-v3/libsupc++/array_type_info.cc".


warning: Could not find object file "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc47/gcc47/work/build/x86_64-apple-darwin11/libstdc++-v3/src/../libsupc++/.libs/libsupc++convenience.a(bad_alloc.o)" - no debug information available for "../../../../gcc-4.7.0/libstdc++-v3/libsupc++/bad_alloc.cc".

It seems that I need to fetch again the libstdc++ but how with macports?

Bebeoix
  • 579
  • 2
  • 5
  • 17

2 Answers2

1

This is one of several problems caused by the special Unix environment installed by Apple as part of Xcode. If you need a newer version of gcc than the one installed by Xcode, make sure you also install a newer version of gdb, or you will get the problems described above. You also need to make sure that your environment actually calls the macport versions of both and not the default Xcode versions.

Just installing gcc from macports will NOT make the command 'gcc' invoke the version of gcc installed by macports. Similarly, 'gdb' will not invoke the version of gdb installed by macports. The versions installed by macports have the paths '/opt/local/bin/gcc-mp-4.6' and '/opt/local/ggdb' or something similar dependent on the version number of gcc. Note that it is 'ggdb' and not 'gdb'.

One solution is to always explicitly invoke the right version by giving the entire path. Another is to replace the default gcc and gdb locations with links to the macports versions (this may cause problems with Xcode possibly). The default locations are '/usr/local/bin/gcc' and '/usr/bin/gdb'. The default bash shell will look in those locations regardless of your path settings.

ronquist
  • 11
  • 2
0

http://gcc.gnu.org/gcc-4.5/changes.html says

GCC now generates unwind info also for epilogues. DWARF debuginfo generated by GCC now uses more features of DWARF3 than before, and also some DWARF4 features. GDB older than 7.0 is not able to handle either of these, so to debug GCC 4.5 generated binaries or libraries GDB 7.0 or later is needed. You can disable use of DWARF4 features with the -gdwarf-3 -gstrict-dwarf options, or use -gdwarf-2 -gstrict-dwarf to restrict GCC to just DWARF2, but epilogue unwind info is emitted unconditionally whenever unwind info is emitted.

So you should see if there is a newer GDB in macports.

Jonathan Wakely
  • 166,810
  • 27
  • 341
  • 521