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-index
directory- 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启动程序,开始调试的方 ...
随机推荐
- noi2015的回忆和教训
前几天偶然打开了bzoj的rank list,突然发现——我竟然掉出了第一版!!! 自从我5月还是6月刷进第一版之后,我曾经天真的以为大概半年之内我还能保留在第一版内吧. 结果仅仅短短的4个月,我就已 ...
- Python内置数据类型之List篇
List的定义: li = ["one" , "two" , "three" , "four"] List是一个有序的集 ...
- 【转】发布的QT程序无法显示图标和图片的问题
在windows下编译好的QT程序在其他没有安装QT的机器上会出现图标和图片无法正常显示的问题. 这时我们可以通过以下方式来解决: 在release文件夹里创建plugins文件夹,并将QT安装目录下 ...
- 【英语】Bingo口语笔记(22) - Talk系列
talk back 顶嘴 talk somebody in to something 劝某人做某事 tal somebody out of something 劝某人不做某事
- mysql初识之数据文件及其他文件
在mysql中数据文件存放于在my.cnf中datadir指定的路径,使用的表引擎不同产生的文件格式.表文件个数也会有所差异.mysql的表引擎有多种,表的扩展名也不一样,如innodb用“ .ibd ...
- js match regex
需要返回成数组元素的要放在括号里头 var arr = /input-([0-9]*)-([0-9]*)/.exec(id); var all = arr[0]; var row = arr[1]; ...
- 使用Nodejs+mongodb开发地图瓦片服务器
原先地图瓦片服务器采用的是arcgisserver发布的地图服务并进行切片,但ags发布的地图服务很占内存,发布太多的话服务器压力很大.再一个就是ags价太高了. 学习Nodejs之后,发现这是一个可 ...
- centos下安装python
下载网址:http://ftp.gnu.org/gnu/gdb/ 1.编译python必须安装开发工具 # yum groupinstall "Development tools" ...
- asp.net读取xml方法
这个适合刚学asp.net的同学,大神直接略过好了,asp.net经常会有很多用到XML的地方,比如全国省市的联动,以及一些菜单读取等等都有xml的影子,直接贴代码,以便我以后用到的时候忘了,注释我写 ...
- (转)Visual Studio原生开发的10个调试技巧(二)
我以前关于Visual Studio调试技巧的文章引起了大家很大的兴趣,以至于我决定分享更多调试的知识.以下的列表中你可以看到写原生开发的调试技巧(接着以前的文章来编号).这些技巧可以应用在VS200 ...