SlideShare a Scribd company logo
Debugging .NET Applications with WinDBG Cory Foy http://coryfoy.com | @cory_foy
Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
.NET Fundamentals CLR Fundamentals Memory Management Basics Debugging Fundamentals
CLR Fundamentals Managed Assembly Layout PE Header CLR Header IL (Intermediate Language) Metadata Header Metadata
CLR Fundamentals .NET Runtime in a Process
Demo: Viewing Managed Objects Cory Foy http://coryfoy.com | @cory_foy
Viewing Managed Objects Start up the app and click on the Managed Objects button Start up WinDBG and attach to the executable (click “No” if it asks you to save the workspace) then load SOS by typing “.loadbysosmscorwks” and hitting enter. Also load symbols by typing “.symfix C:ymbols” and hitting enter, then typing “.reload” and hitting enter
Viewing Managed Objects View All Threads by typing in “~” and hitting enter. View all managed threads by typing in “!threads” and hitting enter. Note there are 5 native threads, but only 2 managed threads. Also note that thread 2 is marked as (Finalizer) – that’s the thread responsible for finalization Change to the main thread by typing “~0s” (tilde zero s). This tells WinDBG to switch to thread 0. Then type “!clrstack” to see where we are in the application. Note we are in the Main method right now.
Viewing Managed Objects Next, let’s look at the objects on the heap. Type “!dumpheap –stat”. You’ll see many objects. You can filter by typing things like -min or –max as parameters to dumpheap. Now find all of our objects on the heap by typing “!dumpheap –type WinDBG”. This filters for any object with the text “WinDBG” in it’s name. The top list are the actual objects and their memory locations, while the bottom list are the type names. You can figure out which is which by matching up the MethodTable addresses (MT Column)
Viewing Managed Objects We can view a specific object using “!dumpobj” (or “!do” for short). We’ll look at the HelloWorld Object by typing “!do <address>” where address is from the !dumpheap command earlier. We can see we have a string field called “hello” and a world property. We can then look at the string by typing “!do <address>”. In this example, the address would be 263a000. We can see that field contains the string “Hello”.
Viewing Managed Objects When we did a !do on the HelloWorld object, one piece of information was the MethodTable address. We can use the !dumpmt command to see what methods the object exposes. Type “!dumpmt –md <methodtableaddress>”. If the JIT Column has “PreJIT” then the method came from an Ngen’d object. If it has JIT, then the method has been called and JIT’d. If it has NONE, the method hasn’t been called. You can dissassemble IL that has been JIT’d by passing in the MethodDesc address to “!U”
Viewing Managed Objects If we’ve attached to the process doing a live debug (which we’re doing here), then you can set breakpoints using !bpmd. For example, we can have it breakpoint just before the MessageBox shows up by passing in the assembly name and fully qualified type. You can use bl to see the breakpoints.  We then type “g” to release the current break we have on the app, and click the Managed Objects button again. We’ll then see WinDBG hit the breakpoint. We can run !clrstack to see what led us to that call
CLR Fundamentals Threads Managed Threads is an object – it lives on native system threads CLR Threads Finalizer Garbage Collector (Server GC) Debugger Timer Threadpool (I/O and Worker)
CLR Fundamentals Just-In-Time compilation Program makes a call to a method The .NET Runtime checks to see if the method has been called before If so, it executes the JIT’d code If not, it compiles the IL code and stores it in memory, updating the MethodDesc
.NET Fundamentals CLR Fundamentals Memory Management Basics Debugging Fundamentals
Memory Management Stacks versus Heaps Stack – First in / First Out Heap – access by address Garbage Collector Heap Where all objects are stored Broken into 3 generations and one Large Object Heap Large Object > 85,000 bytes
Memory Management Garbage Collector Sequence Suspend Execution Engine Mark objects without roots Plan (budgets, fragmentation) Sweep (delete market objects) Compact (move leftover objects to back of heap) Restart Execution Engine
Memory Management Memory Leaks Possible in both Managed and Unmanaged Code Use Perfmon to check for symptoms Unmanaged Leak Private Bytes Increase, #Bytes In All Heaps stays flat Managed Leak Both Private Bytes and Bytes In All Heaps increase Need multiple dump files
Memory Management http://blogs.msdn.com/tess/archive/2008/03/17/net-debugging-demos-lab-6-memory-leak-review.aspx
Memory Management Why do we leak managed memory? Objects not being released “Pinned” memory Finalized Objects (Destructors on Managed Objects) Finalized objects require an additional GC cycle to be cleaned since they have to go in the finalizer thread to run
Memory Management Exception Handling Workflow Exception Occurs (create an exception object) Notify Debugger (1st Chance Exception) Look for a handler by walking up the call stack If handler found, let it handle exception If not, throw a 2nd Chance Exception and terminate the process
.NET Fundamentals CLR Fundamentals Memory Management Basics Debugging Fundamentals
Debugging Fundamentals Typical Problems in Production System hangs or deadlocks Fatal Exceptions Data Loss or inconsistency Performance Problems Excessive Memory Usage App Pool Restarts (slow access to ASP.NET pages)
Debugging Fundamentals Approaching the problem Be the application (visualize what could cause the problem) Use Application and System Logs Try to reproduce in Development or Staging environments Create a hypothesis and use WinDBG to validate
Debugging Fundamentals Debugging Production Apps Typically don’t have Visual Studio installed, or access to the remote debugger Attaching a debugger freezes all threads Capture memory dumps At time of crash / exception Over time to troubleshoot hangs / leaks
Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
Debugging Crashes Application seems to work fine, but something happens Unhandled Exception Dialog App “disappears” Steps Desktop App: Attach and stop on Exceptions Web App: Use DebugDiag to capture memory dump
Demo: Debugging Crashes Cory Foy http://coryfoy.com | @cory_foy
Debugging Crashes Open Application  and click the “Crash” button”. Unhandled Dialog should appear and kill the app. Start app back up and attach to it with WinDBG, then load SOS. Once SOS is loaded, type “sxeclr” to tell WinDBG to break on all .NET Exceptions, then type “g” and click on the Crash button again. Because we’ve enabled exception notification, WinDBG breaks on the first-chance exception.
Debugging Crashes The first place to look is the exception object itself. We can either do a “!do” on the object address listed, or simply type “!pe”. You can also pass an address to !pe if you need to view other than the last exception thrown. We can see there is a file not found exception. Let’s see where we were at. So it looks like the app calls “ReadAllText” from a method called “Crash_Click” from the Form1 object. If we have access to Source, we’d start there. If not, we can find the method address and dissassemble
Debugging Crashes Note that if we click “g” at this point, WinDBG breaks again. This is because the exception we first saw was *not* the crash reason. Like the previous exception, this one is listed as a First Chance Exception.  If we click “g” again, we’ll see WinDBG breakpoint again. Note that it clearly tells us this is a second chance exception – the next thing that will happen is process termination.
Demo: Debugging Crashes on Application Startup Cory Foy http://coryfoy.com | @cory_foy
Debugging Crashes On Startup Open the App and check the “Crash on Startup” option, then close the app and restart. Notice it immediately crashes. The challenge is that we won’t have time to attach a debugger. You can set registry keys to automatically launch a debugger, or we could launch the app from the debugger, which we’ll do here. Start up WinDBG and go to File->Open Executable. Browse to the WinDBGDemo executable and select it.
Debugging Crashes On Startup At this point, we are in the PE load of the application, meaning it hasn’t even decided if this is a native or managed app yet. Which also means no .NET libraries are loaded, so we can’t load SOS.  What we can do is set a breakpoint to fire when the .NET runtime is loaded, at which point we can set the handlers we need. Type “sxe ld mscorwks” which means set WinDBG to break when mscorwks is loaded. We can now load SOS and set the CLR Exception breakpoints. Now type “g” till our app breaks. You can now debug it as a crash.
Debugging Crashes On Startup If you have a Windows Service which is crashing on startup, then you’ll need to modify some registry keys and permissions on the service. For more information, see the following KB article, or the blog post from our site (Note: When you finish this demo, go to your user directoryppDataocalicrosoftinDBGDemo.exe.0.0.0 and modify the user.config file to have CrashOnStartup to be False) http://support.microsoft.com/kb/824344 http://blog.coryfoy.com/2008/06/debugging-a-net-windows-service-that-is-crashing-on-startup/
Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
Debugging Memory Leaks Memory Usage Continues to grow in the app May cause app pool restarts in ASP.NET Out of Memory exceptions when you still have memory free Several Reasons Unreleased objects “Pinned” memory You have plenty of memory! (GC only runs when it feels memory pressure)
Debugging Memory Leaks Diagnosing Memory Leaks PerfMon to determine if it is a managed leak Take multiple memory dumps to determine what is happening For the objects on the heap, find out why they are sticking around Check the GC Generation for the objects
Demo: Debugging Memory Leaks Cory Foy http://coryfoy.com | @cory_foy
Debugging Memory Leaks Start the app and task manager, then click on the Memory Leak button. Note that the memory is still increasing.  Fire up Perfmon to see if this is a managed or native leak. Start->Run->Perfmon. You can remove the Processor Time counter and add the following counters: .NET CLR Memory -> #Bytes in all Heaps -> WinDBGDemo and Process -> Private Bytes -> WinDBGDemo.  You should see that both are growing at about the same rate indicating a managed leak
Debugging Memory Leaks To debug this, we’ll need to take two snapshots of the application far enough apart to see memory difference. You can do this right from Task Manager. Create two, about 15 seconds apart. You can now kill the application. Open two instances of WinDBG and open each memory dump file you created in a different instance of WinDBG. Load up SOS in each one as well.
Debugging Memory Leaks What we’re wanting to do is compare the two memory dumps to see if we can spot the culprit. Using !VMStat on each file we can see that memory usage is certainly increasing.  And if we do a “!dumpheap –stat” on each one, we can see something quite startlingly – 230,000 additional objects are on the heap!
Debugging Memory Leaks Normally you’d have to dig through the heap to find which objects increased, but we see something interesting. An object called “LeakForm” has had 900 instances created. Perhaps those aren’t being cleaned up? Let’s look at one. We’ll see all the instances by doing a “!dumpheap -type WinDBGDemo.LeakForm” then picking any object at random to do a !do on With that object address, let’s see what is holding on to it with “!GCRoot <address>”
Debugging Memory Leaks We see that the LeakForm is being held on to an object, which is of type System.Object[]. If we do a !do on it, we don’t see much of interest But if we compare the arrays between the first dump and the second dump using the “!da <address>” command, we find a clue. Between the first and second memory dumps, all of the extra LeakForms were added to this array! At this point, we examine the source code to see what is going on.
Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
Debugging Hangs Two types of hangs Low CPU Hang Generally caused by a deadlock High CPU Hang App in a tight loop, or under heavy load
Debugging Hangs Diagnosing Hangs High CPU Hang Multiple memory dumps Compare which thread is getting processor time Low CPU Hang Walk through the waiting threads and match locks Very tedious process
Demo: Debugging High CPU Hangs Cory Foy http://coryfoy.com | @cory_foy
Debugging High CPU Hangs Start the app and Task Manager. Click on the High CPU Hang. You should see a single processor spike (100% on 1CPU). In this example, I have a 4CPU system, so a CPU of 25% indicates it is fully utilizing one processor. Take two memory dumps from Task Manager about 15 seconds apart. You can then kill the application.
Debugging High CPU Hangs Open the two memory dump files in different WinDBG instances and load SOS. The first thing we need to know is if a single thread is using up all of the time, indicating a possible loop. We can use the command !runaway to see which threads are getting CPU time We can see from this that thread 0 was using up all of the time in between the two memory dumps
Debugging High CPU Hangs So what is thread 0 doing? By running !clrstack on each memory dump, we can see that the call stacks are the same, possibly indicating that this is the culprit. I say possibly because if a bunch of calls are happening to different methods, we very well could have gotten “lucky” and seen the same method. Always verify your assumptions. In this case, looking at the source (either real source, or through reflector) we see the following. I think we have our culprit
Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
Demo: WinDBG Tips and Tricks Cory Foy http://coryfoy.com | @cory_foy
WinDBG Tips and Tricks You can get quite a bit of help with both WinDBG and SOS. For the WinDBG help content, type “.hh” and it will open the WinDBG CHM file. You can also type “.hh <command>” and it will take you to that section For SOS, you can type “!help” to see all available commands, or “!help <command>” to see a specific one
WinDBG Tips and Tricks You can use the shell command to run the output of a WinDBG command to an external process and the results are displayed back into the UI. For example, to quickly find the shared domain, you can run ‘.shell –ci “!dumpdomain” find /i “shared domain”’ You can also take advantage of this to do integrations with PowerShell
WinDBG Tips and Tricks When viewing stacks, you can use !clrstack to view the managed stack. You can also use the command “k” to view the native stack You can also output the stack for all threads by combining the “~” command with a star (for all threads) and the command. For example “~*k” or “~*e!clrstack” (which means execute the command !clrstack)
WinDBG Tips and Tricks You can do a lot with automation of WinDBG. For example, you can have WinDBG execute commands when certain breakpoints are hit You can also automate what happens when CLR Exceptions are hit by using the –c option with sxe. In this example, every time we hit an exception we would spit out the exception and CLR stack trace.
WinDBG Tips and Tricks You can also loop through various elements. For example, if we wanted to dump out all strings greater than 5k that were on the heap, we could do the following with the “.foreach” command Finally, if you want to adjust the colors, you can do that in View->Options
Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
Additional Tools DebugDiag Used to automate the capture of exceptions for IIS processes ADPlus Used to capture dumps from command line Managed Debuggers (CorDbg, MDbg) Managed Debugging Assistants (Visual Studio) Profilers
More Information http://blogs.msdn.com/tess microsoft.com/whdc/DevTools/Debugging http://windbg.info http://www.coryfoy.com foyc at coryfoy dot com @cory_foy on Twitter Slides will be posted on CoryFoy.com

