如何将整个GDB会话转储到文件,包括我输入的命令及其输出? [英] How to dump the entire GDB session to a file, including commands I type and their output?
问题描述
脚本
命令,该命令将shell中显示的所有内容转储到文件中,包括: - 命令输入
- PS1行
- 命令的stdout和stderr
gdb中的等价物是什么?
我试图运行 shell脚本
来自GDB内部,但是在我返回后,我在shell中,失去了shell提示符,无法再运行命令。此外,我无法使用ctrl + c或ctrl + \退出。我需要强制杀死 / bin / login tty2
才能退出。
<如果你想记录GDB的输出,你可以使用 GDB日志记录输出命令,例如。
set logging file mylog.txt
set logging on
如果您想将程序的输出重定向到文件,可以使用重定向,例如。
运行myprog> mylog.txt
请参阅 /onlinedocs/gdb/Input_002fOutput.html#Input_002fOutputrel =noreferrer> In bash, I can use the What is the equivalent in gdb? I tried to run If you want to log GDB's output, you can use the GDB logging output commands, eg. If you want to redirect your program's output to a file, you can use a redirect, eg. see the chapter on program IO in the GDB manual for more information 这篇关于如何将整个GDB会话转储到文件,包括我输入的命令及其输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!script
command, which dumps everything that shows on the shell to a file, including:
shell script
from inside GDB, but after I hit return, I was in the shell and lost the shell prompt and could not run command any more. Moreover I could not use ctrl+c or ctrl+\ to exit. I needed to force kill the /bin/login tty2
to exit.set logging file mylog.txt
set logging on
run myprog > mylog.txt