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. 编译器错误消息: CS0016: 未能写入输出文件

    “/”应用程序中的服务器错误. 编译错误 说明: 在编译向该请求提供服务所需资源的过程中出现错误.请检查下列特定错误详细信息并适当地修改源代码. 编译器错误消息: CS0016: 未能写入输出文件“c ...

  2. 了解Objective-C中NSAutoreleasePool使用方法

    本文的目的是来了解Objective-C中NSAutoreleasePool使用方法,Objective-C的Foundation库实际上是种运行级对象系统,与一般的对象语言,例如C++,Java不一 ...

  3. Android custom View AirConditionerView hacking

    package com.example.arc.view; import android.content.Context; import android.graphics.Canvas; import ...

  4. NBUT 1121 Sakuya's Fly Knife 飞刀(暴力)

    题意:给出一个带有n*m个格子的矩阵,部分格子中有靶子target,现在要从一个没有靶子的格子中射出飞刀数把,飞刀是可穿透靶子的,同一直线上都可以一刀全射掉.现在问在哪个格子射出飞刀,可以在全部射中的 ...

  5. 【C#学习笔记】图片像素操作

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  6. 部署HBase远程访问的问题集合(Eclipse)

    实现远程访问HBase,可以通过Eclipse开发工具方便进行代码调试. 为了方便jar包各种版本的管理,才用maven进行代码构建 首先,下载并安装maven以及M2Eclipse插件 其次,配置m ...

  7. Github托管代码步骤

    总结一下Github上项目托管步骤: Step 1:注册Github帐号,并创建一个repository,假如仓库名为test: Step 2:安装本地Git: sudo apt-get instal ...

  8. Heritrix源码分析(二) 配置文件order.xml介绍(转)

    本博客属原创文章,欢迎转载!转载请务必注明出处:http://guoyunsky.iteye.com/blog/613412      本博客已迁移到本人独立博客: http://www.yun5u. ...

  9. git常用知识整理

    分布式和集中版本控制的区别 分布式版本控制系统与集中式版本控制系统有何不同呢?首先,分布式版本控制系统根本没有“中央服务器”,每个人的电脑上都是一个完整的版本库,这样,你工作的时候,就不需要联网了,因 ...

  10. Informatica9.6.1在Linux Red Hat 5.8上安装遇到的有关问题整理_1

    1.  产品安装过程中提示无法创建Domain([ICMD_10033] Command [defineDomain] failed with error [[INFASETUP_10002]) 1) ...