在Eclipse裏調試c程序, 出現: "Error while launching command: gdb -version"。須要讓Eclipse知道Eclipse具體在什麼地方,配置方法是: "Debug configuration"-->"Debugger"-->"GDB debugger"裏的"gdb"改爲gdb的絕對路徑:"/usr/local/bin/gdb"shell
但配置以後仍然會有錯誤:ui
Unable to find Mach task port for process-id 83686: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) Unable to find Mach task port for process-id 83686: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))
緣由是在Mac系統(10.9)裏默認不容許GNU gdb訪問其餘進程,須要對gdb進行簽名:spa
➜ ~ which gdb /usr/local/bin/gdb --> ~ codesign -s gdb-cert /usr/local/bin/gdb
簽名的命令是`codesign`,gdb-cert是本身製做的證書,後面跟上被簽名的進程: `/usr/local/bin/gdb`debug
下面是簽名的方法,參考資料來自:<BuildingOnDarwin><Installing GDB on OS X Mavericks>調試
鑰匙串訪問-->證書助理-->建立證書,在「證書助理」建立名字爲gdb-cert的證書:code
一路`繼續`,中間有個選項要選擇:進程
最終生成:ip
生成以後,用`codesign`註冊,重啓taskgated進程便可get
➜ ~ ps -e | grep taskgated 69 ?? 2:06.20 /usr/libexec/taskgated -s 84711 ttys002 0:00.00 grep --color=auto taskgated --> ~ sudo kill -9 69