More Related Content

What's hot

ES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game KataES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game Kata
David Rodenas
 
Ever Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the WildEver Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the Wild
CTruncer
 
Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008
Andrea Francia
 
TDD in Python With Pytest
TDD in Python With PytestTDD in Python With Pytest
TDD in Python With Pytest
Eddy Reyes
 
Five Easy Ways to QA Your Drupal Site
Five Easy Ways to QA Your Drupal SiteFive Easy Ways to QA Your Drupal Site
Five Easy Ways to QA Your Drupal Site
Mediacurrent
 
Pentester++
Pentester++Pentester++
Pentester++
CTruncer
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testingClaudio Beatrice
 
Higher Level Malware
Higher Level MalwareHigher Level Malware
Higher Level Malware
CTruncer
 
The Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while PersistingThe Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while Persisting
CTruncer
 
Try harder or go home
Try harder or go homeTry harder or go home
Try harder or go home
jaredhaight
 
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)brian d foy
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
Seb Rose
 
Testing Legacy Rails Apps
Testing Legacy Rails AppsTesting Legacy Rails Apps
Testing Legacy Rails Apps
Rabble .
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
Rowan Merewood
 
TDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaTDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and Gomega
Eddy Reyes
 
Debugging, Monitoring and Profiling in TYPO3
Debugging, Monitoring and Profiling in TYPO3Debugging, Monitoring and Profiling in TYPO3
Debugging, Monitoring and Profiling in TYPO3
AOE
 
