问题1:出现 Could not determine GDB version using command: gdb --version
reason:
There is no gdb installed on the mac or there is a problem with the gdb location configuration
Solution:
1 install gdb,
2 If you are sure that gdb has been installed, you need to configure the path of Debuger in Eclipse: right-click on the project - "Debug As-"Debug Configurations-" Find the current project in the C++ Application on the left - "right tab and select Debuger-" Modify the path of gdb and .gdbinit file path
问题2:出现 Could not determine GDB version using command: gdb --version
[plain] view plain copy
- 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))
reason:
gdb is not signed
Solution:
1 Refer to the specific steps: https://segmentfault.com/q/1010000004136334
2 If the system certificate creation fails, please refer to: http://blog.csdn.net/lllkey/article/details/79423596
问题3:出现 Could not determine GDB version using command: gdb --version
[plain] view plain copy
- 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中配置相应路径即可
[plain] view plain copy
- echo "set startup-with-shell off" >> ~/.gdbinit
重新开一个terminal 或者 在Eclipse下再debug即可
问题4:出现 Could not determine GDB version using command: gdb --version
[plain] view plain copy
- 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:
解压:
[plain] view plain copy
- tar -Jxvf /Users/lsq/Movies/thunder/gdb-8.0.1.tar.xz
编译安装:
[plain] view plain copy
- ./configure --prefix=/usr/local
- make
- make -C gdb install
签名gdb:
[plain] view plain copy
- codesign -fs gdb_codesign $(which gdb)
配置:
[plain] view plain copy
- echo "set startup-with-shell off" >> ~/.gdbinit
如果使用Eclipse调试:修改Debuger中gdb和.gdbinit的位置(参考问题1)