Mac C ++ / Mars eclipse gdb调试挂起在启动测试96% [英] Mac C++/Mars eclipse gdb debug hangs at Launching Test 96%

查看:263
本文介绍了Mac C ++ / Mars eclipse gdb调试挂起在启动测试96%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Mac El Capitan(10.11.5)上的Eclipse Mars(4.5.2)中调试一个简单的c ++程序时,它挂起于启动测试(96%)。



我的gdb已经安装了自制软件。当我在终端中键入哪个gdb时,它表示/ usr / local / bin / gdb。



以下是问题和我的GDB设置的屏幕截图:



输入证书的名称。对于这个操作方法,我将其称为gdb-cert。设置完全如下所示的字段。





最长有效期为999天。我真的不想再处理这个了,所以我要把它弄出来。 / *附录:这意味着你必须在999天内再次执行,即2.7年。您可能希望将此页面加入书签。 * /





继续点击继续按钮,直到被要求获取位置。将其设置为系统。如果您无法将其保存到系统钥匙串,请将其保存到登录钥匙串。您可以稍后导出证书,然后将其导入系统钥匙串。我没有这样做,如果你有任何问题,请给予评论。





成功!





现在确保证书始终被信任。右键单击新证书,然后选择获取信息。在信任部分下,将代码签名设置为始终信任。






现在我们有一个证书,我们需要使用它来签署GDB。首先,我们将重新启动任务过程,以确保其获取新的证书。退出钥匙串访问(您必须退出钥匙串访问!)并返回到终端以获取这些最终命令。



查找任务进程。

  $ ps -e | grep taskgated 
56822 ?? 0:03.11 / usr / libexec / taskgated -s
60944 ttys002 0:00.00 grep --color = auto taskgated

上面输出的第一个数字是PID。使用它来杀死进程(它将立即重新启动)。

  $ sudo kill -9 56822 

现在你可以最终编码GDB。

 code>#如果通过MacPorts 
$ codesign -s gdb-cert $(哪个gdb-apple)
#如果通过Homebrew
$ codesign -s gdb-cert $(哪个gdb)
#对于OP
$ codesign -s gdb-cert /usr/local/Cellar/gdb/7.11/bin/gdb

现在你应该全部设置! OS X Keychain可能会在您第一次尝试调试程序时请求您的密码,但它应该可以工作!



/ *附录:为了让我能够完整的功能我不得不重新启动机器。 * /


When I try to debug a simple c++ program in Eclipse Mars (4.5.2) on Mac El Capitan (10.11.5), it hangs on "Launching Test (96%)".

I have gdb installed with homebrew. When I type "which gdb" in terminal it says, "/usr/local/bin/gdb".

Here are screenshots of the problem and of my GDB settings: http://imgur.com/a/JrMjN

This is the same problem as Mac C++/Mars eclipse gdb debug launching stuck at 96% but it was never solved there.

解决方案

You have to sign gdb to be trusted to control the execution of another process. This is part of the security structures that are present in ElCapitan (have been like this since Mavericks).

You can do this by following the instructions below (extract from the blog post http://ntraft.com/installing-gdb-on-os-x-mavericks/ which contains more information on the topic).


Certifying GDB

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. /* Addendum: this means that you will have to do this again in 999 days, i.e. 2.7 years. You might want to bookmark this page. */

Keep clicking the "Continue" button until you are asked for a location. Set it to "System". If you are unable to save it to the System keychain, then save it to the login keychain. You can later export the cert, and then import it into the System keychain. I didn't have to do this, so comment if you have any problem.

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 taskgated process 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 taskgated
56822 ??         0:03.11 /usr/libexec/taskgated -s
60944 ttys002    0:00.00 grep --color=auto taskgated

The first number in the above output is the PID. Use this to kill the process (it will immediately restart itself).

$ sudo kill -9 56822

Now you can finally code sign GDB.

# If installed through MacPorts
$ codesign -s gdb-cert $(which gdb-apple)
# If installed through Homebrew
$ codesign -s gdb-cert $(which gdb)
# For the settings posted by OP
$ codesign -s gdb-cert /usr/local/Cellar/gdb/7.11/bin/gdb

Now 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!

/* Addendum: for me to be able to have full functionality I had to reboot the machine. */

这篇关于Mac C ++ / Mars eclipse gdb调试挂起在启动测试96%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