Debugger Scripts

Logging all managed exceptionsCDB.exe -pn LoadGenWin.exe -cf clr.txt — You’d log all managed exceptions when something goes wrong.

·         CDB.exe -pn LoadGenWin.exe

·         .logopen /t C:\clr.log

·         .loadby sos mscorwks; !eeversion;    sxe -c “!clrstack; !pe; gc” clr

Snapping suspicious managed exceptions (1st chance) — CDB.exe -pn LoadGenWin.exe -cf 1st.txt — You have to edit script to snap suspicious exceptions.

·         .loadby sos mscorwks; !eeversion;    sxi -c “!soe Microsoft.Mapi.MapiExceptionNetworkError 5; !soe System.NullReferenceException 6; !soe System.ArgumentNullException 7; !soe System.OutOfMemoryException 8; .if @@((@$t5==0) && (@$t6 == 0) && (@$t7 == 0) && (@$t8 == 0)) { !pe -nested; gc } .else { !threads; clrstack -a; !dso; !pe -nested; .dump /ma /u c:\\1st.dmp; gc }” clr;    gc

Snapping unhandled managed exceptions (2nd chance) — CDB.exe -pn LoadGenWin.exe -cf 2nd.txtYou’d snap exceptions unhandled when process crashes.

·         .loadby sos mscorwks; !eeversion;    sxi -c “!threads; clrstack -a; !dso; !pe -nested; .dump /ma /u c:\\2nd.dmp; qd” clr;    gc

Snapping Process ExitCDB.exe -pn LoadGenWin.exe -cf exit.txt — You’d take a snap when process suddenly exits itself.

·         .loadby sos mscorwks; !eeversion;    sxi -c “!dumpheap -stat -min 100; ~*e!clrstack -a; !threads; !dso; !pe; .dump /ma /u C:\\exit.dmp” epr;    gc

Snapping Process Hang — CDB.exe -pn LoadGenWin.exe -cf hang.txt — You’d take multiple snaps when process goes hang.

·         .dump /ma /u C:\hang.dmp;    .loadby sos mscorwks; !eeversion;    !dumpheap -stat -min 100; !threads; !clrstack -a; !dso; !pe; qd

Comments (0)