您的位置:首页 > 编程语言 > Java开发

Mac配置Eclipse CDT的Debug出现的问题

2018-03-03 21:55 375 查看

问题1:出现 Could not determine GDB version using command: gdb --version

原因:mac上没有安装gdb或者gdb位置配置有问题
解决方法:1 安装gdb,
2 如果确定已经安装了gdb,需要配置Eclipse中Debuger的路径:项目右键-》Debug As-》Debug Configurations-》左侧C++ Application找到当前项目-》右侧标签页选择Debuger-》修改gdb的路径和.gdbinit文件路径



问题2:出现 Could not determine GDB version using command: gdb --version

Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Unable to find Mach task port for process-id 99177: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
Unable to find Mach task port for process-id 99177: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))

原因:gdb没有签名
解决方法:1 具体步骤参考:https://segmentfault.com/q/1010000004136334
2 如果出现系统证书创建失败的问题参照:http://blog.csdn.net/lllkey/article/details/79423596


问题3:出现 Could not determine GDB version using command: gdb --version

Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
During startup program terminated with signal ?, Unknown signal.
During startup program terminated with signal ?, Unknown signal.

原因:mac osx某个版本之后会出现的问题,修改.gdbinit文件的配置可以解决
解决方法:1 参考:https://stackoverflow.com/questions/40052171/gdb-terminated-with-signal-unknown-signal
在home目录或者gdb的目录下创建文件:.gdbinit (我的gdb的路径为:/usr/local/Cellar/gdb/8.1/bin),只要之后再Eclipse中配置相应路径即可
echo "set startup-with-shell off" >> ~/.gdbinit
重新开一个terminal 或者 在Eclipse下再debug即可


问题4:出现 Could not determine GDB version using command: gdb --version

Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.

原因:gdb8.1版本的某些问题,需要降到某版本,我现在尝试gdb8.0.1是可以调试的
解决方法:1 参考:https://www.jianshu.com/p/b546a47b6b75 
从这个文章来看gdb8.1并不适配现在的os,所以需要回退到gdb8.0.1
使用brew更换版本失败,由于其中需要用到
brew versions gdb
但是返回:
Error: Unknown command: versions
2 8.0.1下载地址:https://ftp.gnu.org/gnu/gdb/gdb-8.0.1.tar.xz
开始编译安装gdb:
解压:
tar -Jxvf /Users/lsq/Movies/thunder/gdb-8.0.1.tar.xz
编译安装:
./configure --prefix=/usr/local
make
make -C gdb install
签名gdb:
codesign -fs gdb_codesign $(which gdb)
配置:
echo "set startup-with-shell off" >> ~/.gdbinit
如果使用Eclipse调试:修改Debuger中gdb和.gdbinit的位置(参考问题1)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: