Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get gdb to work using macports under OSX 10.11 El Capitan?

This arose from How to install gdb (debugger) in Mac OSX El Capitan?.

I have macports working under el capitan no problem and have installed the gdb port but I can't get the codesigning to work. It all seems to have worked. The certificate is there and "Always Trust" is set. The binary shows:

$ codesign -d -v -v /opt/local/bin/ggdb 
Executable=/opt/local/bin/ggdb
Identifier=org.gnu.gdb
Format=Mach-O thin (x86_64)
CodeDirectory v=20100 size=25320 flags=0x0(none) hashes=1261+2 location=embedded
Signature size=1392
Authority=gdb-cert
Signed Time=23 Oct 2015, 07:56:53
Info.plist entries=4
TeamIdentifier=not set
Sealed Resources=none
Internal requirements count=1 size=88

but I get

(gdb) r
Starting program: /Users/sal/Katiss/ecodriving 
Unable to find Mach task port for process-id 39278: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))

when I try to start debugging something.

Any ideas?

like image 225
Steve Linton Avatar asked Feb 08 '23 17:02

Steve Linton


1 Answers

I just settled this problem by using the following command.

sudo dseditgroup -o edit -a yourusername -t user procmod

Which adds you to group procmod.

It's just because only users in procmod can use function task_for_pid, and you can find that the own group of /opt/local/bin/ggdb is procmod.

like image 124
Yang Jiaqi Avatar answered Feb 15 '23 10:02

Yang Jiaqi