问题
I installed XCode 5.1 with clang
I installed gcc 4.8 via homebrew
Installed gdb 7.7.1 via homebrew
Using OSX 10.9.3
I compile my c++ source in eclipse kepler with a Makefile using g++-4.8 and try to debug it but when reaching a breakpoint I can't see any variables just like in this question: GDB says "no symbol table," but nm shows file has debug symbols
I followed the suggestions of @Tom Tromey in the suggestions section of that question to use
set complaints 10000
in gdb and then load the file. This revealed lots of errors during loading. First I saw lots of these:
unhandled stab for dwarf OSO file...unhandled stab for dwarf OSO file...
then lots of these:
During symbol reading, location expression too complex.
During symbol reading, Member function "~clone_impl" (offset 414143) is virtual but the vtable offset is not specified.
and then a whole lot more of these:
During symbol reading, unexpected overlap between:
(A) section `__TEXT.__textcoal_nt' from `<snip>/sourcefilename.o' [0x228, 0x28c)
(B) section `__TEXT.__textcoal_nt' from `<snip>/differentsourcefilename.o' [0x268, 0x2cc).
Will ignore section B.
There are lots of errors where one section is being ignored in favor of another.
I used to think gdb was the culprit but I have found today that if I use llvm-g++ instead, then gdb works as expected. I was overjoyed at finding I could actually debug without using cout statements.
Another similar question: How do I get a homebrewed version of GDB working on Mac OS X?
I would like to fix the problem with g++-4.8 and need help. Most of the answers I found related to outdated versions of gdb but 7.7.1 is pretty recent and should work based on what others suggested on SO.
来源:https://stackoverflow.com/questions/24414707/how-do-i-get-a-homebrewed-version-of-gdb-working-on-mac-os-x-nr-2