Hint above GDB signature error.
Reason
Darwin Kernel For security reasons, GDB is not allowed to debug any program without special authorization because it can be debugged to control the process. However, if the root user does not have this problem, but who would like to use root to debug the program.
Solve
A common workaround is to give gdb the code signing right to fully trust the system to other processes.
First, you need to create a system code signing trust certificate:
- Launch the Keychain Access app (/applications/utilities/keychain Access.app)
- Open Menu: Keychain Access-"certificate Assistant-" Create Certificate ...
- Enter the name of the certificate, such as: Gdb-cert;
- Select identity type: Self-signed root certificate (identity type to signed root)
- Select certificate Type: Code signature (Certificate type to code Signing)
- TICK: Let me override these default signatures (select the Let me override defaults)
- Go all the way until you choose to store the certificate address, select: System
- The certificate is created, and the certificate custom Trust is set
- Right-click the Gdb-cert certificate you just created, select "Get info"
- Click Trust to display the trust options that can be customized
- "Code Signing" select "Always Trust" (Code Signing
Second, grant the certificate to GDB and execute the command
>codesign-s Gdb-cert/path to GdB
Note that you need to exit the Keychain Access app first, or restart the system
View/path to GDB, execute command
>which GDB
Well, the above gives GDB a code signing certificate that the system trusts, and GDB can be used normally.
Troubleshoot gdb prompt signature error on Mac