Windbg + SOS: cannon & shotgun
description
Transcript of Windbg + SOS: cannon & shotgun
![Page 1: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/1.jpg)
WINDBG + SOS: CANNON &SHOTGUN
you should include in your toolkit
![Page 2: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/2.jpg)
Information Windbg
Not fancy but strong
SOS Son of strike
![Page 3: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/3.jpg)
The Tools SOS Windbg
Part of .NET
Part of Debugging Tools, Download
![Page 4: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/4.jpg)
We already have IDE, why Windbg
We have not IDE in Product Env We have not source code in Product Env Do not use windbg if you have IDE and
source code
![Page 5: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/5.jpg)
Debugging Open executable (Ctrl + E)
Before CLR boot strap Attach to process (F6)
.detach and qd will leave process running Open Crash dump (Ctrl + D)
Offline debugging
![Page 6: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/6.jpg)
Dumps Task Manager
Vista or newer ADPlus ProcDump
![Page 7: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/7.jpg)
ADPlus Vbs versus exe Crash dump
adplus -crash -pn w3wp.exe -o c:\crashdump
Hang dump adplus -hang -pn w3wp.exe -o c:\
crashdump
![Page 8: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/8.jpg)
Task Manager
![Page 9: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/9.jpg)
Useful Commands
Inspecting CLR !gcroot !finzlizequeue !eeheep !dumpdomain
Meta and code !name2ee !dumpmt !u
Inspecting data !dumpheap !dumpobject (!do) !objsize !dumparray
Inspecting threads !threads !syncblk Clrstack !runaway
![Page 10: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/10.jpg)
Setting up the Windbg srv*c:\symbols*http://
msdl.microsoft.com/download/symbols .loadby sos mscorwks
3.5 and 2.0 loadby sos clr
4.0
![Page 11: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/11.jpg)
Start from Dining Philosophers
![Page 12: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/12.jpg)
Demo http://www.cnblogs.com/ivenxu/articles/2
020974.html
![Page 13: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/13.jpg)
Conclusion !syncblk and !clrstack are the key to
dead lock
![Page 14: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/14.jpg)
Crash
![Page 15: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/15.jpg)
Demo http://www.cnblogs.com/ivenxu/articles/1
970562.html
![Page 16: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/16.jpg)
Conclusion !printexception (!pe) is key to detect
exception ~*e!clrstack always work but time cost
![Page 17: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/17.jpg)
Scripting .foreach (name {<loop command>})
{<command name} .foreach(myVariable {!dumpheap -min
85000 -short}){.echo myVariable;!do myVariable;.echo *************}
PowerDbg http://powerdbg.codeplex.com/
![Page 18: Windbg + SOS: cannon & shotgun](https://reader035.fdocuments.in/reader035/viewer/2022062323/56816005550346895dcf06ca/html5/thumbnails/18.jpg)
Q & A Thanks