invoking gdb
【invoking gdb】
The most usual way to start gdb is with one argument, specifying an executable program:
gdb program
You can also start with both an executable program and a core file specified:
gdb program core
You can, instead, specify a process ID as a second argument, if you want to debug a running process:
gdb program 1234
would attach gdb to process 1234 (unless you also have a file named 1234; gdb does check for a core file first).
You can optionally have gdb pass any arguments after the executable file to the inferior using --args. This option stops option processing.
gdb --args gcc -O2 -c foo.c
This will cause gdb to debug gcc, and to set gcc's command-line arguments (see Arguments) to ‘-O2 -c foo.c’.
【Index Files Speed Up gdb】
When gdb finds a symbol file, it scans the symbols in the file in order to construct an internal symbol table. This lets most gdb operations work quickly—at the cost of a delay early on. For large programs, this delay can be quite lengthy, so gdb provides a way to build an index, which speeds up startup.
The index is stored as a section in the symbol file. gdb can write the index to a file, then you can put it into the symbol file using objcopy.
To create an index file, use the save gdb-index command:
save gdb-indexdirectory- Create an index file for each symbol file currently known by gdb. Each file is named after its corresponding symbol file, with ‘.gdb-index’ appended, and is written into the given directory.
Once you have created an index file you can merge it into your symbol file, here named symfile, using objcopy:
$ objcopy --add-section .gdb_index=symfile.gdb-index \
--set-section-flags .gdb_index=readonly symfile symfile
参考:
1、https://sourceware.org/gdb/download/onlinedocs/gdb/Invoking-GDB.html#Invoking-GDB
2、https://sourceware.org/gdb/download/onlinedocs/gdb/Index-Files.html#Index-Files
invoking gdb的更多相关文章
- gdb调试libtool封装的可执行文件
http://www.gnu.org/software/libtool/manual/html_node/Debugging-executables.html 3.4 Debugging execut ...
- linux内核调试指南
linux内核调试指南 一些前言 作者前言 知识从哪里来 为什么撰写本文档 为什么需要汇编级调试 ***第一部分:基础知识*** 总纲:内核世界的陷阱 源码阅读的陷阱 代码调试的陷阱 原理理解的陷阱 ...
- Linux Kernel - Debug Guide (Linux内核调试指南 )
http://blog.csdn.net/blizmax6/article/details/6747601 linux内核调试指南 一些前言 作者前言 知识从哪里来 为什么撰写本文档 为什么需要汇编级 ...
- linux应用调试技术之GDB和GDBServer
1.调试原理 GDB调试是应用程序在开发板上运行,然后在PC机上对开发板上得应用程序进行调试,PC机运行GDB,开发板上运行GDBServer.在应用程序调试的时候,pc机上的gdb向开发板上的GDB ...
- 新手如何在gdb中存活
网络上已经有很多gdb调试的文章了,为什么我还要写这篇文章呢,因为本文是写给gdb新手的,目的就是通过一个简单的例子来让新手很快上手.一旦上手入门了,其他的问题就可以自己去搜索搞定了.右边是gdb的L ...
- GDB 多线程调试:只停止断点的线程,其他线程任然执行; 或只运行某些线程 其他线程中断
多线程调试之痛 调试器(如VS2008和老版GDB)往往只支持all-stop模式,调试多线程程序时,如果某个线程断在一个断点上,你的调试器会让整个程序freeze,直到你continue这个线程,程 ...
- GDB调试命令
1.查看源码: list [函数名][行数] 2.暂停程序 (1)设置断点: a.break + [源代码行号][源代码函数名][内存地址] b.break ... if condition .. ...
- 关于gdb和shp的FID问题
gdb的FID从1开始,并且FID唯一,从数字化时开始,每个图形对应唯一的FID,删除图形亦删除对应的FID.FID可能出现中断的情况. shp的FID从0开始,并且永远连续.删除图形,则编号在其下面 ...
- GDB调试命令小结
1.启动调试 前置条件:编译生成执行码时带上 -g,如果使用Makefile,通过给CFLAGS指定-g选项,否则调试时没有符号信息.gdb program //最常用的用gdb启动程序,开始调试的方 ...
随机推荐
- 51nod1434 区间LCM
将n!标准分解.m!/n!必定需要包含n!的分解式.对于每个质数枚举最小的答案,然后总的取最大. #include<cstdio> #include<cstring> #inc ...
- Http Response Code
HTTP协议状态码表示的意思主要分为五类 ,大体是 : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1×× 保留 2×× 表示请求成功地接收 3×× 为完成请求客户需 ...
- HDU 5340 Three Palindromes (Manacher)
题意: 判断是否能将字符串S分成三段非空回文串. 思路: 先预处理出前缀回文串和后缀回文串的位置,将位置分别装入两个集合中,O(n). 针对每个前缀回文串的终点位置,挑出不相交的后缀回文串,对中间那段 ...
- HDU 5317 RGCDQ (质数筛法,序列)
题意:从1~1000,000的每个自然数质因子分解,不同因子的个数作为其f 值,比如12=2*2*3,则f(12)=2.将100万个数转成他们的f值后变成新的序列seq.接下来T个例子,每个例子一个询 ...
- Linux管道的实现机制
7.1.1 Linux管道的实现机制 在Linux中,管道是一种使用非常频繁的通信机制.从本质上说,管道也是一种文件,但它又和一般的文件有所不同,管道可以克服使用文件进行通信的两个问题,具体表现为: ...
- Python [Leetcode 342]Power of Four
题目描述: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Examp ...
- scala学习笔记(4):占位符
scala 中占位符的用法 1.作为“通配符”,类似Java中的*.如import scala.math._ 2.:_*作为一个整体,告诉编译器你希望将某个参数当作参数序列处理!例如val s = s ...
- zoj 2105 Lifting the Stone
题意 裸的计算几何 求多边形重心: #include<iostream> #include<stdio.h> #include<cstring> #inclu ...
- [搜片神器]之DHT网络爬虫的C++程序初步开源
回应大家的要求,特地整理了一开始自己整合的代码,这样最简单,最直接的可以分析流程,至于文章里面提供的程序界面更多,需要大家自己开发. 谢谢园子朋友的支持,已经找到个VPS进行测试,国外的服务器: ht ...
- Ubuntu 升级到13.10之后出现Apache2启动失败的问题
昨天看到Ubuntu 13.04提示有新的发行版Ubuntu 13.10了,手痒了一下,没有忍住就升级了. 结果升级完毕之后发现Apache2服务启动失败了,失败信息是: Invalid comman ...