GDB用法总结

1. 设置进程启动参数

set args arg1 arg2 ....


2. bt列出线程调用栈之后,在调用栈的各层(栈帧)之间切换

frame num


3. info threads列出线程之后,在各线程之间切换

thread num


4. 对所有线程执行bt列调用栈

thread apply all bt

thread apply all bt full  更加详细


5. 运行到当前所在函数返回

finish


6. 列出源代码

list


7.

Alpha- and MIPS-based computers use an unusual stack frame, which sometimes requires GDB to search backward in the object code to find the beginning of a function.


To improve response time (especially for embedded applications, where GDB may be restricted to a slow serial line for this search) you may want to limit the size of this search, using one of these commands:


set heuristic-fence-post limit

Restrict GDB to examining at most  limit bytes in its search for the beginning of a function. A value of  0 (the default) means there is no limit. However, except for  0, the larger the limit the more bytes  heuristic-fence-post must search and therefore the longer it takes to run.

show heuristic-fence-post
Display the current limit.

These commands are available only when GDB is configured for debugging programs on Alpha or MIPS processors.


8. 以16进制查看变量 

p/x  var


9. 查看所有局部变量

info locals


10. 生成core dump

generate-core-file


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值