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的更多相关文章

  1. symbol table meaning

    SYMBOL TABLE: 00000000 l    df *ABS*  00000000 m.c 00000000 l    d  .text  00000000 .text 00000000 l ...

  2. objdump的使用方法和 symbol table的每列的含义

    一.objdump的用法 objdump命令的man手册 objdump     [-a] [-b bfname|     --target=bfdname] [-C] [--debugging]   ...

  3. 算法学习笔记之——priority queue、heapsort、symbol table、binary search trees

    Priority Queue 类似一个Queue,但是按照priority的大小顺序来出队 一般存在两种方式来实施 排序法(ordered),在元素入队时即进行排序,这样插入操作为O(N),但出队为O ...

  4. 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 安装和配置 ...

  5. Symbol Table(符号表)

    一.定义 符号表是一种存储键值对的数据结构并且支持两种操作:将新的键值对插入符号表中(insert):根据给定的键值查找对应的值(search). 二.API 1.无序符号表 几个设计决策: A.泛型 ...

  6. 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 ...

  7. IDEA的SonarLint插件报错Unable to create symbol table for

    执行sonarLint 报错: Unable to create symbol table for ***File won't be refreshed because there were erro ...

  8. 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的简单使用,但是当 ...

  9. No symbol table is loaded. Use the "file" command.

    No symbol table is loaded.  Use the "file" command. gdb 1. 首先使用gcc   -g    .c文件   -o  可执行文 ...

随机推荐

  1. 今天maven install时碰到的两个问题(堆溢出和编译错误)

    问题1.maven install时出现,日志如下: 系统资源不足.有关详细信息,请参阅以下堆栈追踪. java.lang.OutOfMemoryError: Java heap space at c ...

  2. Spring+Hibernate配置多数据源

    配置说明 在实际应用中,经常会用到读写分离,这里就这种情况进行Spring+Hibernate的多数据源配置.此处的配置只是让读的方法操作一个数据库,写的方法操作另外一个数据库. 注:我这里的配置JD ...

  3. CSS3之创建透明边框三角

    简述 在前面,我们分享过关于三角的实现方式,主要根据border属性来设置,下面我们来实现上.下.左.右各种不同颜色的三角. 简述 实现 效果 源码 实现 效果 源码 <!DOCTYPE htm ...

  4. Storm中tuple的可靠性

    一.简介 Storm 可以保证 spout 发出的每条消息都能被“完全处理” ,这也是直接区别于其他实时系统的地方,如 S4. 请注意,spout 发出的消息后续可能会触发产生成千上万条消息 ,可以形 ...

  5. HDU 5273 Dylans loves sequence (逆序对,暴力)

    题意: 给定一个序列,对于q个询问:(L,R)之间有几个逆序对?序列元素个数上限1000,q上限10万.仅1测试例子. 思路: [L,R]的逆序对数量可以这么算,假设L<=K<R,将区间拆 ...

  6. 一个基于PDO的数据库操作类(新) 一个PDO事务实例

    <?php /* * 作者:胡睿 * 日期:2011/03/19 * 电邮:hooray0905@foxmail.com * * 20110319 * 常用数据库操作,如:增删改查,获取单条记录 ...

  7. ecms_任意页面调用单独的栏目

    <a href="<?=$class_r[58]['classpath']?>"> <?=$class_r[58]['classname']?> ...

  8. (六) 6.3 Neurons Networks Gradient Checking

    BP算法很难调试,一般情况下会隐隐存在一些小问题,比如(off-by-one error),即只有部分层的权重得到训练,或者忘记计算bais unit,这虽然会得到一个正确的结果,但效果差于准确BP得 ...

  9. 【英语】Bingo口语笔记(47) - 关于马的表达

    beat a dead horse 浪费口舌

  10. http报头正文开头会有一个整数的问题

    HTTP/.0 200 OK (省略一些东西...) Content-type:text/html 正文内容 这是我用Arduino访问某个php得到的结果 如果我在php里头输出1000个字符或更少 ...