在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