GDB是否有内置的脚本机制,我应该编写一个期望脚本,还是有更好的解决方案?
我每次都会发送相同的命令序列,我会将每个命令的输出保存到文件中(最有可能使用GDB的内置日志记录机制,除非有人有更好的想法).
我想调试一些程序.我需要从一些函数的所有调用中回溯,例如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)
如何在脚本中为库调用设置断点?