我已经通过Homebrew在我的Mac上(运行Mac OS 10.9/Mavericks)安装了gdb,并且成功地对其进行了代码签名。
在使用gdb开始调试会话之前,我像这个例子中一样编译了我的C文件:
gcc -g test.c -o test
之后我调用了gdb:
Users-MacBook-Pro:Test User$ gdb ./test
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 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.4.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 ./test...Reading symbols from /Users/User/Test/test.dSYM/Contents/Resources/DWARF/test...done.
done.
调用gdb命令如r或sta总是导致以下错误:(gdb) r
Abort trap: 6
有什么问题?有什么想法可以解决吗?
SIGABRT
,通常只有在调用abort()
时才会被调用。 - cdarkegdb
时遇到了一个不同的问题,但可能与此相关:https://dev59.com/dmgu5IYBdhLWcg3wMkUm - cdarkeg++-7 (Homebrew GCC 7.3.0) 7.3.0
,调试工具是GNU gdb (GDB) 8.1
。 - Hakan Babaprintf("Hello\n");
或printf("%d\n",a + b);
? - Scorta