Original form of question(not exactly a question per se): Unable to find Mach task port for process-id : (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))
I would love for someone to mention any information they have on gaining the ability to run gdb without sudo preferably, but just running would be fine.
I have followed the instructions at https://github.com/cs01/gdbgui/issues/55 and most every related stackoverflow and OSXdaily feed that I can find for about a week now. I know there is quite a lot of documentation about this error, but so far none have posted these outputs and are running Catalina. I'm running gdb 8.3 on Mac OSX Catalina 10.15.1, configured as "x86_64-apple-darwin19.0.0"
I have created certificates in System, and then in Login, with no change in outcome.
I have set startup-with-shell off both within gdb and within a .gdbinit file in my home directory.
I eventually been able to run gdb with sudo gdb ./a.out only to receive odd messages when I run the code with r inside of gdb:
(No debugging symbols found in ./a.out)
(gdb) r
Starting program: /Users/zanekarl/Documents/Work-Documents//Programming/-code-snippets/a.out
[New Thread 0xc03 of process 906]
[New Thread 0xf03 of process 906]
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.```
(No debugging symbols found in ./a.out)
(gdb) b main
Breakpoint 1 at 0x100000f64
(gdb) r
Starting program: /Users/zanekarl/Documents/Work-Documents//Programming/-code-snippets/a.out
[New Thread 0xd03 of process 768]
[New Thread 0x1003 of process 768]
During startup program terminated with signal ?, Unknown signal.```
Reading symbols from /Users/zanekarl/Documents/Work-Documents//Programming/-code-snippets/a.out.dSYM/Contents/Resources/DWARF/a.out...
(gdb) b main
Breakpoint 1 at 0x100001753: file SSSv1-1.c, line 99.
(gdb) r
Starting program: /Users/zanekarl/Documents/Work-Documents//Programming/-code-snippets/a.out
[New Thread 0xb03 of process 717]```
Reading symbols from /Users/zanekarl/Documents/Work-Documents//Programming/-code-snippets/a.out.dSYM/Contents/Resources/DWARF/a.out...
(gdb) b main
Breakpoint 1 at 0x100001753: file SSSv1-1.c, line 99.
(gdb) r
Starting program: /Users/zanekarl/Documents/Work-Documents//Programming/-code-snippets/a.out
Unable to find Mach task port for process-id 680: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))```
On my MacBook Pro (15-inch, 2016) running Catalina 10.15.2 (19C57), with sip enabled.
I installed gdb 8.3.1 by:
brew install gdb
Then on my home folder I created a gdb.xml file with the contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
I created the gdb-cert on the system keychain
To sign gdb, I enabled the root account, and being root, I used the command:
codesign --entitlements gdb.xml -fs gdb-cert /usr/local/Cellar/gdb/8.3.1/bin/gdb
Now I can use netbeans to debug my fortran codes.
The entitlement xml was the missing piece for me:
Name = gdb_codesign
Identity Type = Self Signed Root
Certificate Type = Code Signing
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.debugger</key>
<true/>
</dict>
</plist>
$ codesign --entitlements gdb-entitlement.xml -fs gdb_codesign $(which gdb)
$ sudo killall taskgated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With