Cloud forensics putting the bits back together
Cloud forensics putting the bits back togetherCloud forensics putting the bits back together
Cloud forensics putting the bits back together
Shakacon
 
Presentation_C++UnitTest
Presentation_C++UnitTestPresentation_C++UnitTest
Presentation_C++UnitTestRaihan Masud
 
Testing Toolbox
Testing ToolboxTesting Toolbox
Testing Toolbox
Michael Peters
 

What's hot (20)

ES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game KataES3-2020-P2 Bowling Game Kata
ES3-2020-P2 Bowling Game Kata
 
Ever Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the WildEver Present Persistence - Established Footholds Seen in the Wild
Ever Present Persistence - Established Footholds Seen in the Wild
 
Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008
 
TDD in Python With Pytest
TDD in Python With PytestTDD in Python With Pytest
TDD in Python With Pytest
 
Five Easy Ways to QA Your Drupal Site
Five Easy Ways to QA Your Drupal SiteFive Easy Ways to QA Your Drupal Site
Five Easy Ways to QA Your Drupal Site
 
Pentester++
Pentester++Pentester++
Pentester++
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
Higher Level Malware
Higher Level MalwareHigher Level Malware
Higher Level Malware
 
The Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while PersistingThe Supporting Role of Antivirus Evasion while Persisting
The Supporting Role of Antivirus Evasion while Persisting
 
