简体   繁体   中英

GDB 7.3.1 on OSX Lion

I'm trying to use GDB (v 7.3.1) from macports to debug an executable compiled with g++ 4.7 (also from macports). However, I start the debugger, I get the following output:

GNU gdb (GDB) 7.3.1 Copyright (C) 2011 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 "x86_64-apple-darwin11.2.0". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/ ... BFD: unable to read unknown load command 0x24 BFD: unable to read unknown load command 0x26 BFD: unable to read unknown load command 0x24 BFD: unable to read unknown load command 0x26

Then, whenever I attempt to backtrace, the debugger is unable to provide any information about the stack; I get output like:

> #0  0x00000001085106d5 in ?? ()
> #1  0x000000010833d9b6 in ?? ()
> #2  0x0000000107e23000 in ?? ()
> #3  0x00007f828341f630 in ?? ()
> #4  0x00007f828341bc10 in ?? ()
> #5  0x00007f8283421950 in ?? ()
> #6  0x00007f8283427020 in ?? ()
> #7  0x00007f8283425510 in ?? ()
> #8  0x00007f82834195e0 in ?? ()
> #9  0x0000000100000001 in ?? ()
> #10 0x0000000100000000 in ?? ()

I've built with debug symbols, and I'm able to debug the executable fine on linux. Does anyone know what's going on here or how I might fix it. It's really difficult to fix certain problems without a debugger!

I don't know much about OSX or usage of gdb on it, but this appears to have been fixed shorly after the release of gdb 7.3.1, I seem to recall something about the release of OSX and the release of gdb or binutils being around the same time, with the developer not having any early access to OS X. You could try a later version of gdb.

I'm guessing that the following patch committed shortly after 7.3.1 fixes it:

http://permalink.gmane.org/gmane.comp.gnu.binutils/54607

GDB 7.4.1 had fixed this issue, you could get and build it.

http://sourceware.org/gdb/wiki/BuildingOnDarwin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM