首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 操作系统 > Linux > More useful GDB usage
【标  题】:More useful GDB usage
【关键字】:More,useful,GDB,usage
【来  源】:http://www.cublog.cn/u/24274/showart.php?id=178813

More useful GDB usage

This report is used to show the power of gdb
As we know, gdb is a powerful tool used to debug programs under linux.
The commands of gdb listed below show its power:

(gdb) b 528
Breakpoint 1 at 0x804b124: file 4n-xfig-nxm-9.c, line 528.
(gdb) commands 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
>p *d
>p *dd
>end

_______________the commands above are used to run print command on the breakpoint 1

(gdb) set $l=0
(gdb) while $l<10
>p $l
>set $l=$l+1
>end
$1 = 0
$2 = 1
$3 = 2
$4 = 3
$5 = 4
$6 = 5
$7 = 6
$8 = 7
$9 = 8
$10 = 9
(gdb)
_____________________These commands above are a piece of loop program running in gdb which
can be applied for purpose of printing a linked list. The following are to run through a linked list:

(gdb) set $l=0
(gdb) set $p=&dt[0][0]
(gdb) while $l<20
>p *$p
>set $p=$p->next
>set $l=$l+1
>end
... ...
机会稍纵即逝:【上一篇】
支持虚拟域名的邮件服务器:【下一篇】
【相关文章】
  • GDB 常用命令介绍
  • gdb中忽略信号处理
  • GDB中查看信息
  • 转贴: 用 GDB 调试程序
  • articles about gdb, ELF
  • 编程交流与学习--More Effective C++的学习-Item M10:在构造函数中防止资源泄漏
  • 编程交流与学习--More Effective C++的学习-Item M16:牢记80-20准则(80-20 rule)
  • 编程交流与学习--More Effective C++的学习-Item M11:禁止异常信息(exceptions)传递到析构函数外
  • 编程交流与学习--More Effective C++的学习-Item M13:通过引用(reference)捕获异常
  • 编程交流与学习--More Effective C++的学习-Item M12:理解“抛出一个异常”与“传递一个参数”或“调用一个...
  • 【随机文章】
  • 火车票出售
  • [旧文]来自 Borcon2003 中国开发者大会的现场报道
  • 格式化字符串
  • ORACLE Bulk Binding批量绑定
  • Web动画图像分解在VB动画设计中的应用
  • How to determine Sybase ASE is fully started
  • Regular Expression HOWTO
  • UDP协议的WinSock API编程示例
  • override overload hide obscure shadow概念区别
  • Linux之线程同步篇
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.