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 可执行文 ...
随机推荐
- npm使用过程中的一些错误解决办法及npm常用命令
node,npm在前端开发流程中提供了非常完善的自动化工具链,但是同样由于其复杂性导致有很多奇奇怪怪的问题.本文将记录使用过程中出现的一些问题及其解决方法备案. 国内由于gfw问题,导致很多国外的网站 ...
- HDU 2686 (双线程) Matrix
这也是当初卡了很久的一道题 题意:从左上角的格子出发选一条路径到右上角然后再回到左上角,而且两条路径除了起点和终点不能有重合的点.问所经过的格子中的最大和是多少 状态设计:我们可以认为是从左上角出发了 ...
- JavaScript的一些常见误区
原文出处: 色拉油的博客 接触JavaScript两年多遇到过各种错误,其中有一些让人防不胜防,原来对JavaScript的误会如此之深,仅以此文总结一下常见的各种想当然的误区. String r ...
- Android Studio 学习 - HelloWorld
今天是学习Android Studio的第2天,加油! 1. 首先要记录下使用Android Studio的一个代码自动完成的功能.平常基本上用Delphi,乍一换工具,各种不习惯,或者说不熟悉.按照 ...
- 【解题报告】zju-1145 Dreisam Equations
原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=145 题目大意:在给定的等式右边数字之间加上加.减.乘运算符,使等式成 ...
- 剑指offer—第二章算法之二分查找(旋转数组的最小值)
旋转数组的最小数字 题目:把一个数组最开始的若干元素搬到数组的末尾,我们称之为数组的旋转.输入一个递增排序的数组的一个旋转,输出旋转数组的最小元素.例如:数组{3,4,5,1,2}为{1,2,3,4, ...
- [转]几个开源的.net界面控件
转自原文 几个不错的开源的.net界面控件,介绍几个自己觉得不错的几个开源的.net界面控件. DockPanel Suite:开发类似VS.net的界面,#Develop就是使用的这个控件. 网址: ...
- nslookup返回信息说明
先看一个示例: 如上图,我们把输出结果分成三部分,下面分别来描述: 第一部分: 这里是我们本机的DNS服务器信息. 客户机先到主DNS Server进行连接查询,结果发现异常,连接失败,于是出 ...
- ASCII和16进制
所谓的ASCII和16进制都只是概念上的东西,在计算机中通通是二进制 转换应该是输出的转换,同样是一个数,在计算机内存中表示是一样的,只是输出不一样ASCII是针对字符的编码,几乎是键盘上的字符的编码 ...
- FreeMarker笔记 前言&第1章 入门
简介 简介 FreeMarker是一款模板引擎:一种基于模板的.用来生成输出文本(任何来自于HTML格式的文本用来自动生成源代码)的通用工具.它是为Java程序员提供的一个开发包或者说是类库.它不是面 ...