Mac配置Eclipse CDT的Debug出現的問題(轉)
問題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
[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))
原因:
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
[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)
Mac配置Eclipse CDT的Debug出現的問題(轉)