[MacPorts] #36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port ------------------------------------+-------------------------------- Reporter: jb_duffy@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Keywords: gdb BFD Mach task port | Port: gdb ------------------------------------+-------------------------------- Hi Mountain Lion OS X 10.8.2, XCode 4.5.1, MacBook Pro 2.4 GHz Intel Core i7, 4 GB 1333 MHz DDR3 I have successfully installed MacPorts gcc-mp-4.7. And, gdb 7.5 appears to have installed successfully. I can build a simple Hello World C program but when I try to debug it with gdb I get one possibly two separate errors. Below is a sample build and debug session: {{{ macbook:test john$ make gcc-mp-4.7 -Wall -std=c99 -pedantic -g -O0 hello.c -o hello macbook:test john$ ls -l total 40 -rw-r--r-- 1 john staff 69 25 Oct 15:20 Makefile -rwxr-xr-x 1 john staff 8756 25 Oct 15:22 hello -rw-r--r-- 1 john staff 110 25 Oct 15:22 hello.c drwxr-xr-x 3 john staff 102 25 Oct 15:22 hello.dSYM macbook:test john$ ggdb hello GNU gdb (GDB) 7.5 Copyright (C) 2012 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-darwin12.2.0". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... BFD: /Users/john/test/hello: unknown load command 0x2a BFD: /Users/john/test/hello: unknown load command 0x28 BFD: /Users/john/test/hello: unknown load command 0x2b BFD: /Users/john/test/hello: unknown load command 0x2a BFD: /Users/john/test/hello: unknown load command 0x28 BFD: /Users/john/test/hello: unknown load command 0x2b Reading symbols from /Users/john/test/hello...Reading symbols from /Users/john/test/hello.dSYM/Contents/Resources/DWARF/hello...done. done. (gdb) l 1 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int main(void) 5 { 6 printf("Hello, World!\n"); 7 exit(EXIT_SUCCESS); 8 } (gdb) b 6 Breakpoint 1 at 0x100000f62: file hello.c, line 6. (gdb) r Starting program: /Users/john/test/hello Unable to find Mach task port for process-id 77680: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) (gdb) quit }}} Any help would be greatly appreciated with the BFD error and guidance on how to solve the code signing issue. Regards John -- Ticket URL: <https://trac.macports.org/ticket/36727> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+---------------------- Reporter: jb_duffy@… | Owner: dweber@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+---------------------- Changes (by macsforever2000@…): * owner: macports-tickets@… => dweber@… * keywords: gdb BFD Mach task port => Comment: In the future, please Cc the port maintainer(s). -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:1> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+---------------------- Reporter: jb_duffy@… | Owner: dweber@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+---------------------- Comment (by maligree@…): Has anyone had any luck with this? I'm willing to dive into this one to get it work and come up with a clear answer, but I don't want to reinvent the wheel. -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:6> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+---------------------- Reporter: jb_duffy@… | Owner: dweber@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+---------------------- Comment (by jb_duffy@…): Replying to [comment:6 maligree@…]:
Has anyone had any luck with this? I'm willing to dive into this one to get it work and come up with a clear answer, but I don't want to reinvent the wheel.
I'm not aware of any luck with this. I would help but I don't have the technical skills. I'm very happy to help out testing etc. -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:7> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+---------------------- Reporter: jb_duffy@… | Owner: dweber@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+---------------------- Comment (by swinbank@…): http://sourceware.org/gdb/wiki/BuildingOnDarwin explains how to generate a certificate and sign the gdb executable, and, indeed, signing the gdb executable installed by Macports following those instructions solves the issue for me. I'm not sure how easy it would be to automate within the Macports infrastructure, though. -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:9> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+---------------------- Reporter: jb_duffy@… | Owner: dweber@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+---------------------- Comment (by dave@…): Interesting; codesigning doesn't solve the problem for me. My /usr/bin/gdb works, but my /opt/local/bin/ggdb doesn't. The only differences I can ''see'' are in the files' extended attributes: {{{ cube:/tmp/bld/modhist/debug dave% codesign --verify --verbose $(which gdb) $(which ggdb) /usr/bin/gdb: valid on disk /usr/bin/gdb: satisfies its Designated Requirement /opt/local/bin/ggdb: valid on disk /opt/local/bin/ggdb: satisfies its Designated Requirement cube:/tmp/bld/modhist/debug dave% ls -l@ $(which gdb) $(which ggdb) -rwxr-sr-x 1 root wheel 5206576 Jan 10 10:53 /opt/local/bin/ggdb -rwxr-xr-x@ 1 root wheel 11032 Nov 27 14:29 /usr/bin/gdb com.apple.cs.CodeDirectory 112 com.apple.cs.CodeRequirements 80 com.apple.cs.CodeSignature 1346 }}} However, I don't know how to produce those attributes on ggdb, nor do I know what the correct numbers would be. -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:10> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+---------------------- Reporter: jb_duffy@… | Owner: dweber@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+---------------------- Comment (by thomas.fanghaenel@…): Same issue here. I have code-signed the executable, but am still getting the "Unable to find Mach task port" error when I try to run the executable in gdb. {{{ bash-3.2$ ~/local/bin/gdb a.out GNU gdb (GDB) 7.5.50.20130115 Copyright (C) 2013 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.4.2". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /Users/xxx/tmp/a.out...Reading symbols from /Users/xxx/tmp/a.out.dSYM/Contents/Resources/DWARF/a.out...done. done. (gdb) break main Breakpoint 1 at 0x100000f0b: file foo.c, line 5. (gdb) run Starting program: /Users/xxx/tmp/a.out Unable to find Mach task port for process-id 70913: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) (gdb) }}} Here's the information that I get back from codesign on the executable: {{{ bash-3.2$ codesign -d -v ~/local/bin/gdb Executable=/Users/xxx/local/bin/gdb Identifier=org.gnu.gdb Format=Mach-O thin (x86_64) CodeDirectory v=20100 size=31400 flags=0x0(none) hashes=1565+2 location=embedded Signature size=1605 Signed Time=Jan 15, 2013 1:24:47 PM Info.plist entries=4 Sealed Resources=none Internal requirements count=1 size=88 }}} The only difference I can see between the default gdb executable and the one I built are, as Dave pointed out, the extra permissions. Any pointers anybody? -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:12> MacPorts <http://www.macports.org/> Ports system for Mac OS
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+---------------------- Reporter: jb_duffy@… | Owner: dweber@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+---------------------- Comment (by egall@…): If codesigning failed to work, did you try modifiying the launchd plist for taskgated as described in #39349 and `port notes gdb`? Also does this still happen with gdb 7.6? -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:16> MacPorts <http://www.macports.org/> Ports system for OS X
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+-------------------------------- Reporter: jb_duffy@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+-------------------------------- Changes (by mf2k@…): * owner: dweber@… => macports-tickets@… Comment: dweber has retired. See #43834. -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:18> MacPorts <http://www.macports.org/> Ports system for OS X
#36727: gdb 7.5 BFD unknown load command & Unable to find Mach task port -------------------------+------------------------------- Reporter: jb_duffy@… | Owner: stuartwesterman@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.1.2 Resolution: | Keywords: Port: gdb | -------------------------+------------------------------- Changes (by mf2k@…): * owner: macports-tickets@… => stuartwesterman@… -- Ticket URL: <https://trac.macports.org/ticket/36727#comment:19> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts