GDB用法


  gdb用法比较多,功能很强大,平时用到的命令大概二十条,因为一些原因,好久没用了,都生疏了。
昨天花了半天总结一下,详细信息还是在gdb中用help看。有点乱,网上好像没有思维导图,等有时间
用freemind做个,如有错误,还请指正!
========================================================
基于命令行的GDB前端:gdb
基于图形的GDB前端:DDD  xxgdb
基于文本的GDB前端  gdbtui|gdb -tui

一.gdb命令行参数:

  1. gdb (gdb arguments)--args myprog (myprog arguments)
  2. gdb myprog -tty /dev/pts/1  [注:此处是-tty,并非有些参考书上写的-t)
  3. gdb -q(-s)   :do not display the  gdb and GPL information 
  4. gdb -batch -x command_file  myprog  :usefel!


二.进入gdb后的命令:
   1. file  : load the execute file if not load in the command line
   2. shell shell_command Execute the rest of the line as a shell command.With no arguments, run an inferior shell.
   3. 怎样不退出gdb编辑,编译源文件并重新加载编译后的? kill
   4.

   5.


   6. l(ist) [from,to]  repeat to display the whole source code
   7.

   8. b(reak)   (num or function) if condition
   9. condition bp_number [expression]    if u have set bp in the desired position, add or change the the bk condition
  10.                                     To delete a break condition,do not use expression
  11. watch
  12. watch expression     stop the program when the value of expression changes.
  13. rwatch expression    stop the program whenever the program reads the value of any object involved in the evaluation of ex                     pression.
  14. awatch expression    stop the program whenever the program reads or modifies the value of any object involved in the eval                     uation of expression.
  15. delete
  16. enable
  17. disable
  18. ignore N n        ignore bp N n times
  19.

  20. r(un)
  21. s(tep) [lines]  finish
  22. n(ext) [lines]
  23. c(ontinue) [passes]        pass the bp passes times before stop the program
  24.

  25. display
  26. p(rint)[/format] [expression]
        /format=/d u x o t c|a f
  28. x[/nfu] [address]
        /nfu
        n: how many units,default is one
        u  the size of one unit  the value is b h w g
         f = the print format in additional to s and i
         f = d u x o t f c s a i
  34. ptyp(=whatis)
  35.

  36.


  37. bt(backtrace)(=where)
  38. frame  display and change the current frame

  39. up down
  40. info (frame.....)  :display the information of the program
  41. show               :display the information of gdb

  42. set args    set env  VAR1=test ; set variable ; set var var1=test
  43. show args   show env
  44.

  45. call
  46. disassemble
  47. until
  48. attach PID &detach

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值