什么是自动执行GDB调试会话的最佳途径? [英] What are the best ways to automate a GDB debugging session?

查看:171
本文介绍了什么是自动执行GDB调试会话的最佳途径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GDB是否有一个内置的脚本机制,我应该code了一个expect脚本,或者是有一个更好的解决方案了吗?

Does GDB have a built in scripting mechanism, should I code up an expect script, or is there an even better solution out there?

我会每次都发送相同的命令序列,我会在每个命令的输出保存到一个文件中(最有可能使用GDB的内置日志机制,除非有人有更好的主意)。

I'll be sending the same sequence of commands every time and I'll be saving the output of each command to a file (most likely using GDB's built-in logging mechanism, unless someone has a better idea).

推荐答案

GDB 执行文件 .gdbinit 运行后。
所以,你可以添加你的命令到这个文件,看看是否是你确定。
这是 .gdbinit ,以打印为所有回溯为例 F()调用:

gdb executes file .gdbinit after running. So you can add your commands to this file and see if it is OK for you. This is an example of .gdbinit in order to print backtrace for all f() calls:

set pagination off
set logging file gdb.txt
set logging on
file a.out
b f
commands
bt
continue
end
info breakpoints
r
set logging off
quit

这篇关于什么是自动执行GDB调试会话的最佳途径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