简体   繁体   中英

Eclipse CDT cannot debug using gdb on Mac

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 "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.

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM