在无头模式下运行WinDbg [英] Running WinDbg in headless mode

查看:181
本文介绍了在无头模式下运行WinDbg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在纯无头模式下,WinDbg有没有办法?
我的用例是我可以在命令行上模仿!analyze -v命令,而不启动WinDbg GUI。

解决方案

使用Windows调试工具,还有控制台调试器 cdb



要调试崩溃转储,请使用 -z< dump>选项。要立即运行命令,请使用 -c< command>。要将所有内容输出到文件中,您可以使用通常的DOS >重定向输出。或者使用 .logopen< file> 打开日志文件。要在分析后退出CDB,请使用 q



您要确保您的符号设置正确,所以包含一个 .symfix< path> ;;。reload 。我更喜欢在命令中使用 .symfix< symbolpath> ,而不是 -y< symbolpath> ,所以我可以总是检查日志中是否正确设置。



完整的命令行(使用重定向)

 < windbgpath> \cdb.exe-z< dumpfile> -c.symfix< symbolpath> ;;。reload;!analyze -v; q> < logfile> 

重定向的缺点:行结束是 LF 只要。当调试器启动时,您会收到很多噪音。



完整的命令行(使用日志文件)

 < windbgpath> \cdb.exe-z< dumpfile> -c.logopen< logfile> ;; symfix< symbolpath> ;;。reload;!analyze -v; .logclose; q


Is there a way to WinDbg in pure headless mode ? My use case is that I should be able to imitate "!analyze -v" command for a minidump on command line without launching WinDbg GUI.

解决方案

With the Debugging Tools for Windows, there is also cdb, the console debugger.

To debug a crash dump, use the -z "<dump>" option. To run a command immediately, use -c "<command>". To output everything into a file you can redirect the output with a usual DOS > <file> or open a log file using .logopen <file>. To exit CDB after the analysis, use q.

You want to make sure that you have symbols set up correctly, so include a .symfix <path>;.reload. I prefer using .symfix <symbolpath> in the command rather than -y <symbolpath>, so I can always check in the log that it has been set correctly.

Full command line (using redirect)

"<windbgpath>\cdb.exe" -z "<dumpfile>" -c ".symfix <symbolpath>;.reload;!analyze -v;q" > "<logfile>"

Disadvantage of redirect: line ending is LF only. And you get a lot of noise when the debugger starts.

Full command line (using log file)

"<windbgpath>\cdb.exe" -z "<dumpfile>" -c ".logopen <logfile>;.symfix <symbolpath>;.reload;!analyze -v;.logclose;q"

这篇关于在无头模式下运行WinDbg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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