Вопрос

I am not sure why GDB doesn't work as desired after setting a breakpoint:

[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.

Here's what in .gdbinit

set auto-load safe-path /

Any idea what I am not doing or what am I doing wrong? I used to do the same steps previously!

Это было полезно?

Решение

Based on the messages:

(no debugging symbols found)

No symbol table is loaded.  Use the "file" command.
Make breakpoint pending on future shared library load? (y or [n])

it looks as though your binary has been compiled without debugging symbols, so breaking at server.c:256 isn't going to work (since there's nothing to indicate to gdb where line 256 is!). Recompile with -ggdb and try again with run.

Другие советы

@duskwuuf answer is right, however it is not the only reason of the error The program is not being run. I had the same problem, but because of bad gdb running.

The program with commandline arguments must be run with --args option, like as @Mona_Jalal does: gdb --args ./server 200000 img

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top