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. jQuery 清除div内容

    $.ajax({            url: "SearchSN.aspx",            data: "SN=" + $("#txtS ...

  2. [CTO]创业团队CTO应具备的素质

    原文地址:http://www.cyzone.cn/a/20131001/245862_2.html [导读]CTO要让技术团队明白,公司不是请你来搞纯技术研发的,个别人可以纯技术导向,但整个团队的目 ...

  3. css3用AnimationEnd判断动画是否完成, css3在动画完成后执行事件

    用css3的animation完成一个动画,当只有这个动画完成时才执行令一个事件,比如让动画保持在终止的状态或其他一些事件.我们该怎么办呢. 第一种方法: 用计时器,设定一个和动画时长一样的time, ...

  4. Mysql避免全表扫描sql查询优化 .

    对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引: .尝试下面的技巧以避免优化器错选了表扫描: ·   使用ANALYZE TABLE tbl_n ...

  5. 使用模板时 error LNK2019: 无法解析的外部符号

    类模板是c++编译器指令 说明了如何生成类和成员函数 除非编译器实现了新的关键字export关键字 否则将模板成员函数放置在一个独立的实现文件中 将无法运行 因为模板不是函数 他们不能单独编译 模板必 ...

  6. jsonp实现跨域访问

    要实现JSONP跨域访问,首先就要了解什么是跨域?然后JSONP与JSON的关系? 1.什么是跨域? 跨域简单的说就是一个域名下的程序和另一个域名下的程序做数据交互.比如说:现有一个http://ww ...

  7. Android服务之Service

    android中服务是运行在后台的东西,级别与activity差不多.既然说service是运行在后台的服务,那么它就是不可见的,没有界面的东西.你可以启动一个服务Service来播放音乐,或者记录你 ...

  8. api-ms-win-crt-runtime-l1-1-0.dll丢失问题

    笔者是在安装python 3.5 后,启动时提示该文件丢失的问题的,如下所示.

  9. 8、NFC技术:让Android自动打开网页

    创建封装Uri的NdefRecord  public  NdefRecord  createUri(String  uriString);  public  NdefRecord  cre ...

  10. LoadRunner--内存指标介绍

    Threads——线程数当前全部线程数============================================ Available MBytes——物理内存的可用数指计算机上可用于运行 ...