簡體   English   中英

為什么GDB無法按需工作?

[英]Why GDB doesn't work as desired?

我不確定為什么設置斷點后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 /

知道我沒有在做什么或我在做什么錯嗎? 我以前曾經做過同樣的步驟!

根據消息:

(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再次嘗試。

@duskwuuf的回答是正確的,但這不是錯誤的唯一原因The program is not being run 我有同樣的問題,但是由於gdb運行不良。

帶有命令行參數的程序必須使用--args選項運行,就像@Mona_Jalal一樣: gdb --args ./server 200000 img

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM