[I am not on this list, so please cc me.] GDB 7.3.1 on OS X 10.7.2 is not working. The link below suggests that in late October, it worked.
Debugging some code as normal user, I get the first output below: first some complaints from BFD, and then a statement "Unable to find Mach task port" suggesting the problem has to do woth it not being codesigned. However, attempts with codesigning it did not help, the /usr/bin/gdb 6.3.50-20050815 (Apple version gdb-1708) that comes with Xcode 4.2 is not codesigned. When debugging as root (sudo), I get the second output below. The difference is that the Mach task port error has been replaced by Cannot insert breakpoint 1. Error accessing memory address 0x10000495b: Input/output error. So it seems broken anyway. The code was compiled using Apple clang version 3.0 (tags/Apple/clang-211.12). However, the errors are the same when compiled with gcc 4.6.2; the output is the same as normal user, and as root the same type of memory access error is output twice. Attempting to use the gdb 6.3.50 mentioned above gives the fourth output below, "Dwarf Error: Cannot find type of die", which I think it means it is too old to handle the debugging info of gcc 4.6.2. Hans http://groups.google.com/group/golang-nuts/browse_thread/thread/b2b9719f057c7673 ----- $ gdb test GNU gdb (GDB) 7.3.1 ... This GDB was configured as "x86_64-apple-darwin11.2.0". ... 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 Reading symbols from <path>/test...done. (gdb) break test.cc:53 Breakpoint 1 at 0x10000495b: file test.cc, line 53. (gdb) run Starting program: <path>/test Unable to find Mach task port for process-id 56470: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) (gdb) ---- # gdb test GNU gdb (GDB) 7.3.1 ... This GDB was configured as "x86_64-apple-darwin11.2.0". ... 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 Reading symbols from <path>/test...done. (gdb) break test.cc:53 Breakpoint 1 at 0x10000495b: file test.cc, line 53. (gdb) run Starting program: <path>/test BFD: unable to read unknown load command 0x24 BFD: unable to read unknown load command 0x26 Error in re-setting breakpoint 1: Cannot access memory at address 0x100004420 Warning: Cannot insert breakpoint 1. Error accessing memory address 0x10000495b: Input/output error. (gdb) ---- # gdb test GNU gdb (GDB) 7.3.1 ... This GDB was configured as "x86_64-apple-darwin11.2.0". ... 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 Reading symbols from <path>/test...done. (gdb) break test.cc:53 Breakpoint 1 at 0x1000027d9: file test.cc, line 53. (2 locations) (gdb) run Starting program: <path>/test BFD: unable to read unknown load command 0x24 BFD: unable to read unknown load command 0x26 Error in re-setting breakpoint 1: Cannot access memory at address 0x100002580 Warning: Cannot insert breakpoint 1. Error accessing memory address 0x1000027d9: Input/output error. Cannot insert breakpoint 1. Error accessing memory address 0x10000304d: Input/output error. (gdb) ---- $ /usr/bin/gdb test GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011) ... This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ..... done (gdb) break test.cc:53 Die: DW_TAG_unspecified_type (abbrev = 15, offset = 1219) has children: FALSE attributes: DW_AT_name (DW_FORM_string) string: "decltype(nullptr)" Dwarf Error: Cannot find type of die [in module <path>/test] (gdb) ----