1. 程式人生 > >Mac配置Eclipse CDT的Debug出現的問題(轉)

Mac配置Eclipse CDT的Debug出現的問題(轉)

rda proc ase rap 問題 置配 創建文件 rtu gdb

問題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

  1. Error in final launch sequence
  2. Failed to execute MI command:
  3. -exec-run
  4. Error message from debugger back end:
  5. Unable to find Mach task port for process-id 99177: (os/kern) failure (0x5).
  6. (please check gdb is codesigned - see taskgated(8))
  7. Unable to find Mach task port for process-id 99177: (os/kern) failure (0x5).
  8. (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

  1. Error in final launch sequence
  2. Failed to execute MI command:
  3. -exec-run
  4. Error message from debugger back end:
  5. During startup program terminated with signal ?, Unknown signal.
  6. 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

  1. echo "set startup-with-shell off" >> ~/.gdbinit

重新開一個terminal 或者 在Eclipse下再debug即可

問題4:出現 Could not determine GDB version using command: gdb --version

[plain] view plain copy

  1. Error in final launch sequence
  2. Failed to execute MI command:
  3. -exec-run
  4. Error message from debugger back end:
  5. During startup program terminated with signal SIGTRAP, Trace/breakpoint trap.
  6. 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

  1. tar -Jxvf /Users/lsq/Movies/thunder/gdb-8.0.1.tar.xz

編譯安裝:

[plain] view plain copy

  1. ./configure --prefix=/usr/local
  2. make
  3. make -C gdb install

簽名gdb:

[plain] view plain copy

  1. codesign -fs gdb_codesign $(which gdb)

配置:

[plain] view plain copy

  1. echo "set startup-with-shell off" >> ~/.gdbinit

如果使用Eclipse調試:修改Debuger中gdb和.gdbinit的位置(參考問題1)

Mac配置Eclipse CDT的Debug出現的問題(轉)