Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I restart the debuggee without erasing all my breakpoints?

Tags:

windbg

Each time I do a .restart (because I accidentally pressed F10 one too many times), WinDBG erases all my breakpoints. Is it possible to have it leave the breakpoints in place when restarting the debuggee?

like image 740
Billy ONeal Avatar asked Jan 30 '16 08:01

Billy ONeal


2 Answers

If you set breakpoints using bu rather than with bp breakpoints they are saved in the workspace. So do that, save the workspace, and that should to the trick.

like image 88
conio Avatar answered Nov 15 '22 11:11

conio


this requires awk in path which i normally have in my setup

will work if it is windbg cdb or kd dont have to remember saying yes no always to questions

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

also if there is no aslr saving the command history can help you restart the session in its full glory

.write_cmd_hist c:\foo.txt 

edit

i just checked the clickety history is not part of the command history neither f9 key press nor clicking the hand icon in windbg provides a history event

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>
like image 27
blabb Avatar answered Nov 15 '22 12:11

blabb