Tag Archives: (please check gdb is codesigned – see taskgated(8))

Please check GDB is coded – see taskgated (8)

Knowledge map advanced must read: read how large-scale map data efficient storage and retrieval>>>

Reprinted from Afan tree’s blog

link address of this article: please check GDB is coded – see taskgated (8))

It’s hard to install GDB with brew. It turns out that it still can’t be debugged and this error is reported>( Please check GDB is coded – see taskgated (8))
for security reasons, Darwin kernel does not allow GDB to debug any program without special authorization, because it can be debugged to control the process. However, if it is root user, there is no such problem, but who is willing to use root to debug the program<
solution:
a common solution is to grant GDB the right to sign code with full trust of the system to other processes

First, you need to create a system code signature trust certificate

Start the “Keychain access” application (/ applications/utilities/Keychain access. APP)
1. Open the menu: Keychain access – Certificate assistant – create Certificate…
2. Enter the name of the certificate, such as GDB cert
3. Select identity type to self signed root
4. Select certificate type to code signing
5. Check: let me override the default signatures
6. Continue all the way. When you choose the time, make it longer, up to 20 years, 7300。
7. Continue all the way until you select the address where the certificate is stored, and select: system
8. After the certificate is created, you need to set the certificate custom trust
9. Right click the GDB cert certificate you just created, and select get info
10. Click trust, The trust options that can be customized will be displayed
11. Select “code signing to always trust” for “code signing”
12 secondly, grant the certificate to GDB and execute the command

1

codesign -s gdb-cert `which gdb`

Well, the above gives GDB a code signature certificate trusted by the system, and GDB can be used normally
to make the newly added certificate effective, you need to restart the taskgated service or restart the system

1

sudo killall taskgated