- Native
- .prefer_dml 1:
a hidden command, enable marking language, showing hyperlinks in some commands, like lm, etc
- .exr -1
- “.symopt+0x40”:force debugger to load unmatched symbol files, like time-stamp mis-match. To disable, –0x40
- .ocommand: execute command from the target trace,
show last exception, for both native or managed
.command “Sa Windbg Cmd:”
then, in the target program, debug output can be written:
Trace.WriteLine(“sa Windbg Cmd: !mk;g;”);
- Managed
- Threads/Callstack/Frame
- !mk
show both managed/native callstack
- !mframe/!mdv
switch to managed frame or show variables for some frame, get frame index from !mk
- Exception/Breakpoints
- debug CLR start-up code:
bu mscorwks!EEStartup “gu;.loadby sos mscorwks”
- !pe
display exception object or most recent exception if no argument
- !soe –derived | –create | –create2 <typeName> [pseudo-register number for results]
- good sxe sample
- check if it is the expected exception whenever a clr exception thrown:
e.g, !soe –create System.OutOfMemoryException 1
!soe System.OutOfMemoryException 1; if (@$t1 == 0) {g};
sxe –c “!soe System.ArgumentNullException 1; .if (@#t1 == 1) {g} .else{.echo “ArgumentNullException hit”}” clr
sxe –c “!soe System.ArgumentNullException 5; !soe System.NotImplementedException 6; .if @@(@#t5 == 0 && @$t6 == 0) {g} .else{‘my exceptions hit’}” clr
"sxe -c "!mk;g" clr"
stop when finding matched trace output(sxe out:Open?Database*)
- Symbols
- !mln
display symbol info for given address
- !mx
display matching symbols
- Heap/Handle Dump/Inspect
- !dumpgen 3
display LOH objects, kind of similar to !dumpheap –min 85000, since LOH also includes quite a few smaller heap blocks.
- !psscor2.gchandleleaks
- Object Dump/Analyze
- !gcroot
check potential gchandle leaks, may have false positive info, but generally, if it keeps increasing for each operation, then the operation may cause some handle leaks.
display references for given object
No comments:
Post a Comment