随笔分类 - gdb
摘要:原文链接http://blog.163.com/lanka83/blog/static/32637615200801793020182/http://blog.csdn.net/taina2008/archive/2007/08/09/1733464.aspx1. 前言:有的程序可以通过编译, 但在运行时会出现Segment fault(段错误). 这通常都是指针错误引起的.但这不像编译错误一样会提示到文件->行, 而是没有任何信息, 使得我们的调试变得困难起来.2. gdb:有一种办法是, 我们用gdb的step, 一步一步寻找.这放在短小的代码中是可行的, 但要让你step一个上万行
阅读全文
摘要:原文链接cat get.hint get (); int set (int a); cat get.c#include <stdio.h> #include "get.h" static int x=0; int get () { printf ( "get x=%d\n ", x); return x; } int set (int a) { printf ( "set a=%d\n ", a); ...
阅读全文
摘要:原文链接GDB 常用命令参考手册GDB 命令行参数GDB 命令GDB 操作提示GDB 相关手册相关链接GDB 命令行参数启动 GDB:gdbexecutablegdb -eexecutable-ccore-filegdbexecutable-pidprocess-id(使用命令'ps -auxw'可以查看进程的 pid)选项含义--help-h列出命令行参数。--exec=file-efile指定可执行文件。--core=core-file-ccore-file指明 core 文件。--command=file-xfile从指定文件中读取 gdb 命令。--directory=
阅读全文
摘要:索引 已审核 gdb 设置source搜索目录 dir /path调用gdb编译需要在cc后面加 -g参数再加-o;[root@redhat home]#gdb 调试文件:启动gdb(gdb) l :(字母l)从第一行开始列出源码原文链接(gdb) break n :在第n行处设置断点(gdb) break func:在函数func()的入口处设置断点(gdb) info break: 查看断点信息(gdb) r:运行程序(gdb) n:单步执行(gdb) c:继续运行(gdb) p 变量 :打印变量的值(gdb) bt:查看函数堆栈(gdb) finish:退出函数(gdb) s...
阅读全文
摘要:原文链接也许有人不知道CDB是什么,CDB是windbg的小兄弟,基于command line,对于我这个比较喜欢用command line的人,CDB比windbg更容易上手。象GDB,CDB这些工具,命令都很多,但是我们只要熟记最常用的"三板斧"就可以工作了。1.启动1)直接调试:gdb program [core]cdb programorcdb -z DumpFile2)attach方式gdb attach pidcdb -pn ExeNameorcdb -p pid2.显示堆栈GDB: btCDB: k3. 设置断点GDB: b [file:]lineCDB: b
阅读全文
摘要:原文地址:http://dogking.chinaunix.com/space.php?uid=20196318&do=blog&id=88960ldd查看应用程序链接了哪些动态库。 ldd ./testnm列出目标文件中包含的符号信息。 nm -Du /lib/libgobject-2.0.so.0 | grep g_regex_unrefsize列出各个段的大小及总的大小。strings列出文件中的字符串。readelf读取elf文件的完整结构。objdump导出目标文件的相关信息(elf文件相关工具的源头)。gdb对文件的执行过程进行调试分析,设置断点(b)、单步执行(n
阅读全文
摘要:Here are a list of various useful commands that come in handyCommand / Option descriptionGDB CommandWinDbg Command / GUI operation descriptionsEnablingpost-mortem default debuggerNotapplicable on any Unix/Linux OSToregister as the default debugger type “windbg -I”and to use Dr.Watson use “drwtsn32 -
阅读全文
摘要:参考地址:http://linux.chinaunix.net/techdoc/develop/2008/05/21/1004796.shtml#gdbserver 192.168.1.169:2345 onvifserver192.168.1.169为宿主机IP,在目标系统的2345端口开启了一个调试进程,hello为要调试的程序。出现提示:Process /tmp/hello created: pid="80"Listening on port 2345(另一个终端下)#/usr/local/arm-2009q1/bin/arm-none-linux-gnueabi-g
阅读全文
摘要:原文地址:http://blog.csdn.net/xiedejun1984/article/details/5752945示例指令:print "%s",(*(eles._M_impl._M_start)@1).contentp *(eles._M_impl._M_start)@1$10 = {{ title = "【海波】US News 2011年最新美国大学综合排名独家解读_波涛兄弟_新浪博客", content = " 【评分体系变动】 这是US NEWS 改变评分体系后,第一次发布美国大学排名,主要变化如下 1. Peer Asses
阅读全文