如何使用Windbg打开转储并从命令提示符处启动一些Windbg命令? [英] How to use Windbg for opening a dump and launching some Windbg commands from the command prompt?

查看:51
本文介绍了如何使用Windbg打开转储并从命令提示符处启动一些Windbg命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  C:\> cdb-吗?|grep -i转储-openPrivateDumpByHandle< HANDLE>指定要调试的故障转储文件的句柄-z< CrashDmpFile>指定要调试的故障转储文件的名称-zd< CrashDmpFile>指定要调试的故障转储文件的名称调试器完成后删除该故障转储崩溃转储C:\> 

要求创建转储

  C:\> cdb -c".dump/ma dominidumpi.dmp; q" cdbMicrosoft(R)Windows调试器版本10.0.17763.132 X86ntdll!LdrpDoDebuggerBreak + 0x2c:774a05a6 cc int 30:000>cdb:读取初始命令".dump/ma dominidumpi.dmp; q"创建dominidumpi.dmp-迷你用户转储转储成功编写放弃: 

加载转储文件并退出

  C:\> cdb -c"lm; q" -z dominidumpi.dmpMicrosoft(R)Windows调试器版本10.0.17763.132 X86加载转储文件[C:\ dominidumpi.dmp]具有完整内存的用户迷你转储文件:仅应用程序数据可用ntdll!LdrpDoDebuggerBreak + 0x2c:774a05a6 cc int 30:000>cdb:读取初始命令"lm; q"开始结束模块名称01250000 01278000 CDB(递延)5b360000 5b4ef000 dbghelp(递延)5b4f0000 5b5cc000 ucrtbase(递延)5b5d0000 5bbac000 dbgeng(递延)77400000 7753c000 ntdll(pdb符号)xxx \ ntdll.pdb775a0000 775aa000 lpk(递延)放弃:C:\> 

As mentioned in this other question, I'd like to start Windbg, open a dump, and launch some commands (.load pykd.pyd and !py heap_stat.py).

I thought this would be easy, but even starting Windbg and open a crash dump seems not that easy, as you can see from following unsuccessful examples:

Prompt>windbg.exe /?
Prompt>windbg.exe --help
Prompt>windbg.exe E:\Bugs\program.exe_181212_215503.dmp
Prompt>windbg.exe -D E:\Bugs\program.exe_181212_215503.dmp
Prompt>windbg.exe -zertyuiopqsdfghjklwxcvbn
Prompt>windbg.exe -help
Prompt>windbg.exe help

The idea is to get something like:

Prompt>windbg.exe -d <dumpfile> -c <command1;command2>

解决方案

it is documented and available in both windbg.chm as well as command prompt -? note i use it on cdb which is console mode not on windbg
windbg -? , -h , --help , /? , -B#llCr@p
everything should should pop up the debugger.chm (broken in 17763 but check say 14951)

C:\>cdb -? | grep -i dump
  -openPrivateDumpByHandle <HANDLE>
    specifies the handle of a crash dump file to debug
  -z <CrashDmpFile> specifies the name of a crash dump file to debug
  -zd <CrashDmpFile> specifies the name of a crash dump file to debugand
                     deletes that crash dump after the debugger has finished
                      crash dump

C:\>

asking to create a dump

C:\>cdb -c ".dump /ma dominidumpi.dmp;q" cdb

Microsoft (R) Windows Debugger Version 10.0.17763.132 X86

ntdll!LdrpDoDebuggerBreak+0x2c:
774a05a6 cc              int     3
0:000> cdb: Reading initial command '.dump /ma dominidumpi.dmp;q'
Creating dominidumpi.dmp - mini user dump
Dump successfully written
quit:

loading a dump doing something and quitting

C:\>cdb -c "lm;q" -z dominidumpi.dmp

Microsoft (R) Windows Debugger Version 10.0.17763.132 X86


Loading Dump File [C:\dominidumpi.dmp]
User Mini Dump File with Full Memory: Only application data is available



ntdll!LdrpDoDebuggerBreak+0x2c:
774a05a6 cc              int     3
0:000> cdb: Reading initial command 'lm;q'
start    end        module name
01250000 01278000   cdb        (deferred)
5b360000 5b4ef000   dbghelp    (deferred)
5b4f0000 5b5cc000   ucrtbase   (deferred)
5b5d0000 5bbac000   dbgeng     (deferred)

77400000 7753c000   ntdll      (pdb symbols)   xxx\ntdll.pdb
775a0000 775aa000   lpk        (deferred)
quit:


C:\>

这篇关于如何使用Windbg打开转储并从命令提示符处启动一些Windbg命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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