问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/33298929/how-to-get-gdb-to-work-using-macports-under-osx-10-11-el-capitan