当前位置: 技术问答>linux和unix
求助:gdb调试问题
来源: 互联网 发布时间:2015-06-15
本文导语: 求助:gdb调试问题 源代码中有一源文件为:program.c makefile文件中,有一编译项为:gcc -g -o program program.c 然后,用gdb调试: [root@linux program]# gdb program GNU gdb Red Hat Linux (5.2.1-4)...... (gdb) b main Break point 1 at O...
求助:gdb调试问题
源代码中有一源文件为:program.c
makefile文件中,有一编译项为:gcc -g -o program program.c
然后,用gdb调试:
[root@linux program]# gdb program
GNU gdb Red Hat Linux (5.2.1-4)......
(gdb) b main
Break point 1 at Ox80489d2
(gdb) r
Start program:/usr/program
Break point 1 at Ox080489d2 in main()
(gdb) n
Single stepping until exit from function main,
which has no line number information.....
.....
(gdb) n
Single stepping until exit from _libc_start _main,
whicl has no line number information...
Program exited normally
为什么会这样呢?编译时有 “-g”选项啊,为什么gdb调试没有信息呢?
求助,谢谢!
源代码中有一源文件为:program.c
makefile文件中,有一编译项为:gcc -g -o program program.c
然后,用gdb调试:
[root@linux program]# gdb program
GNU gdb Red Hat Linux (5.2.1-4)......
(gdb) b main
Break point 1 at Ox80489d2
(gdb) r
Start program:/usr/program
Break point 1 at Ox080489d2 in main()
(gdb) n
Single stepping until exit from function main,
which has no line number information.....
.....
(gdb) n
Single stepping until exit from _libc_start _main,
whicl has no line number information...
Program exited normally
为什么会这样呢?编译时有 “-g”选项啊,为什么gdb调试没有信息呢?
求助,谢谢!
|
建议你用insight调试,图像画界面,很友好~~ddd也不错!可以把你的数据结构以图形化方式显示出来,很形象!
|
你试试 ddd 图形调试工具
|
用Magic C++,试试它的自动生成Makefile功能。
http://bbs.chinaunix.net/forum/23/20040306/275020.html
http://bbs.chinaunix.net/forum/23/20040306/275020.html
|
gdb的版本过低也会有问题,我上次就不能用,后来装了一个最新版的gdb就好了,建议你试试最新版