这是一篇backup的文章。起因是我的命令行下的gdb出现了:
XML/HTML代码
- Starting program: /usr/local/Cellar/php56/5.6.9/bin/php /server/yii hprose
- Unable to find Mach task port for process-id 30717: (os/kern) failure (0x5).
- (please check gdb is codesigned - see taskgated(8))
于是google了一下,发现也有人在问类似的问题:
XML/HTML代码
- Because I need a Python-enabled gdb, I installed another version via
- brew tap homebrew/dupes
- brew install gdb
- I want to use this gdb with Eclipse CDT, where I entered the path to the binary in the Debugging settings. However, launching a program for debugging fails with the following message:
- Error in final launch sequence
- Failed to execute MI command:
- -exec-run
- Error message from debugger back end:
- Unable to find Mach task port for process-id 39847: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
- Unable to find Mach task port for process-id 39847: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
- What does "codesigned" mean in this context? How can I get this gdbrunning?
有一个5个点赞的,我发现无效:
XML/HTML代码
- t would seem you need to sign the executable. See these links for more information. You should be able to get away with self signing if you don't plan on redistributing that version of gdb.
- https://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html
- https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/codesign.1.html
- Alternatively, you could disable code signing on your system, although this presents a security risk. To do so try running sudo spctl --master-disable in the Terminal.
24人点赞的看上去不错:
XML/HTML代码
- I.1 Codesigning the Debugger
- The Darwin Kernel requires the debugger to have special permissions before it is allowed to control other processes. These permissions are granted by codesigning the GDB executable. Without these permissions, the debugger will report error messages such as:
- Starting program: /x/y/foo
- Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5).
- (please check gdb is codesigned - see taskgated(8))
- Codesigning requires a certificate. The following procedure explains how to create one:
- Start the Keychain Access application (in /Applications/Utilities/Keychain Access.app)
- Select the Keychain Access -> Certificate Assistant -> Create a Certificate... menu
- Then:
- Choose a name for the new certificate (this procedure will use "gdb-cert" as an example)
- Set "Identity Type" to "Self Signed Root"
- Set "Certificate Type" to "Code Signing"
- Activate the "Let me override defaults" option
- Click several times on "Continue" until the "Specify a Location For The Certificate" screen appears, then set "Keychain" to "System"
- Click on "Continue" until the certificate is created
- Finally, in the view, double-click on the new certificate, and set "When using this certificate" to "Always Trust"
- Exit the Keychain Access application and restart the computer (this is unfortunately required)
- Once a certificate has been created, the debugger can be codesigned as follow. In a Terminal, run the following command...
- codesign -f -s "gdb-cert" <gnat_install_prefix>/bin/gdb
- ... where "gdb-cert" should be replaced by the actual certificate name chosen above, and should be replaced by the location where you installed GNAT.
- source: https://gcc.gnu.org/onlinedocs/gcc-4.8.1/gnat_ugn_unw/Codesigning-the-Debugger.html
这个4人点赞的简洁明了:
XML/HTML代码
- I made gdb work on OSX 10.9 without codesigning this way (described here):
- Install gdb with macports. (may be you can skip it)
- sudo nano /System/Library/LaunchDaemons/com.apple.taskgated.plist
- change option string from -s to -sp at line 22, col 27.
- reboot the computer.
- Use gdb
然而这都没有什么卵用,这时候一个2人点赞的说了一个重点:
XML/HTML代码
- It's a very old topic, but I am adding a response, because out of many available instructions, only one contained just the right steps to make a self-signed debugger work.
- You have to create a self-signed root certificate and then sign the gdb executable with it, but many people complained that it did not work for them. Neither did it for me until I stumbled upon this link.
- The key point missing in other manuals is that you have to restart your computer for the changes to take effect. Once I did that, everything worked as intended.
- I hope, this will help others.
是的,他在have to restart上加粗了!!!
最后一个回复表示使用了4人点赞的那个建议,并表示他就是这么完成的!原文来自:http://stackoverflow.com/questions/13913818/how-to-get-a-codesigned-gdb-on-osx