我不确定为什么GDB
在设置断点后无法正常工作:
[jalal@mumble-36] (2)$ gdb --args ./server 200000 img
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
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 "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /afs/cs.wisc.edu/u/j/a/jalal/fall2013/p5-linux/server...(no debugging symbols found)...done.
(gdb) b server.c:256
No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (server.c:256) pending.
(gdb) c
The program is not being run.
以下是.gdbinit
set auto-load safe-path /
知道我在做什么或者我做错了什么?我以前做过同样的步骤!
答案 0 :(得分:5)
根据消息:
(no debugging symbols found)
No symbol table is loaded. Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n])
看起来好像你的二进制文件已经编译而没有调试符号,所以在server.c:256
处断开是行不通的(因为没有任何东西可以向gdb指示第256行的位置!)。使用-ggdb
重新编译,然后使用run
再次尝试。
答案 1 :(得分:0)
@duskwuuf回答是正确的,但这不是错误The program is not being run
的唯一原因。
我遇到了同样的问题,但由于gdb运行不好。
带有命令行参数的程序必须使用--args
选项运行,就像@Mona_Jalal一样:gdb --args ./server 200000 img