当前位置: 技术问答>linux和unix
一个关于gdb的小问题
来源: 互联网 发布时间:2016-06-06
本文导语: 我用gdb的时候,用gcc用-g生成了调试信息还是没法用gdb调试,如下: root@m:~/Documents/test# gdb main GNU gdb 6.8-debian Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you...
我用gdb的时候,用gcc用-g生成了调试信息还是没法用gdb调试,如下:
root@m:~/Documents/test# gdb main
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
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"...
(gdb) c
The program is not being run.
(gdb)
There is NO WARRANTY是什么问题。。我用apt-get install gdb重新下gdb也是这个问题,但是用gdb的前端insight调试却可以,这是怎么回事?
root@m:~/Documents/test# gdb main
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
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"...
(gdb) c
The program is not being run.
(gdb)
There is NO WARRANTY是什么问题。。我用apt-get install gdb重新下gdb也是这个问题,但是用gdb的前端insight调试却可以,这是怎么回事?
|
The program is not being run.
Type r to run it.
(gdb) r
Type r to run it.
(gdb) r
|
它不是已经提示你程序还没有运行么,需要运行后才能运用 c 命令嘛
你可以先 br main,然后 r,接着 list 貌似就能看到调试的源码信息了吧...
|
gcc -g -o
gdb
gdb
|
gcc -g -o test test.c
gdb -q ./test
(gdb) l
然后打上断点,然后
(gdb) r
gdb -q ./test
(gdb) l
然后打上断点,然后
(gdb) r