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?
How do I restart the debuggee without erasing all my breakpoints?
Asked Answered
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.
I'm making breakpoints by clicking a source code line. Does that use bu or bp? –
Paperboard
Those are unresolved breakpoints (
bu
). See here (last paragraph): msdn.microsoft.com/en-us/library/windows/hardware/… You can verify this using .bpcmds
which displays the commands used to set the current breakpoints. –
Cawnpore 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>
Does
.write_cmd_hist
do anything for breakpoints set by clicking source lines? I'm not typing any commands in to set such breakpoints, I'm just clicking the appropriate source code line. –
Paperboard doesn't seem to be the case –
Lampyrid
And what about remote debugging?
.shell
runs on the target machine. Do we need to have awk
on all the machines we debug? There is a builtin solution in WinDbg. Trying to reinvent the wheel just for the sake of reinventing it seems... uncalled for. –
Cawnpore © 2022 - 2024 — McMap. All rights reserved.
bu
breakpoints but notbp
breakpoints, so the solution is usebu
and save the workspace. – Cawnpore