Eclipse CDT cannot debug using gdb on Mac

我是研究僧i 提交于 2019-12-18 14:48:30

问题


I have a C++ project imported to Eclipse CDT. I can build and run the project using Makefile and argument settings. However, when I tried to add a debug point and run "debug as local c/c++ application", it throws me an error of "Launching projectName" has encountered a problem. Error with command gdb --version By expanding the Details, it gives: Error with command: gdb --version Cannot run program "gdb": Unknown reason

I installed the gdb by Macports before. If I enter command ggdb it returns the version info. If I type which ggdb, it gives /opt/local/bin/ggdb. I tried to add "PATH" to debug configuration -> environment variables and give the path value to it, but it did not work. How should I set the path and link the path please? And what should the variable name be.

The gdb version on my machine is GNU gdb (GDB) 7.7.1

Added: I looked up which ggdb and used the link James provided to change gdb debugger to browse to that path. But it did not work still.

Thanks.

回答1:


It looks like Eclipse is using the default gdb that was on the system before you installed ggdb from macports. This link shows how to change the debugger settings, change it to ggdb which is the name Macport uses.

After installing ggdb from Macports you will have to sign it with a certificate so it will be allowed to control other processes, take a look at "Certifying GDB" here. After creating the certificate, make sure you select the correct name when signing:

$ codesign -s gdb-cert $(which ggdb) /// 'ggdb'


来源:https://stackoverflow.com/questions/28357136/eclipse-cdt-cannot-debug-using-gdb-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!