Discover, Master, InfluenceSlide 1 Debugging the World Starting with the CLR Corneliu I. Tusnea Senior Consultant, Readify It works on my machine!

Slides:



Advertisements
Similar presentations
Advanced Troubleshooting with Debug Diagnostics on IIS 6
Advertisements

CS 450 MPX P ROJECT Introduction to Turbo C. W HY USE T URBO C? Many ANSI C compilers are available for free, however they lack certain features that.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Debugging Under The Hood Tim Chew Consultant Arch Signal Sdn Bhd.
Advanced Troubleshooting with Debug Diagnostics on IIS 6 Draft 2.5 5/13/06 NameTitleGroup Microsoft Corporation.
Debugging What can debuggers do? Run programs Make the program stops on specified places or on specified conditions Give information about current variables’
WINDBG + SOS: CANNON &SHOTGUN you should include in your toolkit.
GROUP 2 WINDOWS INTERNALS TOOLS & WINDOWS SDK DEBUGGING TOOLS David Denhollander Kevin Finkler Corey Sarnia Ailun Shen.
Debugging Production SharePoint Applications Wouter van Vugt.
Memory & Storage Architecture Seoul National University Computer Architecture “ Bomb Lab Hints” 2nd semester, 2014 Modified version : The original.
OllyDbg Debuger.
DEV450 Visual Studio: Best Practices For Debugging Managed Applications Habib Heydarian Scott Nonnenberg Program Managers Microsoft Corporation.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
Logging, tracing, instrumentering, debugging og fejlfinding Instrumentation End-to-End Tracing Historical Debugging Semantic Logging.
Tess Ferrandez ASP.NET Escalation Engineer Microsoft Session Code: WIA402.
Min Kwan Park Test Tech Lead Visual C# QA team. Fail fast To-Dos for fail fast Analyze issues Information for further action Q&A Agenda.
2 Debugging Performance Issues, Memory Issues and Crashes in.net Applications Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session.
Debugging techniques in Linux Debugging Techniques in Linux Chetan Kumar S Wipro Technologies.
W INDOWS BLUE SCREEN OF DEATH AFTER CRASH DEBUGGING Alex Mclean Amy Valley Derek Visch.
Debugging Print And Imaging Drivers. Print driver team philosophy on driver quality There are tools to detect violations Wrongful development assumptions.
Debugging Cluster Programs using symbolic debuggers.
Practical Malware Analysis Ch 8: Debugging Rev
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Memory & Storage Architecture Seoul National University GDB commands Hyeon-gyu School of Computer Science and Engineering.
Debugging applications, using properties Jim Warren – COMPSCI 280 S Enterprise Software Development.
Welcome to the Power of 64-bit Computing …now available on your desktop! © 1998, 1999 Compaq Computer Corporation.
DEBUGGING CHAPTER Topics  Getting Started with Debugging  Types of Bugs –Compile-Time Bugs –Bugs Attaching Scripts –Runtime Errors  Stepping.
Part 3: Advanced Dynamic Analysis Chapter 8: Debugging.
DDT Debugging Techniques Carlos Rosales Scaling to Petascale 2010 July 7, 2010.
SQL Server Crash Dump Analysis A brief tour with WinDbg and other ugly tools Pablo Álvarez Doval Debugging & Optimization Team Lead
VB – Debugging Tools Appendix D. Why do we need debugging? Every program has errors, and the process of finding these errors is debugging Types of errors.
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
Debugging Xin Tong. GDB GNU Project debugger Allows you to see what is going on `inside' another program while it executes or crashed. (Faster than printing.
Bit-DSP-MicrocontrollerTMS320F2812 Texas Instruments Incorporated European Customer Training Center University of Applied Sciences Zwickau (FH)
Satisfy Your Technical Curiosity Hardcore Production Debugging Ingo Rammer
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 11 – gdb and Debugging.
PerlNET: The Camel Talks.NET Jan Dubois The Perl Conference 6 San Diego, July 26 th 2002.
Msdevcon.ru#msdevcon. ИЗ ПЕРВЫХ РУК: ДИАГНОСТИКА ПРИЛОЖЕНИЙ С ПОМОЩЮ ИНСТРУМЕНТОВ VISUAL STUDIO 2012 MAXIM GOLDIN Senior Developer, Microsoft.
. NET Debugging for the Production Environment Part 4: Common Debugging Commands Brad Linscott Premier Field Engineeringing.
Windows ® 2000 Debugging André Vachon Development Lead Windows Debuggers Microsoft Corporation.
Unit - V. Debugging GNU Debugger helps you in getting information about the following: 1.If a core dump happened, then what statement or expression did.
1 Visual Basic “Whidbey”: RAD for the Visual Basic Developer Jay Schmelzer and Shamez Rajan Program Manager Microsoft Corporation Jay Schmelzer and Shamez.
Ladebug Kernel Debugging Tutorial Bob Lidral. Introduction Kinds of kernel debugging How to use Ladebug for kernel debugging Not how to debug a kernel.
2 Common ASP.NET production issues and how to troubleshoot them with WinDbg Tess Ferrandez - Norlander Support Escalation Engineer Microsoft Session Code:
1 Advanced.Net Debugging Using Visual Studio, R# and OzCode IT Week, Summer 2015.
Custom Authentication Providers For DotNetNuke v5.0 Stan Schultes – Sarasota, FL Florida Community Leader
Environment Manager Troubleshooting and Debugging.
HP-SEE Debugging with GDB Vladimir Slavnic Research Assistant SCL, Institute of Physics Belgrade The HP-SEE initiative.
What's New in Visual Studio 2010 Debugging Brian Peek Senior Consultant, ASPSOFT, Inc. Microsoft MVP - C#
| © 2007 LenovoLenovo Confidential Use WinDBG Tool to Analyze BSOD —— Lenovo Service Support Training.
Hardcore Production Debugging of.NET Applications Ingo Rammer
DEBUG.
1/21/2018 6:52 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Operating System Debugging Support and How Win32 Debuggers Work
Live Phishing Attack Authentication Activity from a Foreign Address.
Dynamic Analysis ddaa.
Debugging with gdb gdb is the GNU debugger on our CS machines.
Malware Incident Response  Dynamic Analysis - 2
CLR MD A New Swiss Army Knife tool for Advanced Debugging
.NET and .NET Core 2. .NET Runtimes Pan Wuming 2017.
.NET Debugging for the Production Environment
Debugging Discussion [troubleshooting][managed][Native]
Super Charge Your Debugging in Visual Studio
.NET Debugging for the Production Environment
Debugging tips and tricks
DEV354 Visual Studio 2005: New Enhancements For Debugging Applications
Visual Studio Tooling Developer’s Guide to Windows 10
Advanced Debugging With Visual Studio & OzCode
Hello World Program In Visual Studio and Debugging
Presentation transcript:

Discover, Master, InfluenceSlide 1 Debugging the World Starting with the CLR Corneliu I. Tusnea Senior Consultant, Readify It works on my machine!

Agenda (Improving) Visual Studio Debugging Production Debugging Tips & Tools Resources Discover, Master, InfluenceSlide 2

Visual Studio Debugging Attributes – Debug support DebuggerStepThroughAttribute DebuggerNonUserCodeAttribute – Debug enhancement DebuggerDisplayAttribute DebuggerTypeProxyAttribute DebuggerBrowsableAttribute DebuggerVisualizerAttribute Discover, Master, InfluenceSlide 3

Visual Studio Debugging Demo Attributes Discover, Master, InfluenceSlide 4

Sample Source Code [DebuggerDisplayAttribute( "Id={id} Name={firstName, nq} {lastName, nq}")] public class Customer { [DebuggerBrowsable(DebuggerBrowsableState.Never)] private int id; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string firstName; [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string lastName; Discover, Master, InfluenceSlide 5

Improving Visual Studio Debugging Object Ids Custom breakpoints – Trace points – Breakpoint Conditions Discover, Master, InfluenceSlide 6

Visual Studio Debugging Demo Object Ids, Breakpoints and Trace points Discover, Master, InfluenceSlide 7

Production Debugging Memory dumps – Full memory dump – Mini memory dump Process crashes Start-up crashes Recovering code – Full memory dump – Mini memory dump Discover, Master, InfluenceSlide 8

Production Debugging Demo Taking memory dumps of processes Discover, Master, InfluenceSlide 9

Demo Walkthrough Vista/W2k8: - Task Manager - Right-click process - “Create Dump File” Memory dump on crash/exception: - adplus –crash –quiet –pn w3wp.exe Memory dump now: - adplus –hang –quiet –pn w3wp.exe Discover, Master, InfluenceSlide 10

Production Debugging Process crashes – Crash – Start-up crashes – Hang (deadlock) – Sudden death (unexpected exit) Exceptions First chance exceptions Second chance exceptions Discover, Master, InfluenceSlide 11

Production Debugging Demo Finding the cause of a crashing process Discover, Master, InfluenceSlide 12

Demo walkthrough Windbg.loadby sos mscorwks – load sos extentions !threads – check running threads ~xs – switch to thread id (x = thread id) !pe – print thread exception !dso – dump stack objects !do – dump object with address Discover, Master, InfluenceSlide 13

Production Debugging Demo Recovering the code from a memory dump Discover, Master, InfluenceSlide 14

Recovering Assemblies Discover, Master, InfluenceSlide 15 start endModule: ACorns_Debugging_StartupCrashTest Method Table -> lmv m* * c0public class MyClass { Method Desc -> !dumpmt private void MyFunction(string someParameter) { fif (String.IsNullOrEmpty( someParameter )) IP -> !ip2md c3throw new ApplicationException(); d1 } private void MyOtherFunction() {...} } Use RetAddress from Call Stack (!clrstack) Use IP from Exception (!pe)

Demo walkthrough !ip2md - map instruction to method !dumpmt - show the method table lmv m* * - show details of module !savemodule - save the module Discover, Master, InfluenceSlide 16

Production Debugging Demo Finding crashes on start-up Discover, Master, InfluenceSlide 17

Start-up Crashes Start-up Crashes in Windows Services – Gflags.exe – Service has to be able to interact with desktop – Set Debugger for your ImageFile to windbg.exe Image file is the executable name This will modify the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT \ CurrentVersion\Image File Execution Options\ \Debugger – For processes set this value to allow long wait from SCM on start-up HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ ServicesPipeTimeout ( ) Discover, Master, InfluenceSlide 18

GFlags Discover, Master, InfluenceSlide 19 gflags.exe

WinDbg & SOS Reference Run control – Ctrl + Break – F5 or g –.lastevent –.detach – F6 attach –.help.hh !help.NET Debug Extension: SOS –.load c:\...sos.dll –.loadby sos mscorwks Memory Dumps –.dump c:\.... Mini dump –.dump /ma c:\... Full dump Exceptions – sxe clr stop on CLR exceptions – sxi clr ignore exception – sxn clr notify but continue – !printexception (or.ecxr for native) – sx show exception types – !analyze –v analyse exception – !dae Discover, Master, InfluenceSlide 20

WinDbg & SOS Reference Control – bpmd module method set breakpoint – KB callstack details Threads – ~ unmanaged threads – ~##s switch thread – !threads managed Call stack – !clrstack (–a stack + parameters) – !dumpstack managed + unmanaged stack – ~*e!clrstack show CLR stack for all threads Discover, Master, InfluenceSlide 21

WinDbg & SOS Reference Heap – !dumpstackbobjects – !dumpheap heap info – !dumpheap -mt – !dumpheap –type type heap for a specific type – !dumpheap –type type -stat heap statistics for a type – !do address – !dumparray address (-details can help) – !gcroot address – !syncblk managed locks – !gcref – !objsize address Large Heap – !eeheap –gc – !dumpheap start end Discover, Master, InfluenceSlide 22

WinDbg Good to know tips: – sxe av break on access violation – sxe clr break on all clr exceptions – SRV*c:\..* – bp native breakpoint bp ntdll!zwterminateprocess breakpoint when process is terminated – sxe -c "!pe;!clrstack;gc" clr stop, display exception, dump stack, go – !dumpheap -type CompilerError asp.net compilation errors !dumpobject 0xxxxxxx !dumpobject errorMessageText – !dumpheap -stat -min Large Object Heap Objects – !dumpdomain -stat AdPlus (Memory dumps) – Adplus.vbs –crash –pn processname | –p processid – Adplus.vbs –hang –p|-pn Discover, Master, InfluenceSlide 23

Tools and Resources ACorns.Debugging Tools – FindDeadlock – FindStartupException SOS Assist SOS Extensions – DbgHelp (trigger memory dumps from.net code) – Hawkeye – – Good references – – – instructions.aspx instructions.aspx – Discover, Master, InfluenceSlide 24

Discover, Master, InfluenceSlide 25 A Readify Developer Network session By Corneliu I. Tusnea, Senior Consultant, Readify Address: RDN Website: Blog: