便便代码人生

关注技术, 偶尔动动手

[原]Linux下的c/c++ GDB调试

Posted by bianbian on 2007-09-18 22:13

本文Tags: , , ,

还是比较厉害的,比较准。
编译的时候加入 -g -rdynamic 选项,之后就可以跑调试了:
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 $

标签: , , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

One Response to “[原]Linux下的c/c++ GDB调试”

  1. 同盟 Says:

    强银

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

(required)