如何将windbg命令重定向到文件而不在windbg控制台上回显输出?
.logopen
不是答案,因为它让命令输出到 windbg 控制台.
.logopen
is not the answer, because it lets the command output to the windbg console.
例如,!sosex.dumpgen 2
会产生大量输出,我不想在调试器控制台中看到这些输出.现在我正在使用以下内容:
For example, !sosex.dumpgen 2
produces a helluva lot of output, which I do not want to see in the debugger console. Right now I am using the following:
.shell -i- -ci "!dumpgen 2" cmd /c more > D:\tmp\dumpgen2.log
我的问题是 more
命令是交互式的,在输出一定数量的数据后需要用户输入.这对我来说是个大问题.
My problem is that the more
command is interactive and requires user input after outputting certain amount of data. This is a huge problem for me.
一种解决方案可能是使用脚本以非交互方式运行调试器本身,并在那里使用 .logopen 命令.
One solution could be running the debugger itself non interactively with a script and use the .logopen command there.
我想知道我是否可以同时实现我想要的:
I wonder if I could achieve what I want while:
- 从交互式 WinDbg 会话中执行此操作
- 使用普通的标准 shell 命令(也可以是 cmd.exe 或 powershell.exe).我知道编写一个只是将 stdin 转发到 stdout 的小实用程序是一项微不足道的工作,但我还是不想这样做.
.shell -i- -ci "!dumpgen 2" findstr "^" >D:\tmp\dumpgen2.log
^
会找到任何一行的开头,所以它应该是一个 1:1 的副本.
^
will find the beginning of any line, so it should be a 1:1 copy.