I have MacOS Mojave 10.14.
GNU gdb (GDB) 8.2.1
I read many posts on this but I wondered if something is changed in 2019 since most articles are old.
From:
Eclipse GDB MacOSX Mavericks
I did:
Start Keychain Access application (/Applications/Utilities/Keychain Access.app)
Open menu /Keychain Access/Certificate Assistant/Create a Certificate (TOP MENU BAR)Choose a name (gdb-cert in the example) 3.1 Set "Identity Type" to "Self Signed Root" 3.2 Set "Certificate Type" to "Code Signing" 3.3 Check the flag "Let me override defaults" 3.4 Click several times on "Continue" until you get to the "Specify a Location For The Certificate screen" then set Keychain to "System" 3.6 Make sure you have the "gdb-cert" in your "System" (left top window)
Select "Get Info" by pressing twice on the fresh made certificate (gdb-cert),
Open the "Trust" item, and set "Code Signing to Always Trust" Close Keychain Access application
Restart "taskgated" application (kill -9) and finally
codesign -s gdb-cert /usr/local/bin/gdb
But I still get the error:
lee@l7:~/eclipse-workspace-cdt/my-proj/build$ ./my-proj
Hello world
(the exe works fine)
lee@l7:~/eclipse-workspace-cdt/my-proj/build$ gdb my-proj
GNU gdb (GDB) 8.2.1 Copyright (C) 2018 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-darwin18.2.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from my-proj...done.
(gdb) run
Starting program: /Users/lefla/eclipse-workspace-cdt/my-proj/build/my-proj Unable to find Mach task port for process-id 12808: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))
(gdb) run
Starting program: /Users/lefla/eclipse-workspace-cdt/my-proj/build/my-proj Unable to find Mach task port for process-id 12819: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))
If gdb is signed, it should be able to fork other processes. Is killing "taskgated" sufficient (some article mention restarting the machine) ? What is the problem ?
______ EDIT 1
following
https://sourceware.org/gdb/wiki/PermissionsDarwin
drove me further. Then I hit this problem:
gdb terminated with signal ?, unknown signal
so I created the .gdbinit, and now I get:
(gdb) run
Starting program: /Users/lefla/eclipse-workspace-cdt/my-proj/build/my-proj
[New Thread 0x1a03 of process 14140]
[New Thread 0x2603 of process 14140]
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
______ EDIT 2
when using gdb 8.0.1, I got:
my-proj": not in executable format: File format not recognized
seems related to:
https://sourceware.org/bugzilla/show_bug.cgi?id=23746
But gdb 8.3 is just released and it finally works with gdb 8.3
codesign
command when you signgdb
? – l'L'l