Chinaunix首页 | 论坛 | 博客
  • 博客访问: 92194
  • 博文数量: 121
  • 博客积分: 1422
  • 博客等级: 上尉
  • 技术积分: 1235
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-05 13:10
文章分类

全部博文(121)

文章存档

2012年(9)

2011年(2)

2010年(110)

分类:

2010-04-13 14:20:47

A few gdb useful commands

bt
  backtrace, shows the stack frames (subroutine calls) that lead to the position you are now in code.
bt full
  shows every frame with the values of the local variables, usually too much verbose, only do this if you want to send the output to another person to analyse.
up/down number
  e.g.: up 5: goes up 5 stack frames. By default, whenever you enter gdb, you will be placed in frame number 0. With the aid of the source code of the program you should be able to select the subroutine where you want to inspect the variables.
frame number
  goes straight to the selected frame.
info locals
  prints the value of all local variables belonging to the current frame.
p variable
  e.g.: p *cur_src. Prints the named variable. Usually C like syntax will be allowed here.
l
  prints 10 lines of source code around the current line. A separate editor for source browsing is usualy better, but this can be a quick way to see the code.
help/help command
  Do I need to explain that? :)
阅读(648) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~