Mac配置Eclipse CDT的Debug出現的問題
阿新 • • 發佈:2018-12-30
問題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沒有簽名
解決方法:
問題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檔案的配置可以解決
解決方法:
在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是可以除錯的
解決方法:
從這個文章來看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)