14
votes

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. enter image description here

enter image description here

enter image description here Thanks.

1
What version of gdb are you using?James Moore
@JamesMoore : GNU gdb (GDB) 7.7.1 Thank you.user2751691

1 Answers

3
votes

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'