Try harder or go home
Try harder or go homeTry harder or go home
Try harder or go home
 
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
 
Testing Legacy Rails Apps
Testing Legacy Rails AppsTesting Legacy Rails Apps
Testing Legacy Rails Apps
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
TDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and GomegaTDD in Go with Ginkgo and Gomega
TDD in Go with Ginkgo and Gomega
 
Debugging, Monitoring and Profiling in TYPO3
Debugging, Monitoring and Profiling in TYPO3Debugging, Monitoring and Profiling in TYPO3
Debugging, Monitoring and Profiling in TYPO3
 
Cloud forensics putting the bits back together
Cloud forensics putting the bits back togetherCloud forensics putting the bits back together
Cloud forensics putting the bits back together
 
Presentation_C++UnitTest
Presentation_C++UnitTestPresentation_C++UnitTest
Presentation_C++UnitTest
 
Testing Toolbox
Testing ToolboxTesting Toolbox
Testing Toolbox
 

Viewers also liked

Crash (or) Hang dump analysis using WinDbg in Windows platform by K.S.Shanmug...
Crash (or) Hang dump analysis using WinDbg in Windows platform by K.S.Shanmug...Crash (or) Hang dump analysis using WinDbg in Windows platform by K.S.Shanmug...
Crash (or) Hang dump analysis using WinDbg in Windows platform by K.S.Shanmug...
Shanmuga KS
 
Advanced Debugging with WinDbg and SOS
Advanced Debugging with WinDbg and SOSAdvanced Debugging with WinDbg and SOS
Advanced Debugging with WinDbg and SOS
Sasha Goldshtein
 
Windows Debugging with WinDbg
Windows Debugging with WinDbgWindows Debugging with WinDbg
Windows Debugging with WinDbg
Arno Huetter
 
Advanced windows debugging
Advanced windows debuggingAdvanced windows debugging
Advanced windows debugging
chrisortman
 
Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015
Cory Foy
 
6. code level reversing
6. code level reversing6. code level reversing
6. code level reversing
Youngjun Chang
 
Debugging Debugging
Debugging DebuggingDebugging Debugging
Roots equation
Roots equationRoots equation
Roots equationgueste1be5de
 
Regula falsi method
Regula falsi methodRegula falsi method
Regula falsi methodandrushow
 
Windows memory management
Windows memory managementWindows memory management
Windows memory managementTech_MX
 
Debugging
DebuggingDebugging
.NET Debugging tricks you wish you knew tamir dresher
.NET Debugging tricks you wish you knew   tamir dresher.NET Debugging tricks you wish you knew   tamir dresher
.NET Debugging tricks you wish you knew tamir dresher
Tamir Dresher
 
Qbasic tutorial
Qbasic tutorialQbasic tutorial
Qbasic tutorial
jovelleluzon
 

Viewers also liked (15)

Crash (or) Hang dump analysis using WinDbg in Windows platform by K.S.Shanmug...
Crash (or) Hang dump analysis using WinDbg in Windows platform by K.S.Shanmug...Crash (or) Hang dump analysis using WinDbg in Windows platform by K.S.Shanmug...
Crash (or) Hang dump analysis using WinDbg in Windows platform by K.S.Shanmug...
 
Advanced Debugging with WinDbg and SOS
Advanced Debugging with WinDbg and SOSAdvanced Debugging with WinDbg and SOS
Advanced Debugging with WinDbg and SOS
 
Windows Debugging with WinDbg
Windows Debugging with WinDbgWindows Debugging with WinDbg
Windows Debugging with WinDbg
 
Advanced windows debugging
Advanced windows debuggingAdvanced windows debugging
Advanced windows debugging
 
Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015
 
Debugging
DebuggingDebugging
Debugging
 
6. code level reversing
6. code level reversing6. code level reversing
6. code level reversing
 
Debugging Debugging
Debugging DebuggingDebugging Debugging
Debugging Debugging
 
Roots equation
Roots equationRoots equation
Roots equation
 
Regula falsi method
Regula falsi methodRegula falsi method
Regula falsi method
 
Qbasic
QbasicQbasic
Qbasic
 
Windows memory management
Windows memory managementWindows memory management
Windows memory management
 
Debugging
DebuggingDebugging
Debugging
 
