我在小牛队上安装了一个brew版本的gdb。它是经过编码的,我可以在本地连接时无问题地进行调试:
$ gdb myprog
GNU gdb (GDB) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin13.3.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from myprog...done.
(gdb) b main
Breakpoint 1 at 0x1000028e6: file main.c, line 38.
(gdb) r
Starting program: myprog
Breakpoint 1, main (argc=1, argv=0x7fff5fbffae8) at main.c:38
38 float pi=4.*(float)atan((double)1.);
但是,如果我首先使用ssh连接到主机,gdb现在不再有效:
$ ssh localhost
Last login: Tue Jul 15 11:57:44 2014 from localhost
$ gdb myprog
GNU gdb (GDB) 7.7.1
blah blah...
Reading symbols from myprog...done.
(gdb) b main
Breakpoint 1 at 0x1000028e6: file main.c, line 38.
(gdb) r
Starting program: myprog
Unable to find Mach task port for process-id 826: (os/kern) failure (0x5).
(please check gdb is codesigned - see taskgated(8))
(gdb)
有谁知道为什么会发生这种情况以及如何解决这个问题?