Symbol Table
【Symbol Table】
In order for GDB to be useful to us, it needs to be able to refer to variable and function names, not their addresses. Humans use names like main()
or i
. Computers use addresses like 0x804b64d
or 0xbffff784
. To that end, we can compile code with "debugging information" which tells GDB two things:
Because GCC and GDB run on so many different platforms, there are many different formats for debugging information:
- stabs: The format used by DBX on most BSD systems.
- coff: The format used by SDB on most System V systems before System V Release 4.
- xcoff: The format used by DBX on IBM RS/6000 systems.
- dwarf: The format used by SDB on most System V Release 4 systems.
- dwarf2: The format used by DBX on IRIX 6.
- vms: The format used by DEBUG on VMS systems.
If you plan on debugging an executable, a corefile resulting from an executable, or a running process, you mustcompile the executable with an enhanced symbol table. To generate an enhanced symbol table for an executable, we must compile it with gcc's -g
option:
As previously discussed, there are many different debugging formats. The actual meaning of -g
is to produce debugging information in the native format for your system.
As an alternative to -g
, you can also use gcc's -ggdb
option:
You can also give a numerical argument to -g
, -ggdb
and all the other debugging format options, with 1 being the least amount of information and 3 being the most. Without a numerical argument, the debug level defaults to 2. By using -g3
you can even access preprocessor macros, which is really nice. I suggest you always use -ggdb3
to produce an enhanced symbol table.
Debugging information compiled into an executable will not be read into memory unless GDB loads the executable.(程序运行时不会加载符号表,只GDB在调试程序时,GDB会去使用符号表)This means that executables with debug information will not run any slower than executables without debug information (a common misconception). While it's true that debugging executables take up more disk space, the executable will not have a larger "memory footprint" unless it's from within GDB. Similarly, executable load time will be nearly the same, again, unless you run the debug executable from within GDB.
One last comment. It's certainly possible to perform compiler optimizations on an executable which has an augmented symbol table, in other words: gcc -g -O9 try1.c
. In fact, GDB is one of the few symbolic debuggers which will generally do quite well debugging optimized executables. However, you should generally turn off optimizations when debugging an executable because there are situations that will confuse GDB. Variables may get optimized out of existence, functions may get inlined, and more things may happen that may or may not confuse gdb. To be on the safe side, turn off optimization when you're debugging a program.
参考:http://rsquared.sdf.org/gdb/paefd.html
Symbol Table的更多相关文章
- symbol table meaning
SYMBOL TABLE: 00000000 l df *ABS* 00000000 m.c 00000000 l d .text 00000000 .text 00000000 l ...
- objdump的使用方法和 symbol table的每列的含义
一.objdump的用法 objdump命令的man手册 objdump [-a] [-b bfname| --target=bfdname] [-C] [--debugging] ...
- 算法学习笔记之——priority queue、heapsort、symbol table、binary search trees
Priority Queue 类似一个Queue,但是按照priority的大小顺序来出队 一般存在两种方式来实施 排序法(ordered),在元素入队时即进行排序,这样插入操作为O(N),但出队为O ...
- eclipse+minGW 调试ffmpeg错误:No symbol table is loaded. Use the "file" command.
转载地址:http://www.blogjava.net/fancydeepin/archive/2012/11/19/391520.html 数据结构第二篇: eclipse SDK 安装和配置 ...
- Symbol Table(符号表)
一.定义 符号表是一种存储键值对的数据结构并且支持两种操作:将新的键值对插入符号表中(insert):根据给定的键值查找对应的值(search). 二.API 1.无序符号表 几个设计决策: A.泛型 ...
- A C compiler that parses this code will contain at least the following symbol table entries
A C compiler that parses this code will contain at least the following symbol table entries Consider ...
- IDEA的SonarLint插件报错Unable to create symbol table for
执行sonarLint 报错: Unable to create symbol table for ***File won't be refreshed because there were erro ...
- SonarQube执行代码分析时,报错ERROR: Unable to create symbol table for : /**/*.java java.lang.IllegalArgumentException: Unsupported class file major version 55
若要转载本文,请务必声明出处:https://www.cnblogs.com/zhongyuanzhao000/p/11686633.html 起因: 最近正在尝试SonarQube的简单使用,但是当 ...
- No symbol table is loaded. Use the "file" command.
No symbol table is loaded. Use the "file" command. gdb 1. 首先使用gcc -g .c文件 -o 可执行文 ...
随机推荐
- Qt之国际化(系统文本-QMessageBox按钮、QLineEdit右键菜单等)
简介 使用Qt的时候,经常会遇到英文问题,例如:QMessageBox中的按钮.QLineEdit.QSpinBox.QScrollBar中的右键菜单等.通常情况下,我们软件都不会是纯英文的,那么如何 ...
- BZOJ 4004 装备购买
md有毒卡什么精度!!!! 最大线性无关组(线性基)可作为模板. #include<iostream> #include<cstdio> #include<cstring ...
- 快速查询Python脚本语法
/********************************************************************* * 快速查询Python脚本语法 * 说明: * Char ...
- NTP时间服务器配置与解析
NTP时间服务器配置与解析 Edit By ZhenXing_Yu 目 录 编译安装ntp server 2 修改ntp.conf配置文件 2 配置时间同步客户机 2 在服务端验证: 3 在客户端进行 ...
- K2 K2Blackpearl安装步骤详解(服务端)
转:http://www.cnblogs.com/dannyli/archive/2011/11/30/2269485.html 以下是K2 Blackpearl的安装步骤,本人亲测可用哦. 1.安装 ...
- linux下mysql操作的命令
最近在学习mysql,还是只菜鸟,找到下面篇文章对初学者挺有用的,所以共享下 1.linux下启动mysql的命令: mysqladmin start /ect/init.d/mysql star ...
- 嵌入式 linux下利用backtrace追踪函数调用堆栈以及定位段错误
嵌入式 linux下利用backtrace追踪函数调用堆栈以及定位段错误 2015-05-27 14:19 184人阅读 评论(0) 收藏 举报 分类: 嵌入式(928) 一般察看函数运行时堆栈的 ...
- ORACLE常用脚本示例
create table DBO.INDEX_POLICY_TBL( ID NUMBER(10) NOT NULL PRIMARY KEY, POLICY_ID NUMBER(10,0) defaul ...
- [Everyday Mathematics]20150227
(Marden's Theorem) 设 $p(z)$ 是三次复系数多项式, 其三个根 $z_1,z_2,z_3$ 不共线; 再设 $T$ 是以 $z_1,z_2,z_3$ 为顶点的三角形. 则存在唯 ...
- Microsoft Office 2010 requires 的 MSXML 版本 6.10.1129.0 be 已安装在您计算机的安装"的基于 Windows 7 的计算机上安装 Office 2010 时出现错误消息
https://support.microsoft.com/zh-cn/kb/2290714