发布网友 发布时间:2022-04-22 23:54
共2个回答
懂视网 时间:2022-04-30 00:01
If that worked, then lucky you! Getting it compiled is where many people seem to have trouble. Now you just need to sign it to give it permission to control OS X processes.
Open up the Keychain Access application (/Applications/Utilities/Keychain Access.app). Navigate via the menu to Keychain Access > Certificate Assistant > Create Certificate...
Enter a name for the certificate. For this how-to, I‘ll call it "gdb-cert". Set the fields exactly as shown below.
The maximum validity period is 999 days. I don‘t really want to deal with this again, so I‘m going to max it out.
Keep clicking the "Continue" button until you are asked for a location. Set it to "System".3
Success!
Now make sure the cert is always trusted. Right-click the new certificate and select Get Info. Under the Trust section, set Code Signing to Always Trust.
Now that we have a certificate, we need to use it to sign GDB. First, we‘ll restart the taskgatedprocess to make sure it picks up the new certificate. Quit Keychain Access (you must quit Keychain Access!) and return to the Terminal for these final commands.
Find the taskgated process.
$ ps -e | grep taskgatedThe first number in the above output is the PID. Use this to kill the process (it will immediately restart itself).
$ sudo kill -9 56822Now you can finally code sign GDB.
# MacPorts versionNow you should be all set! The OS X Keychain may ask for your password the first time you attempt to debug a program, but it should work!
There‘s one more step for Eclipse users. You need to specify where Eclipse can find the new GDB. Specify the path to GDB in Preferences > C/C++ > Debug > GDB:
If you already have some debug configurations, you may need to edit them individually to point to the correct place (under Run > Debug Configurations...):
mac上eclipse用gdb调试(转)
标签:
热心网友 时间:2022-04-29 21:09
一、安装GDB1在进行gdb安装前应首先配置好homebrew安装管理工具,由于先前写过Homebrew的详细安装过程(可以参考本人先前经验)2安装好homebrew后,输入如下命令查看homebrew中是否有gdb安装包,可以看到现在的版本中并没有gdb安装包。3输入命令brew update来更新homebrew的软件库,更新完成后再次查询即可看到已经有gdb安装包喽。4输入命令brew install gdb 即可以进行gdb调试器的安装了,安装过程如下所求5安装完成后可以通过输入gdb测试gdb版本及是否正确安装。6此外,建议大家通过如上安装方式来安装CGDB或者DDD调试工具,它们也都是基于GDB的,但是它们有着便捷的界面调试优势。7可能会发现安装完成后还是不能利用GDB来进行代码调试,会出现如下错误:Unable to find Mach task port for process-id 6603: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))接下来。。。还需要对GDB进行证书签名方可正常使用。END二、给GDB创建证书1在mac中打开keychain access工具,并创建一个证书2证书的信息可能参考如下所示的图3此后一直点击继续按钮直到下图时,更改为相应设置为System,最终便生成了如下所示的证书。4按照下面步骤更改证书的权限为“Always trust"END三、对证书进行签名打开终端,输入如下命令codesign -s yc_GDB_cert /usr/local/bin/gdb打开任务管理器,在CPU选项卡中关闭进程taskgated接下来就可以通过GDB来进行代码调试了