如何在不删除所有断点的情况下重新启动调试对象?

时间:2016-01-30 08:21:52

标签: windbg

每次我执行.restart(因为我不小心按了F10一次),WinDBG会删除所有断点。在重新启动调试对象时是否可以让它保留断点?

2 个答案:

答案 0 :(得分:4)

如果使用bu而不是bp断点设置断点,则会将其保存在工作区中。这样做,保存工作区,这应该是技巧。

答案 1 :(得分:2)

这需要在我的设置中通常具有的路径中的awk

如果是windbg cdb或kd就不会记得说不是总是问题

0:000> .shell -ci "bl" awk "{print \"bp \" $7}" >> c:\breaks.txt
.shell: Process exited

0:000> .restart
CommandLine: C:\Windows\System32\calc.exe

774e04f6 cc              int     3
0:000> bl

0:000> $$>a< c:\breaks.txt

0:000> bl
 0 e 00fb1635     0001 (0001)  0:**** calc!WinMain
 1 e 75eaea11     0001 (0001)  0:**** USER32!MessageBoxA
 2 e 774855c8     0001 (0001)  0:**** ntdll!NtCreateFile

如果没有aslr也是如此 保存命令历史记录可以帮助您完全重启会话

.write_cmd_hist c:\foo.txt 

编辑

我刚刚检查了clickety历史记录不是命令历史记录的一部分,f9 key按下并且windbg中的clicking the hand icon提供历史记录事件

0:000> bl
 0 e 00a11022     0001 (0001)  0:**** helloworld!main+0x22
 1 e 00a11016     0001 (0001)  0:**** helloworld!main+0x16
0:000> .bpcmds
bu0 @@masm(`helloworld!c:\test\helloworld\helloworld.cpp:6+`);
bu1 @@masm(`helloworld!c:\test\helloworld\helloworld.cpp:5+`);
windbg> .write_cmd_hist c:\foo.txt
Wrote command history to 'c:\foo.txt'
0:000> .shell - type c:\foo.txt
Unknown option ' '
.write_cmd_hist c:\foo.txt
.bpcmds
bl
.cls
t <----- neither f8 ,f10 nor f5 gets recorded in the history
.echo foo
g helloworld!main
.shell: Process exited
Press ENTER to continue
<.shell waiting 1 second(s) for process>
<.shell process may need input>