linux-c/c++调试利器gdbddd小试
Posted qingchen1984
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux-c/c++调试利器gdbddd小试相关的知识,希望对你有一定的参考价值。
linux-c/c++调试利器gdb、ddd小试
原文链接: http://deepfuture.iteye.com/blog/749148
博客分类:一、gdb,在shell窗口调试
main.c内容:
main.c
#include <stdio.h>
int main()
{
int y=0;
for (int i=0;i<10;i++){
y+=i;
}
return 0;
}
深未来技术原创文章,如转载,请注明来源http://deepfuture.iteye.com/
编译:
[email protected]:~/test$ gcc -ggdb -std=c99 -o main main.c
启动gdb
1、gdb 执行文件名
[email protected]:~/test$ gdb main
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 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 "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/deepfuture/test/main...done.
2、list为列出源代码
(gdb) list
1
2 #include <stdio.h>
3 int main()
4 {
5 int y=0;
6 for (int i=0;i<10;i++){
7 y+=i;
8 }
9 return 0;
10 }
以上是关于linux-c/c++调试利器gdbddd小试的主要内容,如果未能解决你的问题,请参考以下文章