GDB:[否符号表被载入" [英] gdb: "No symbol table is loaded"

查看:291
本文介绍了GDB:[否符号表被载入"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不断收到试图在GDB添加一个断点,当这个错误信息。

我使用这些命令来编译:

 的gcc -g main.c中utmpib2.c -o main.o中
和:
CC -g main.c中utmpib2.c -o main.o中
并且:
g ++的-g main.c中utmpib2.c -o main.o中

我也试过,而不是-g-ggdb我仍然得到错误信息。

我然后执行GDB:

  $ GDB

在gdb的:

 (GDB)EXEC文件main.o中
(GDB)破59
没有符号表被加载。使用文件命令。


解决方案

首先,你所拥有的是一个完全编译的程序,不是一个对象文件,所以删除的.o 扩展。现在,要注意错误消息说的话,它会告诉你的究竟的如何解决你的问题:无符号正装表的使用文件命令

 (GDB)EXEC文件测试
(GDB)B 2
没有符号表被加载。使用文件命令。
(GDB)文件测试
阅读从/home/user/test/test...done符号。
(GDB)B 2
在0x80483ea断点1:文件test.c的,2号线。
(GDB)

或者只是通过命令行程序。

  $ GDB测试
GNU GDB(GDB)7.4
版权所有(C)2012自由软件基金会
许可GPLv3的+:GNU GPL第3版或更高版本< HTTP://gnu.org/licenses/gpl.html>
[...]
阅读从/home/user/test/test...done符号。
(GDB)B 2
在0x80483ea断点1:文件test.c的,2号线。
(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

I also tried "-ggdb" instead of "-g" and I still get that error message.

I then execute gdb:

$gdb

In gdb:

(gdb)exec-file main.o
(gdb)break 59
No symbol table is loaded. Use the "file" command.

解决方案

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:[否符号表被载入&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