相关疑难解决方法(0)

自动化GDB调试会话的最佳方法是什么?

GDB是否有内置的脚本机制,我应该编写一个期望脚本,还是有更好的解决方案?

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

scripting automation gdb expect

64
推荐指数
3
解决办法
7万
查看次数

自动化gdb:在每次调用函数put时显示回溯

我想调试一些程序.我需要从一些函数的所有调用中回溯,例如puts.

现在我使用这样的gdb script:

set width 0
set height 0
set verbose off
break puts
commands 1
backtrace
continue
end
Run Code Online (Sandbox Code Playgroud)

但是开始吧

gdb --batch --command=script --args ./some_program arguments
Run Code Online (Sandbox Code Playgroud)

给出错误:

Function "puts" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
/root/script:5: Error in sourced command file:
No breakpoint number 1.
Run Code Online (Sandbox Code Playgroud)

如何在脚本中为库调用设置断点?

gdb

12
推荐指数
1
解决办法
7695
查看次数

标签 统计

gdb ×2

automation ×1

expect ×1

scripting ×1