.NET Debugging tricks you wish you knew tamir dresher
.NET Debugging tricks you wish you knew   tamir dresher.NET Debugging tricks you wish you knew   tamir dresher
.NET Debugging tricks you wish you knew tamir dresher
 
Qbasic tutorial
Qbasic tutorialQbasic tutorial
Qbasic tutorial
 

Similar to Debugging NET Applications With WinDBG

Switch case looping
Switch case loopingSwitch case looping
Switch case looping
Cherimay Batallones
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!olracoatalub
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpointHajime Morrita
 
JavaScript Best Pratices
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best Pratices
ChengHui Weng
 
Scripting The Dom
Scripting The DomScripting The Dom
Scripting The Dom
Ara Pehlivanian
 
My final requirement
My final requirementMy final requirement
My final requirement
katrinaguevarra29
 
Fuzzing - Part 2
Fuzzing - Part 2Fuzzing - Part 2
Fuzzing - Part 2
UTD Computer Security Group
 
Writing Rust Command Line Applications
Writing Rust Command Line ApplicationsWriting Rust Command Line Applications
Writing Rust Command Line Applications
All Things Open
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
Brian Lyttle
 
Cucumber presentation
Cucumber presentationCucumber presentation
Cucumber presentation
Akhila B
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinarurumedina
 
Exception handling
Exception handlingException handling
Exception handlingMahesh Pachbhai
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi pptmark-asoi
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.gerrell
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
aprilyyy
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and Debugging
Rich Helton
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
David Glick
 
CLR Exception Handing And Memory Management
CLR Exception Handing And Memory ManagementCLR Exception Handing And Memory Management
CLR Exception Handing And Memory Management
Shiny Zhu
 
.NET for hackers
.NET for hackers.NET for hackers
.NET for hackers
Antonio Parata
 

Similar to Debugging NET Applications With WinDBG (20)

Switch case looping
Switch case loopingSwitch case looping
Switch case looping
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
 
JavaScript Best Pratices
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best Pratices
 
Scripting The Dom
Scripting The DomScripting The Dom
Scripting The Dom
 
My final requirement
My final requirementMy final requirement
My final requirement
 
Fuzzing - Part 2
Fuzzing - Part 2Fuzzing - Part 2
Fuzzing - Part 2
 
Writing Rust Command Line Applications
Writing Rust Command Line ApplicationsWriting Rust Command Line Applications
Writing Rust Command Line Applications
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
 
Cucumber presentation
Cucumber presentationCucumber presentation
Cucumber presentation
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medina
 
Exception handling
Exception handlingException handling
Exception handling
 
Intro To AOP
Intro To AOPIntro To AOP
Intro To AOP
 
Mark asoi ppt
Mark asoi pptMark asoi ppt
Mark asoi ppt
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and Debugging
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
 
CLR Exception Handing And Memory Management
CLR Exception Handing And Memory ManagementCLR Exception Handing And Memory Management
CLR Exception Handing And Memory Management
 
.NET for hackers
.NET for hackers.NET for hackers
.NET for hackers
 

More from Cory Foy

Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Cory Foy
 
Stratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right TimeStratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right Time
Cory Foy
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software West
Cory Foy
 
Code Katas
Code KatasCode Katas
Code Katas
Cory Foy
 
Distributed Agility
Distributed AgilityDistributed Agility
Distributed Agility
Cory Foy
 
Scaling Agility
Scaling AgilityScaling Agility
Scaling Agility
Cory Foy
 
Kanban for DevOps
Kanban for DevOpsKanban for DevOps
Kanban for DevOps
Cory Foy
 
Ruby and OO for Beginners
Ruby and OO for BeginnersRuby and OO for Beginners
Ruby and OO for Beginners
Cory Foy
 
Agile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the OrganizationAgile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the Organization
Cory Foy
 
Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?
Cory Foy
 
Scrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at ScaleScrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at Scale
Cory Foy
 
SQE Boston - When Code Cries
SQE Boston - When Code CriesSQE Boston - When Code Cries
SQE Boston - When Code Cries
Cory Foy
 
GOTO Berlin - When Code Cries
GOTO Berlin - When Code CriesGOTO Berlin - When Code Cries
GOTO Berlin - When Code Cries
Cory Foy
 
Rails as a Pattern Language
Rails as a Pattern LanguageRails as a Pattern Language
Rails as a Pattern Language
Cory Foy
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in Rails
Cory Foy
 
Agile Demystified
Agile DemystifiedAgile Demystified
Agile Demystified
Cory Foy
 
When Code Cries
When Code CriesWhen Code Cries
When Code Cries
Cory Foy
 
Ruby for C# Developers
Ruby for C# DevelopersRuby for C# Developers
Ruby for C# Developers
Cory Foy
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
Cory Foy
 
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy CodeMud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Cory Foy
 

More from Cory Foy (20)

Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
 
Stratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right TimeStratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right Time
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software West
 
Code Katas
Code KatasCode Katas
Code Katas
 
Distributed Agility
Distributed AgilityDistributed Agility
Distributed Agility
 
Scaling Agility
Scaling AgilityScaling Agility
Scaling Agility
 
Kanban for DevOps
Kanban for DevOpsKanban for DevOps
Kanban for DevOps
 
Ruby and OO for Beginners
Ruby and OO for BeginnersRuby and OO for Beginners
Ruby and OO for Beginners
 
