还是比较厉害的,比较准。
编译的时候加入 -g -rdynamic 选项,之后就可以跑调试了:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
linux $ gcc -g -rdynamic -o error error.c linux $ gdb error GNU gdb 6.5 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) run Starting program: /home/linux/error Program received signal SIGSEGV, Segmentation fault. |
错误内容
行数 源码;
(gdb) kill
(gdb) q
linux $
valgrind –track-origins=yes –leak-check=full –show-reachable=yes
强银