代码之家  ›  专栏  ›  技术社区  ›  Dominique

如何使用windbg打开转储并从命令提示符启动一些windbg命令?

  •  -1
  • Dominique  · 技术社区  · 7 年前

    如上所述 this other question ,我想开始 Windbg 打开一个转储,并启动一些命令( .load pykd.pyd !py heap_stat.py )

    我以为这很容易,但即使是开始 托管代码中设置断点 打开一个崩溃转储看起来不那么容易,从以下失败的例子中可以看到:

    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
    

    我们的想法是得到如下的东西:

    Prompt>windbg.exe -d <dumpfile> -c <command1;command2>
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   blabb    7 年前

    它在windbg.chm和命令提示符中都有记录并可用-? 注:我在控制台模式的CDB上使用它,而不是在windbg上。
    windbg -? , -h , --help , /? , -B#llCr@p
    所有东西都应该弹出debugger.chm(在17763年就坏了,但检查一下说是14951)。

    enter image description here

    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:\>
    

    请求创建转储

    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:
    

    在垃圾堆里装东西然后离开

    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:\>
    
    推荐文章