Agile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the OrganizationAgile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the Organization
 
Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?
 
Scrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at ScaleScrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at Scale
 
SQE Boston - When Code Cries
SQE Boston - When Code CriesSQE Boston - When Code Cries
SQE Boston - When Code Cries
 
GOTO Berlin - When Code Cries
GOTO Berlin - When Code CriesGOTO Berlin - When Code Cries
GOTO Berlin - When Code Cries
 
Rails as a Pattern Language
Rails as a Pattern LanguageRails as a Pattern Language
Rails as a Pattern Language
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in Rails
 
Agile Demystified
Agile DemystifiedAgile Demystified
Agile Demystified
 
When Code Cries
When Code CriesWhen Code Cries
When Code Cries
 
Ruby for C# Developers
Ruby for C# DevelopersRuby for C# Developers
Ruby for C# Developers
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy CodeMud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 

Debugging NET Applications With WinDBG

  • 1. Debugging .NET Applications with WinDBG Cory Foy http://coryfoy.com | @cory_foy
  • 2. Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
  • 3. .NET Fundamentals CLR Fundamentals Memory Management Basics Debugging Fundamentals
  • 4. CLR Fundamentals Managed Assembly Layout PE Header CLR Header IL (Intermediate Language) Metadata Header Metadata
  • 5. CLR Fundamentals .NET Runtime in a Process
  • 6. Demo: Viewing Managed Objects Cory Foy http://coryfoy.com | @cory_foy
  • 7. Viewing Managed Objects Start up the app and click on the Managed Objects button Start up WinDBG and attach to the executable (click “No” if it asks you to save the workspace) then load SOS by typing “.loadbysosmscorwks” and hitting enter. Also load symbols by typing “.symfix C:ymbols” and hitting enter, then typing “.reload” and hitting enter
  • 8. Viewing Managed Objects View All Threads by typing in “~” and hitting enter. View all managed threads by typing in “!threads” and hitting enter. Note there are 5 native threads, but only 2 managed threads. Also note that thread 2 is marked as (Finalizer) – that’s the thread responsible for finalization Change to the main thread by typing “~0s” (tilde zero s). This tells WinDBG to switch to thread 0. Then type “!clrstack” to see where we are in the application. Note we are in the Main method right now.
  • 9. Viewing Managed Objects Next, let’s look at the objects on the heap. Type “!dumpheap –stat”. You’ll see many objects. You can filter by typing things like -min or –max as parameters to dumpheap. Now find all of our objects on the heap by typing “!dumpheap –type WinDBG”. This filters for any object with the text “WinDBG” in it’s name. The top list are the actual objects and their memory locations, while the bottom list are the type names. You can figure out which is which by matching up the MethodTable addresses (MT Column)
  • 10. Viewing Managed Objects We can view a specific object using “!dumpobj” (or “!do” for short). We’ll look at the HelloWorld Object by typing “!do <address>” where address is from the !dumpheap command earlier. We can see we have a string field called “hello” and a world property. We can then look at the string by typing “!do <address>”. In this example, the address would be 263a000. We can see that field contains the string “Hello”.
  • 11. Viewing Managed Objects When we did a !do on the HelloWorld object, one piece of information was the MethodTable address. We can use the !dumpmt command to see what methods the object exposes. Type “!dumpmt –md <methodtableaddress>”. If the JIT Column has “PreJIT” then the method came from an Ngen’d object. If it has JIT, then the method has been called and JIT’d. If it has NONE, the method hasn’t been called. You can dissassemble IL that has been JIT’d by passing in the MethodDesc address to “!U”
  • 12. Viewing Managed Objects If we’ve attached to the process doing a live debug (which we’re doing here), then you can set breakpoints using !bpmd. For example, we can have it breakpoint just before the MessageBox shows up by passing in the assembly name and fully qualified type. You can use bl to see the breakpoints. We then type “g” to release the current break we have on the app, and click the Managed Objects button again. We’ll then see WinDBG hit the breakpoint. We can run !clrstack to see what led us to that call
  • 13. CLR Fundamentals Threads Managed Threads is an object – it lives on native system threads CLR Threads Finalizer Garbage Collector (Server GC) Debugger Timer Threadpool (I/O and Worker)
  • 14. CLR Fundamentals Just-In-Time compilation Program makes a call to a method The .NET Runtime checks to see if the method has been called before If so, it executes the JIT’d code If not, it compiles the IL code and stores it in memory, updating the MethodDesc
  • 15. .NET Fundamentals CLR Fundamentals Memory Management Basics Debugging Fundamentals
  • 16. Memory Management Stacks versus Heaps Stack – First in / First Out Heap – access by address Garbage Collector Heap Where all objects are stored Broken into 3 generations and one Large Object Heap Large Object > 85,000 bytes
  • 17. Memory Management Garbage Collector Sequence Suspend Execution Engine Mark objects without roots Plan (budgets, fragmentation) Sweep (delete market objects) Compact (move leftover objects to back of heap) Restart Execution Engine
  • 18. Memory Management Memory Leaks Possible in both Managed and Unmanaged Code Use Perfmon to check for symptoms Unmanaged Leak Private Bytes Increase, #Bytes In All Heaps stays flat Managed Leak Both Private Bytes and Bytes In All Heaps increase Need multiple dump files
  • 20. Memory Management Why do we leak managed memory? Objects not being released “Pinned” memory Finalized Objects (Destructors on Managed Objects) Finalized objects require an additional GC cycle to be cleaned since they have to go in the finalizer thread to run
  • 21. Memory Management Exception Handling Workflow Exception Occurs (create an exception object) Notify Debugger (1st Chance Exception) Look for a handler by walking up the call stack If handler found, let it handle exception If not, throw a 2nd Chance Exception and terminate the process
  • 22. .NET Fundamentals CLR Fundamentals Memory Management Basics Debugging Fundamentals
  • 23. Debugging Fundamentals Typical Problems in Production System hangs or deadlocks Fatal Exceptions Data Loss or inconsistency Performance Problems Excessive Memory Usage App Pool Restarts (slow access to ASP.NET pages)
  • 24. Debugging Fundamentals Approaching the problem Be the application (visualize what could cause the problem) Use Application and System Logs Try to reproduce in Development or Staging environments Create a hypothesis and use WinDBG to validate
  • 25. Debugging Fundamentals Debugging Production Apps Typically don’t have Visual Studio installed, or access to the remote debugger Attaching a debugger freezes all threads Capture memory dumps At time of crash / exception Over time to troubleshoot hangs / leaks
  • 26. Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
  • 27. Debugging Crashes Application seems to work fine, but something happens Unhandled Exception Dialog App “disappears” Steps Desktop App: Attach and stop on Exceptions Web App: Use DebugDiag to capture memory dump
  • 28. Demo: Debugging Crashes Cory Foy http://coryfoy.com | @cory_foy
  • 29. Debugging Crashes Open Application and click the “Crash” button”. Unhandled Dialog should appear and kill the app. Start app back up and attach to it with WinDBG, then load SOS. Once SOS is loaded, type “sxeclr” to tell WinDBG to break on all .NET Exceptions, then type “g” and click on the Crash button again. Because we’ve enabled exception notification, WinDBG breaks on the first-chance exception.
  • 30. Debugging Crashes The first place to look is the exception object itself. We can either do a “!do” on the object address listed, or simply type “!pe”. You can also pass an address to !pe if you need to view other than the last exception thrown. We can see there is a file not found exception. Let’s see where we were at. So it looks like the app calls “ReadAllText” from a method called “Crash_Click” from the Form1 object. If we have access to Source, we’d start there. If not, we can find the method address and dissassemble
  • 31. Debugging Crashes Note that if we click “g” at this point, WinDBG breaks again. This is because the exception we first saw was *not* the crash reason. Like the previous exception, this one is listed as a First Chance Exception. If we click “g” again, we’ll see WinDBG breakpoint again. Note that it clearly tells us this is a second chance exception – the next thing that will happen is process termination.
  • 32. Demo: Debugging Crashes on Application Startup Cory Foy http://coryfoy.com | @cory_foy
  • 33. Debugging Crashes On Startup Open the App and check the “Crash on Startup” option, then close the app and restart. Notice it immediately crashes. The challenge is that we won’t have time to attach a debugger. You can set registry keys to automatically launch a debugger, or we could launch the app from the debugger, which we’ll do here. Start up WinDBG and go to File->Open Executable. Browse to the WinDBGDemo executable and select it.
  • 34. Debugging Crashes On Startup At this point, we are in the PE load of the application, meaning it hasn’t even decided if this is a native or managed app yet. Which also means no .NET libraries are loaded, so we can’t load SOS. What we can do is set a breakpoint to fire when the .NET runtime is loaded, at which point we can set the handlers we need. Type “sxe ld mscorwks” which means set WinDBG to break when mscorwks is loaded. We can now load SOS and set the CLR Exception breakpoints. Now type “g” till our app breaks. You can now debug it as a crash.
  • 35. Debugging Crashes On Startup If you have a Windows Service which is crashing on startup, then you’ll need to modify some registry keys and permissions on the service. For more information, see the following KB article, or the blog post from our site (Note: When you finish this demo, go to your user directoryppDataocalicrosoftinDBGDemo.exe.0.0.0 and modify the user.config file to have CrashOnStartup to be False) http://support.microsoft.com/kb/824344 http://blog.coryfoy.com/2008/06/debugging-a-net-windows-service-that-is-crashing-on-startup/
  • 36. Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
  • 37. Debugging Memory Leaks Memory Usage Continues to grow in the app May cause app pool restarts in ASP.NET Out of Memory exceptions when you still have memory free Several Reasons Unreleased objects “Pinned” memory You have plenty of memory! (GC only runs when it feels memory pressure)
  • 38. Debugging Memory Leaks Diagnosing Memory Leaks PerfMon to determine if it is a managed leak Take multiple memory dumps to determine what is happening For the objects on the heap, find out why they are sticking around Check the GC Generation for the objects
  • 39. Demo: Debugging Memory Leaks Cory Foy http://coryfoy.com | @cory_foy
  • 40. Debugging Memory Leaks Start the app and task manager, then click on the Memory Leak button. Note that the memory is still increasing. Fire up Perfmon to see if this is a managed or native leak. Start->Run->Perfmon. You can remove the Processor Time counter and add the following counters: .NET CLR Memory -> #Bytes in all Heaps -> WinDBGDemo and Process -> Private Bytes -> WinDBGDemo. You should see that both are growing at about the same rate indicating a managed leak
  • 41. Debugging Memory Leaks To debug this, we’ll need to take two snapshots of the application far enough apart to see memory difference. You can do this right from Task Manager. Create two, about 15 seconds apart. You can now kill the application. Open two instances of WinDBG and open each memory dump file you created in a different instance of WinDBG. Load up SOS in each one as well.
  • 42. Debugging Memory Leaks What we’re wanting to do is compare the two memory dumps to see if we can spot the culprit. Using !VMStat on each file we can see that memory usage is certainly increasing. And if we do a “!dumpheap –stat” on each one, we can see something quite startlingly – 230,000 additional objects are on the heap!
  • 43. Debugging Memory Leaks Normally you’d have to dig through the heap to find which objects increased, but we see something interesting. An object called “LeakForm” has had 900 instances created. Perhaps those aren’t being cleaned up? Let’s look at one. We’ll see all the instances by doing a “!dumpheap -type WinDBGDemo.LeakForm” then picking any object at random to do a !do on With that object address, let’s see what is holding on to it with “!GCRoot <address>”
  • 44. Debugging Memory Leaks We see that the LeakForm is being held on to an object, which is of type System.Object[]. If we do a !do on it, we don’t see much of interest But if we compare the arrays between the first dump and the second dump using the “!da <address>” command, we find a clue. Between the first and second memory dumps, all of the extra LeakForms were added to this array! At this point, we examine the source code to see what is going on.
  • 45. Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
  • 46. Debugging Hangs Two types of hangs Low CPU Hang Generally caused by a deadlock High CPU Hang App in a tight loop, or under heavy load
  • 47. Debugging Hangs Diagnosing Hangs High CPU Hang Multiple memory dumps Compare which thread is getting processor time Low CPU Hang Walk through the waiting threads and match locks Very tedious process
  • 48. Demo: Debugging High CPU Hangs Cory Foy http://coryfoy.com | @cory_foy
  • 49. Debugging High CPU Hangs Start the app and Task Manager. Click on the High CPU Hang. You should see a single processor spike (100% on 1CPU). In this example, I have a 4CPU system, so a CPU of 25% indicates it is fully utilizing one processor. Take two memory dumps from Task Manager about 15 seconds apart. You can then kill the application.
  • 50. Debugging High CPU Hangs Open the two memory dump files in different WinDBG instances and load SOS. The first thing we need to know is if a single thread is using up all of the time, indicating a possible loop. We can use the command !runaway to see which threads are getting CPU time We can see from this that thread 0 was using up all of the time in between the two memory dumps
  • 51. Debugging High CPU Hangs So what is thread 0 doing? By running !clrstack on each memory dump, we can see that the call stacks are the same, possibly indicating that this is the culprit. I say possibly because if a bunch of calls are happening to different methods, we very well could have gotten “lucky” and seen the same method. Always verify your assumptions. In this case, looking at the source (either real source, or through reflector) we see the following. I think we have our culprit
  • 52. Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
  • 53. Demo: WinDBG Tips and Tricks Cory Foy http://coryfoy.com | @cory_foy
  • 54. WinDBG Tips and Tricks You can get quite a bit of help with both WinDBG and SOS. For the WinDBG help content, type “.hh” and it will open the WinDBG CHM file. You can also type “.hh <command>” and it will take you to that section For SOS, you can type “!help” to see all available commands, or “!help <command>” to see a specific one
  • 55. WinDBG Tips and Tricks You can use the shell command to run the output of a WinDBG command to an external process and the results are displayed back into the UI. For example, to quickly find the shared domain, you can run ‘.shell –ci “!dumpdomain” find /i “shared domain”’ You can also take advantage of this to do integrations with PowerShell
  • 56. WinDBG Tips and Tricks When viewing stacks, you can use !clrstack to view the managed stack. You can also use the command “k” to view the native stack You can also output the stack for all threads by combining the “~” command with a star (for all threads) and the command. For example “~*k” or “~*e!clrstack” (which means execute the command !clrstack)
  • 57. WinDBG Tips and Tricks You can do a lot with automation of WinDBG. For example, you can have WinDBG execute commands when certain breakpoints are hit You can also automate what happens when CLR Exceptions are hit by using the –c option with sxe. In this example, every time we hit an exception we would spit out the exception and CLR stack trace.
  • 58. WinDBG Tips and Tricks You can also loop through various elements. For example, if we wanted to dump out all strings greater than 5k that were on the heap, we could do the following with the “.foreach” command Finally, if you want to adjust the colors, you can do that in View->Options
  • 59. Agenda .NET Fundamentals Debugging Crashes Debugging Memory Leaks Debugging Hangs WinDBG Tips and Tricks Other Tools
  • 60. Additional Tools DebugDiag Used to automate the capture of exceptions for IIS processes ADPlus Used to capture dumps from command line Managed Debuggers (CorDbg, MDbg) Managed Debugging Assistants (Visual Studio) Profilers
  • 61. More Information http://blogs.msdn.com/tess microsoft.com/whdc/DevTools/Debugging http://windbg.info http://www.coryfoy.com foyc at coryfoy dot com @cory_foy on Twitter Slides will be posted on CoryFoy.com

Editor's Notes

  1. Why you see OOM Exception objects on the heap