gdb
来源:互联网 发布:java 日志级别 编辑:程序博客网 时间:2024/05/16 13:24
gdb --args program args
gdb program core/pid
set args cobox -> args[0]=cobox
x /nfu address u:bhwg x /3s argv[0]
info frame,source 查看当前函数语言
info locals 查看当前局部变量
list linenum, funcname 查看源代码
print &x, x = 4, $tmp = 4
set var x = 4, $tmp = 4,var x = strcmp(array, "apple"), $临时变量
set $os = (struct Foo *)malloc(sizeof(struct Foo)), $os->x = 111999, call strcpy($os->ar, "mouse sheet")
return rtnval 替代返回值
whatis x 显示x变量的类型
print *a@10 打印数组a的全部10个元素的值
print a[0]@10
ptype x 显示x的结构定义
watch i != 10 表达式变化时停止
break if i == 10
info breakpoints, watchpoints
delete $foo_bp, set $foo_bp = $bpnum, $bpnum 系统维护
continue 运行,直到下一个断点
finish 运行完函数,返回调用点
until 运行到下一行源代码或断点
backtrace
最后一次执行结果保存为$,倒第二次保存为$$
display x 每次停下来显示x的值
commands 2,遇到断点2执行的命令
>display x
>continue
>end
disable display 2
gcc -DDEBUG #ifdef DEBUG与#endif之间的代码执行
until 9,执行到第九行停止,until funcname,默认执行到下一行或遇到断点
ignore 让断点在前count次到达都不停下来
condition 2 i == 5,断点2仅在i等于5时有效
gdb program core/pid
set args cobox -> args[0]=cobox
x /nfu address u:bhwg x /3s argv[0]
info frame,source 查看当前函数语言
info locals 查看当前局部变量
list linenum, funcname 查看源代码
print &x, x = 4, $tmp = 4
set var x = 4, $tmp = 4,var x = strcmp(array, "apple"), $临时变量
set $os = (struct Foo *)malloc(sizeof(struct Foo)), $os->x = 111999, call strcpy($os->ar, "mouse sheet")
return rtnval 替代返回值
whatis x 显示x变量的类型
print *a@10 打印数组a的全部10个元素的值
print a[0]@10
ptype x 显示x的结构定义
watch i != 10 表达式变化时停止
break if i == 10
info breakpoints, watchpoints
delete $foo_bp, set $foo_bp = $bpnum, $bpnum 系统维护
continue 运行,直到下一个断点
finish 运行完函数,返回调用点
until 运行到下一行源代码或断点
backtrace
最后一次执行结果保存为$,倒第二次保存为$$
display x 每次停下来显示x的值
commands 2,遇到断点2执行的命令
>display x
>continue
>end
disable display 2
gcc -DDEBUG #ifdef DEBUG与#endif之间的代码执行
until 9,执行到第九行停止,until funcname,默认执行到下一行或遇到断点
ignore 让断点在前count次到达都不停下来
condition 2 i == 5,断点2仅在i等于5时有效
0 0
- GDB
- gdb
- GDB
- GDB
- gdb
- GDB
- Gdb
- GDB
- gdb
- gdb
- GDB
- GDB
- gdb
- gdb
- gdb
- GDB
- gdb~~
- gdb
- 找第k大的数
- 移动端适配方案
- JavaScript 设计模式 笔记
- Mybatis学习记录(五)--整合spring开发Dao
- 页面向下滑动实现div显示和隐藏
- gdb
- Win7 SSH Secure connect Ubuntu: server responded algorithm negotiation failed
- SQLite笔记
- java 二进制 十进制 十六进制数据类型转换
- ionic基础概念
- 如何表示一个算法(笔记)
- VirtualBox虚拟机网络设置
- iOS线程通信
- 104. Maximum Depth of Binary Tree