gdb:“未加载符号表"; [英] gdb: "No symbol table is loaded"
本文介绍了gdb:“未加载符号表";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试在 gdb 中添加断点时,我不断收到此错误消息.
I keep getting this error mesage when trying to add a breakpoint in gdb.
我已经使用这些命令进行编译:
I've used these commands to compile:
gcc -g main.c utmpib2.c -o main.o
and:
cc -g main.c utmpib2.c -o main.o
and also:
g++ -g main.c utmpib2.c -o main.o
我也尝试了-ggdb"而不是-g",但我仍然收到该错误消息.
I also tried "-ggdb" instead of "-g" and I still get that error message.
然后我执行 gdb:
$gdb
在 gdb 中:
(gdb)exec-file main.o
(gdb)break 59
No symbol table is loaded. Use the "file" command.
推荐答案
首先,你拥有的是一个完全编译好的程序,而不是一个目标文件,所以去掉 .o
扩展名.现在,请注意错误消息的内容,它确切地告诉您如何解决您的问题:未加载符号表.使用文件"命令."
First of all, what you have is a fully compiled program, not an object file, so drop the .o
extension. Now, pay attention to what the error message says, it tells you exactly how to fix your problem: "No symbol table is loaded. Use the "file" command."
(gdb) exec-file test
(gdb) b 2
No symbol table is loaded. Use the "file" command.
(gdb) file test
Reading symbols from /home/user/test/test...done.
(gdb) b 2
Breakpoint 1 at 0x80483ea: file test.c, line 2.
(gdb)
或者只是在命令行上传递程序.
Or just pass the program on the command line.
$ gdb test
GNU gdb (GDB) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
[...]
Reading symbols from /home/user/test/test...done.
(gdb) b 2
Breakpoint 1 at 0x80483ea: file test.c, line 2.
(gdb)
这篇关于gdb:“未加载符号表";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文