2009年2月17日星期二

dbx 调试小结

dbx是一个UNIX下的代码调试工具,它可以在 Solaris, AIX,BSD UNIX系统上使用。更加详细的信息可以参见:dbx。
在使用dbx之前需要在编译源代码时加上 -g 选项。
常用的调试命令:
1. 加载程序:dbx -d [2000] obj [core]。
> Use the -d option to increase nesting depth limit.
>obj: 是编译出来的可执行文件
>core:core dump 文件
2. 运行程序:run(r)
3. 单步:next(n), step(s)
4. 寻求帮助:help [topic]
5. 查看内存栈:where
6. 搜索符号定义: whereis []
7. 设置断点:stop at [line number], stop in [function]... 详细:help stop
8. 跟踪变量:trace variable in [function], trace line number.... 详细:help trace
9. 查看断点,跟踪状态:status
10. 移除断点,跟踪: delete [num]。 先执行status得到num.
11.线程信息:thread
12.退出:quit(q)

13.按指令级别调试: nexti, setpi
14.打印寄存器的值:print $r