Accelerated .NET Memory Dump Analysis training public slides

Dmitry Vostokov
Dmitry VostokovSoftware Diagnostics Engineering and Diagnostics-Driven Development. em Software Diagnostics Technology and Services
.NET
Memory Dump Analysis
Dmitry Vostokov
Software Diagnostics Services
Version 3.0
Prerequisites
Basic .NET programming and debugging
WinDbg Commands
We use these boxes to
introduce some WinDbg
commands used in practice
exercises
© 2018 Software Diagnostics Services
Training Goals
 Review fundamentals
 Learn how to analyze process dumps
 Learn necessary commands in context
 Cover CLR 4 (x86 and x64)
© 2018 Software Diagnostics Services
Training Principles
 Talk only about what I can show
 Lots of pictures
 Lots of examples
 Original content and examples
© 2018 Software Diagnostics Services
Part 1: Fundamentals
© 2018 Software Diagnostics Services
Memory Space (x86)
Kernel Space
User Space
FFFFFFFF
80000000
7FFFFFFF
00000000
© 2018 Software Diagnostics Services
Memory Space (x64)
© 2018 Software Diagnostics Services
Kernel Space
User Space
FFFFFFFF`FFFFFFFF
FFFF8000`00000000
00007FFF`FFFFFFFF
00000000`00000000
User / Managed Space
WinDbg Commands
lmv command lists all loaded
modules (EXE and DLLs)
© 2018 Software Diagnostics Services
User Space (PID e364)
00000000`00000000
00007fff`ffffffff
LINQPad
kernel32
CLR
ntdll
Types/Assemblies/Modules
WinDbg Commands
lmv command lists all loaded
modules (EXE and DLLs)
!IP2MD command shows type
method and module address
!DumpModule command
shows module name
Types Assembly Modules
1..*
© 2018 Software Diagnostics Services
Process Threads WinDbg Commands
.load <a path to SOS>
Loads SOS WinDbg extension
~<n>s command switches
between threads
k command shows unmanaged
stack trace
!Threads command shows
managed threads
!CLRStack command shows
managed stack trace
© 2018 Software Diagnostics Services
User Space (PID e364)
00000000`00000000
00007fff`ffffffff
LINQPad
kernel32
CLR
ntdll
JIT code
Example
0:000> k
# Child-SP RetAddr Call Site
00 000000dc`219be178 00007ffb`41ddddb8 win32u!NtUserWaitMessage+0x14
01 000000dc`219be180 00007ffb`41d71535 System_Windows_Forms_ni+0x2cddb8
02 000000dc`219be230 00007ffb`41d70c88 System_Windows_Forms_ni+0x261535
03 000000dc`219be330 00007ffb`41d70a8f System_Windows_Forms_ni+0x260c88
04 000000dc`219be3d0 00007ffb`12f4dbc0 System_Windows_Forms_ni+0x260a8f
05 000000dc`219be430 00007ffb`12f45a94 0x00007ffb`12f4dbc0
06 000000dc`219be5e0 00007ffb`12f41c9d 0x00007ffb`12f45a94
07 000000dc`219bed20 00007ffb`12f420b6 0x00007ffb`12f41c9d
08 000000dc`219bee00 00007ffb`12f406e4 0x00007ffb`12f420b6
09 000000dc`219bee30 00007ffb`724d5863 0x00007ffb`12f406e4
0a 000000dc`219bef20 00007ffb`724d5702 clr!CallDescrWorkerInternal+0x83
0b 000000dc`219bef60 00007ffb`724d5e05 clr!CallDescrWorkerWithHandler+0x4e
0c 000000dc`219befa0 00007ffb`72633598 clr!MethodDescCallSite::CallTargetWorker+0xf8
0d 000000dc`219bf0a0 00007ffb`72633ede clr!RunMain+0x1e7
0e 000000dc`219bf280 00007ffb`72633d9d clr!Assembly::ExecuteMainMethod+0xb6
0f 000000dc`219bf570 00007ffb`72633750 clr!SystemDomain::ExecuteMainMethod+0x639
10 000000dc`219bfb90 00007ffb`726336ce clr!ExecuteEXE+0x3f
11 000000dc`219bfc00 00007ffb`72634234 clr!_CorExeMainInternal+0xb2
12 000000dc`219bfc90 00007ffb`72ec7a6d clr!CorExeMain+0x14
13 000000dc`219bfcd0 00007ffb`7303a44c mscoreei!CorExeMain+0x112
14 000000dc`219bfd30 00007ffb`85591fe4 MSCOREE!CorExeMain_Exported+0x6c
15 000000dc`219bfd60 00007ffb`8797f061 KERNEL32!BaseThreadInitThunk+0x14
16 000000dc`219bfd90 00000000`00000000 ntdll!RtlUserThreadStart+0x21
0:000> !IP2MD 0x00007ffb`12f45a94
MethodDesc: 00007ffb12f81c40
Method Name: LINQPad.Program.Go(System.String[])
Class: 00007ffb12f322e0
MethodTable: 00007ffb12f81e10
mdToken: 0000000006000579
Module: 00007ffb12dc4110
IsJitted: yes
CodeAddr: 00007ffb12f436f0
Transparency: Critical
0:000> !DumpModule 00007ffb12dc4110
Name: C:Program FilesLINQPad5LINQPad.exe
Attributes: PEFile
Assembly: 000001f80c3cf620
LoaderHeap: 0000000000000000
TypeDefToMethodTableMap: 00007ffb12ed0020
TypeRefToMethodTableMap: 00007ffb12ed3a88
MethodDefToDescMap: 00007ffb12ed7000
FieldDefToDescMap: 00007ffb12eefcc8
MemberRefToDescMap: 0000000000000000
FileReferencesMap: 00007ffb12f036c8
AssemblyReferencesMap: 00007ffb12f036d0
MetaData start address: 000001f808cffb04 (1498300
bytes)
© 2018 Software Diagnostics Services
Thread Stack Raw Data
WinDbg Commands
Get stack range:
!teb
Dump raw data:
dc / dps / dpp / dpa / dpu
Dump managed references:
!DumpStackObjects
© 2018 Software Diagnostics Services
User Space (PID e364)
00000000`00000000
00007fff`ffffffff
LINQPad
kernel32
CLR
ntdll
JIT code
User Stack for TID 102
Managed Heap
Pattern-Oriented Diagnostic Analysis
Information Collection
(Scripts)
Information Extraction
(Checklists)
Problem Identification
(Patterns)
Problem Resolution
Troubleshooting
Suggestions
Debugging Strategy
Diagnostic Pattern: a common recurrent identifiable problem together with a set of
recommendations and possible solutions to apply in a specific context.
Diagnostic Analysis Pattern: a common recurrent analysis technique and method
of diagnostic pattern identification in a specific context.
Diagnostic Problem: a set of indicators (symptoms, signs) describing a problem.
Diagnostics Pattern Language: common names of diagnostic and diagnostic analysis
patterns. The same language for any operating system: Windows, Mac OS X, Linux, ...
© 2018 Software Diagnostics Services
Checklist: http://www.dumpanalysis.org/windows-memory-analysis-checklist
Part 2: Practice Exercises
© 2018 Software Diagnostics Services
Links
 Memory Dumps:
Not available in preview version
 Exercise Transcripts:
Not available in preview version
© 2018 Software Diagnostics Services
Exercise 0
 Goal: Install Debugging Tools for Windows and learn how to
set up symbols correctly
 Patterns: Incorrect Stack Trace
 Commands: .symfix, .reload, k
 ANETMDA-DumpsExercise-0-Download-Setup-WinDbg.pdf
© 2018 Software Diagnostics Services
Process Memory Dumps
Exercises PN1 – PN12
© 2018 Software Diagnostics Services
Modeling with LINQPad
http://www.linqpad.net/
© 2018 Software Diagnostics Services
Exercise PN1
 Goal: Learn how to load the correct .NET SOS WinDbg
extension and analyze managed space
 Patterns: Stack Trace Collection; CLR Thread; Version-
Specific Extension; Software Exception; Exception Stack
Trace; Managed Code Exception; Managed Stack Trace
 Commands: .logopen, .symfix, .reload, ~*k, .load, !pe, ~*e,
lmv, .chain, .unload, !analyze -v, !CLRStack, .logclose
 ANETMDA-DumpsExercise-PN1-Analysis-process-dump-
ApplicationA.pdf
© 2018 Software Diagnostics Services
Exercise PN2
 Goal: Compare 64-bit process memory dump from exercise
PN1 with 32-bit process memory dump
 Patterns: Platform-Specific Debugger
 ANETMDA-DumpsExercise-PN2-Analysis-process-dump-
ApplicationA-32.pdf
© 2018 Software Diagnostics Services
Exercise PN3
 Goal: Learn how to find problem assemblies, modules,
classes and methods, disassemble code, analyze CPU
spikes
 Patterns: Active Thread; Technology-Specific Subtrace; JIT
Code; Spiking Thread; Annotated Disassembly
 Commands: !analyze -v -hang, !IP2MD, !runaway,
.prompt_allow, ~<>s, ~<>k, !U, !DumpMD, !DumpClass,
!DumpMT, !DumpModule, !DumpAssembly, !DumpDomain
 ANETMDA-DumpsExercise-PN3-Analysis-process-dump-
LINQPadB.pdf
© 2018 Software Diagnostics Services
Exercise PN4
 Goal: Compare 64-bit process memory dump from exercise
PN3 with 32-bit process memory dump
 ANETMDA-DumpsExercise-PN4-Analysis-process-dump-
LINQPadB-32.pdf
© 2018 Software Diagnostics Services
Exercise PN5
 Goal: Learn how to recognize and analyze deadlocks using
SOS(EX), execution residue, handled exceptions, dump
object references
 Patterns: Special Thread; Wait Chain; Deadlock; Execution
Residue (user space); Hidden Exception (user space);
Coincidental Symbolic Information; Caller-n-Callee
 Commands: ~*kL, !Threads, !syncblk, !DumpObj, ub, dp,
!dlk, !DumpStack, !teb, dpS
 ANETMDA-DumpsExercise-PN5-Analysis-process-dump-
LINQPadC.pdf
© 2018 Software Diagnostics Services
Deadlock
© 2018 Software Diagnostics Services
Object
000001f498185fe8
Object
000001f498186028
Thread #12
Thread #12
(owns)
Thread #11
Thread #11
(owns)
Thread #12
(waiting)
Thread #11
(waiting)
Exercise PN6
 Goal: Compare 64-bit process memory dump from exercise
PN5 with 32-bit process memory dump
 Patterns: Execution Residue (managed space); Hidden
Exception (managed space), Handled Exception
 Commands: !DumpStackObjects
 ANETMDA-DumpsExercise-PN6-Analysis-process-dump-
LINQPadC-32.pdf
© 2018 Software Diagnostics Services
Deadlock (x86)
© 2018 Software Diagnostics Services
Exercise PN7
 Goal: Learn how to analyze multiple managed exceptions
 Patterns: Managed Stack Trace Collection; Multiple
Exceptions; Nested Exceptions; NULL Pointer
 ANETMDA-DumpsExercise-PN7-Analysis-process-dump-
ApplicationD.pdf
© 2018 Software Diagnostics Services
Exercise PN8
 Goal: Compare 64-bit process memory dump from exercise
PN7 with 32-bit process memory dump
 ANETMDA-DumpsExercise-PN8-Analysis-process-dump-
ApplicationD-32.pdf
© 2018 Software Diagnostics Services
Exercise PN9
 Goal: Learn how to diagnose heap and handle leaks
 Patterns: Handle Leak; Memory Leak
 Commands: !heap, !address, !DumpHeap, ?, !eeheap,
!GCHandles, !FinalizeQueue, !handle, .cxr
 ANETMDA-DumpsExercise-PN9-Analysis-process-dump-
LINQPadD.pdf
© 2018 Software Diagnostics Services
Exercise PN10
 Goal: Compare 64-bit process memory dump from exercise
PN9 with 32-bit process memory dump
 ANETMDA-DumpsExercise-PN9-Analysis-process-dump-
LINQPadD-32.pdf
© 2018 Software Diagnostics Services
Exercise PN11
 Goal: Learn how to recognize and analyze heap corruption
 Patterns: Invalid Pointer; Regular Data; Managed Heap
Corruption
 Commands: .formats, !VerifyHeap
 ANETMDA-DumpsExercise-PN11-Analysis-process-dump-
LINQPadE.pdf
© 2018 Software Diagnostics Services
Exercise PN12
 Goal: Compare 64-bit process memory dump from exercise
PN11 with 32-bit process memory dump
 ANETMDA-DumpsExercise-PN12-Analysis-process-dump-
LINQPadE-32.pdf
© 2018 Software Diagnostics Services
Pattern Links
CLR Thread Deadlock
Managed Code Exception Duplicate Extension
Nested Exceptions Stack Trace Collection
Mixed Exception Dynamic Memory Corruption
Memory Leak Special Thread
JIT Code Execution Residue
Managed Stack Trace Handled Exception
Multiple Exceptions Annotated Disassembly
Version-Specific Extension Technology-Specific Subtrace
Caller-n-Callee Wait Chain
Hidden Exception Object Distribution Anomaly
Incorrect Stack Trace Execution Residue
NULL Pointer Handle Leak Exception Stack Trace
Software Exception Platform-Specific Debugger
Spiking Thread Hidden Exception Regular Data
Coincidental Symbolic Information
© 2018 Software Diagnostics Services
CLR-related
and managed
Unmanaged
user space
SOS Checklist
 CLR module and SOS extension versions (lmv and
.chain)
 Managed exceptions (~*e !pe -nested)
 Managed threads (!Threads -special)
 Managed stack traces (~*e !CLRStack)
 Managed execution residue (~*e !DumpStackObjects)
 Managed heap (!VerifyHeap, !DumpHeap -stat and
!eeheap -gc)
 GC handles (!GCHandles)
 Finalizer queue (!FinalizeQueue)
 Sync blocks (!syncblk)
© 2018 Software Diagnostics Services
Resources
 WinDbg Help / WinDbg.org (quick links) / DumpAnalysis.org
 C# 7.0 Pocket Reference
 CLR via C#, Fourth Edition
 Advanced .NET Debugging
 Debugging Microsoft .NET 2.0 Applications
 Shared Source CLI 2.0 Internals
 Accelerated Windows Memory Dump Analysis, 4th edition
 Memory Dump Analysis Anthology (Volumes 1 – 10)
© 2018 Software Diagnostics Services
Q&A
Please send your feedback using the contact
form on PatternDiagnostics.com
© 2018 Software Diagnostics Services
Thank you for attendance!
© 2018 Software Diagnostics Services
1 de 37

Recomendados

Accelerated Windows Debugging 3 training public slides por
Accelerated Windows Debugging 3 training public slidesAccelerated Windows Debugging 3 training public slides
Accelerated Windows Debugging 3 training public slidesDmitry Vostokov
313 visualizações66 slides
Accelerated Linux Core Dump Analysis training public slides por
Accelerated Linux Core Dump Analysis training public slidesAccelerated Linux Core Dump Analysis training public slides
Accelerated Linux Core Dump Analysis training public slidesDmitry Vostokov
799 visualizações41 slides
Mod06 new development tools por
Mod06 new development toolsMod06 new development tools
Mod06 new development toolsPeter Haase
402 visualizações30 slides
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017 por
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017Andrey Karpov
3.8K visualizações85 slides
PVS-Studio is ready to improve the code of Tizen operating system por
PVS-Studio is ready to improve the code of Tizen operating systemPVS-Studio is ready to improve the code of Tizen operating system
PVS-Studio is ready to improve the code of Tizen operating systemAndrey Karpov
2.8K visualizações77 slides
Accelerated Mac OS X Core Dump Analysis training public slides por
Accelerated Mac OS X Core Dump Analysis training public slidesAccelerated Mac OS X Core Dump Analysis training public slides
Accelerated Mac OS X Core Dump Analysis training public slidesDmitry Vostokov
211 visualizações53 slides

Mais conteúdo relacionado

Mais procurados

C++ Code as Seen by a Hypercritical Reviewer por
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerAndrey Karpov
143 visualizações148 slides
ICPC08b.ppt por
ICPC08b.pptICPC08b.ppt
ICPC08b.pptPtidej Team
164 visualizações30 slides
Better Code: Concurrency por
Better Code: ConcurrencyBetter Code: Concurrency
Better Code: ConcurrencyPlatonov Sergey
2.1K visualizações140 slides
What has to be paid attention when reviewing code of the library you develop por
What has to be paid attention when reviewing code of the library you developWhat has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you developAndrey Karpov
247 visualizações55 slides
PVS-Studio advertisement - static analysis of C/C++ code por
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codeAndrey Karpov
1.2K visualizações46 slides
Best Bugs from Games: Fellow Programmers' Mistakes por
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesAndrey Karpov
530 visualizações77 slides

Mais procurados(20)

C++ Code as Seen by a Hypercritical Reviewer por Andrey Karpov
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical Reviewer
Andrey Karpov143 visualizações
ICPC08b.ppt por Ptidej Team
ICPC08b.pptICPC08b.ppt
ICPC08b.ppt
Ptidej Team164 visualizações
Better Code: Concurrency por Platonov Sergey
Better Code: ConcurrencyBetter Code: Concurrency
Better Code: Concurrency
Platonov Sergey2.1K visualizações
What has to be paid attention when reviewing code of the library you develop por Andrey Karpov
What has to be paid attention when reviewing code of the library you developWhat has to be paid attention when reviewing code of the library you develop
What has to be paid attention when reviewing code of the library you develop
Andrey Karpov247 visualizações
PVS-Studio advertisement - static analysis of C/C++ code por Andrey Karpov
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ code
Andrey Karpov1.2K visualizações
Best Bugs from Games: Fellow Programmers' Mistakes por Andrey Karpov
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
Andrey Karpov530 visualizações
Zone IDA Proc por Tzung-Bi Shih
Zone IDA ProcZone IDA Proc
Zone IDA Proc
Tzung-Bi Shih397 visualizações
Improving Java performance at JBCNConf 2015 por Raimon Ràfols
Improving Java performance at JBCNConf 2015Improving Java performance at JBCNConf 2015
Improving Java performance at JBCNConf 2015
Raimon Ràfols115 visualizações
Static analysis: looking for errors ... and vulnerabilities? por Andrey Karpov
Static analysis: looking for errors ... and vulnerabilities? Static analysis: looking for errors ... and vulnerabilities?
Static analysis: looking for errors ... and vulnerabilities?
Andrey Karpov90 visualizações
HKG15-207: Advanced Toolchain Usage Part 3 por Linaro
HKG15-207: Advanced Toolchain Usage Part 3HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3
Linaro4.1K visualizações
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems por Andrey Karpov
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Andrey Karpov263 visualizações
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2 por Knowledge Center Computer
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
Knowledge Center Computer 276 visualizações
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext... por David Beazley (Dabeaz LLC)
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
David Beazley (Dabeaz LLC)1.2K visualizações
Global Interpreter Lock: Episode I - Break the Seal por Tzung-Bi Shih
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the Seal
Tzung-Bi Shih1.3K visualizações
PVS-Studio features overview (2020) por Andrey Karpov
PVS-Studio features overview (2020)PVS-Studio features overview (2020)
PVS-Studio features overview (2020)
Andrey Karpov37 visualizações
Joel Falcou, Boost.SIMD por Sergey Platonov
Joel Falcou, Boost.SIMDJoel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMD
Sergey Platonov1.5K visualizações
Рахманов Александр "Что полезного в разборе дампов для .NET-разработчиков?" por Yulia Tsisyk
Рахманов Александр "Что полезного в разборе дампов для .NET-разработчиков?"Рахманов Александр "Что полезного в разборе дампов для .NET-разработчиков?"
Рахманов Александр "Что полезного в разборе дампов для .NET-разработчиков?"
Yulia Tsisyk745 visualizações
Digital System Design Lab Report - VHDL ECE por Ramesh Naik Bhukya
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
Ramesh Naik Bhukya1.9K visualizações
Address/Thread/Memory Sanitizer por Platonov Sergey
Address/Thread/Memory SanitizerAddress/Thread/Memory Sanitizer
Address/Thread/Memory Sanitizer
Platonov Sergey6K visualizações

Similar a Accelerated .NET Memory Dump Analysis training public slides

Accelerated Windows Memory Dump Analysis por
Accelerated Windows Memory Dump AnalysisAccelerated Windows Memory Dump Analysis
Accelerated Windows Memory Dump AnalysisDmitry Vostokov
433 visualizações79 slides
Accelerated Windows Malware Analysis with Memory Dumps por
Accelerated Windows Malware Analysis with Memory DumpsAccelerated Windows Malware Analysis with Memory Dumps
Accelerated Windows Malware Analysis with Memory DumpsDmitry Vostokov
239 visualizações57 slides
Windows内核技术介绍 por
Windows内核技术介绍Windows内核技术介绍
Windows内核技术介绍jeffz
2.3K visualizações40 slides
P4 Introduction por
P4 Introduction P4 Introduction
P4 Introduction Netronome
1.5K visualizações31 slides
Troubleshooting .net core on linux por
Troubleshooting .net core on linuxTroubleshooting .net core on linux
Troubleshooting .net core on linuxPavel Klimiankou
579 visualizações63 slides
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹 por
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹GangSeok Lee
1.4K visualizações85 slides

Similar a Accelerated .NET Memory Dump Analysis training public slides(20)

Accelerated Windows Memory Dump Analysis por Dmitry Vostokov
Accelerated Windows Memory Dump AnalysisAccelerated Windows Memory Dump Analysis
Accelerated Windows Memory Dump Analysis
Dmitry Vostokov433 visualizações
Accelerated Windows Malware Analysis with Memory Dumps por Dmitry Vostokov
Accelerated Windows Malware Analysis with Memory DumpsAccelerated Windows Malware Analysis with Memory Dumps
Accelerated Windows Malware Analysis with Memory Dumps
Dmitry Vostokov239 visualizações
Windows内核技术介绍 por jeffz
Windows内核技术介绍Windows内核技术介绍
Windows内核技术介绍
jeffz2.3K visualizações
P4 Introduction por Netronome
P4 Introduction P4 Introduction
P4 Introduction
Netronome1.5K visualizações
Troubleshooting .net core on linux por Pavel Klimiankou
Troubleshooting .net core on linuxTroubleshooting .net core on linux
Troubleshooting .net core on linux
Pavel Klimiankou579 visualizações
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹 por GangSeok Lee
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
[2007 CodeEngn Conference 01] dual5651 - Windows 커널단의 후킹
GangSeok Lee1.4K visualizações
Fundamentals of Physical Memory Analysis por Dmitry Vostokov
Fundamentals of Physical Memory AnalysisFundamentals of Physical Memory Analysis
Fundamentals of Physical Memory Analysis
Dmitry Vostokov179 visualizações
HKG18-TR14 - Postmortem Debugging with Coresight por Linaro
HKG18-TR14 - Postmortem Debugging with CoresightHKG18-TR14 - Postmortem Debugging with Coresight
HKG18-TR14 - Postmortem Debugging with Coresight
Linaro557 visualizações
Windbg랑 친해지기 por Ji Hun Kim
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기
Ji Hun Kim13.1K visualizações
Freefixer log por reiryuzaki
Freefixer logFreefixer log
Freefixer log
reiryuzaki402 visualizações
Linux kernel tracing superpowers in the cloud por Andrea Righi
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
Andrea Righi400 visualizações
Formbook - In-depth malware analysis (Botconf 2018) por Rémi Jullian
Formbook - In-depth malware analysis (Botconf 2018)Formbook - In-depth malware analysis (Botconf 2018)
Formbook - In-depth malware analysis (Botconf 2018)
Rémi Jullian3.7K visualizações
So You Want To Write Your Own Benchmark por Dror Bereznitsky
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own Benchmark
Dror Bereznitsky10.3K visualizações
[CB19] MalConfScan with Cuckoo: Automatic Malware Configuration Extraction Sy... por CODE BLUE
[CB19] MalConfScan with Cuckoo: Automatic Malware Configuration Extraction Sy...[CB19] MalConfScan with Cuckoo: Automatic Malware Configuration Extraction Sy...
[CB19] MalConfScan with Cuckoo: Automatic Malware Configuration Extraction Sy...
CODE BLUE420 visualizações
Debugging linux kernel tools and techniques por Satpal Parmar
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniques
Satpal Parmar9.1K visualizações
Overlay Technique | Pebble Developer Retreat 2014 por Pebble Technology
Overlay Technique | Pebble Developer Retreat 2014Overlay Technique | Pebble Developer Retreat 2014
Overlay Technique | Pebble Developer Retreat 2014
Pebble Technology1.2K visualizações
Com 135 final project user manual por biasimistfur1984
Com 135 final project user manualCom 135 final project user manual
Com 135 final project user manual
biasimistfur19842.3K visualizações
Crash dump analysis - experience sharing por James Hsieh
Crash dump analysis - experience sharingCrash dump analysis - experience sharing
Crash dump analysis - experience sharing
James Hsieh22K visualizações
Перехват функций (хуки) под Windows в приложениях с помощью C/C++ por corehard_by
Перехват функций (хуки) под Windows в приложениях с помощью C/C++Перехват функций (хуки) под Windows в приложениях с помощью C/C++
Перехват функций (хуки) под Windows в приложениях с помощью C/C++
corehard_by345 visualizações

Mais de Dmitry Vostokov

Debugging TV Frame 0x1C por
Debugging TV Frame 0x1CDebugging TV Frame 0x1C
Debugging TV Frame 0x1CDmitry Vostokov
198 visualizações8 slides
Debugging TV Frame 0x1A por
Debugging TV Frame 0x1ADebugging TV Frame 0x1A
Debugging TV Frame 0x1ADmitry Vostokov
130 visualizações8 slides
Debugging TV Frame 0x34 por
Debugging TV Frame 0x34Debugging TV Frame 0x34
Debugging TV Frame 0x34Dmitry Vostokov
147 visualizações8 slides
Debugging TV Frame 0x33 por
Debugging TV Frame 0x33Debugging TV Frame 0x33
Debugging TV Frame 0x33Dmitry Vostokov
129 visualizações8 slides
Debugging TV Frame 0x31 por
Debugging TV Frame 0x31Debugging TV Frame 0x31
Debugging TV Frame 0x31Dmitry Vostokov
106 visualizações7 slides
Debugging TV Frame 0x25 por
Debugging TV Frame 0x25Debugging TV Frame 0x25
Debugging TV Frame 0x25Dmitry Vostokov
99 visualizações8 slides

Mais de Dmitry Vostokov(20)

Debugging TV Frame 0x1C por Dmitry Vostokov
Debugging TV Frame 0x1CDebugging TV Frame 0x1C
Debugging TV Frame 0x1C
Dmitry Vostokov198 visualizações
Debugging TV Frame 0x1A por Dmitry Vostokov
Debugging TV Frame 0x1ADebugging TV Frame 0x1A
Debugging TV Frame 0x1A
Dmitry Vostokov130 visualizações
Debugging TV Frame 0x34 por Dmitry Vostokov
Debugging TV Frame 0x34Debugging TV Frame 0x34
Debugging TV Frame 0x34
Dmitry Vostokov147 visualizações
Debugging TV Frame 0x33 por Dmitry Vostokov
Debugging TV Frame 0x33Debugging TV Frame 0x33
Debugging TV Frame 0x33
Dmitry Vostokov129 visualizações
Debugging TV Frame 0x31 por Dmitry Vostokov
Debugging TV Frame 0x31Debugging TV Frame 0x31
Debugging TV Frame 0x31
Dmitry Vostokov106 visualizações
Debugging TV Frame 0x25 por Dmitry Vostokov
Debugging TV Frame 0x25Debugging TV Frame 0x25
Debugging TV Frame 0x25
Dmitry Vostokov99 visualizações
Debugging TV Frame 0x24 por Dmitry Vostokov
Debugging TV Frame 0x24Debugging TV Frame 0x24
Debugging TV Frame 0x24
Dmitry Vostokov124 visualizações
Debugging TV Frame 0x21 por Dmitry Vostokov
Debugging TV Frame 0x21Debugging TV Frame 0x21
Debugging TV Frame 0x21
Dmitry Vostokov126 visualizações
Debugging TV Frame 0x20 por Dmitry Vostokov
Debugging TV Frame 0x20Debugging TV Frame 0x20
Debugging TV Frame 0x20
Dmitry Vostokov132 visualizações
Debugging TV Frame 0x19 por Dmitry Vostokov
Debugging TV Frame 0x19Debugging TV Frame 0x19
Debugging TV Frame 0x19
Dmitry Vostokov107 visualizações
Debugging TV Frame 0x18 por Dmitry Vostokov
Debugging TV Frame 0x18Debugging TV Frame 0x18
Debugging TV Frame 0x18
Dmitry Vostokov203 visualizações
Debugging TV Frame 0x17 por Dmitry Vostokov
Debugging TV Frame 0x17Debugging TV Frame 0x17
Debugging TV Frame 0x17
Dmitry Vostokov83 visualizações
Debugging TV Frame 0x16 por Dmitry Vostokov
Debugging TV Frame 0x16Debugging TV Frame 0x16
Debugging TV Frame 0x16
Dmitry Vostokov95 visualizações
Debugging TV Frame 0x15 por Dmitry Vostokov
Debugging TV Frame 0x15Debugging TV Frame 0x15
Debugging TV Frame 0x15
Dmitry Vostokov89 visualizações
Debugging TV Frame 0x14 por Dmitry Vostokov
Debugging TV Frame 0x14Debugging TV Frame 0x14
Debugging TV Frame 0x14
Dmitry Vostokov78 visualizações
Debugging TV Frame 0x13 por Dmitry Vostokov
Debugging TV Frame 0x13Debugging TV Frame 0x13
Debugging TV Frame 0x13
Dmitry Vostokov43 visualizações
Debugging TV Frame 0x12 por Dmitry Vostokov
Debugging TV Frame 0x12Debugging TV Frame 0x12
Debugging TV Frame 0x12
Dmitry Vostokov98 visualizações
Debugging TV Frame 0x11 por Dmitry Vostokov
Debugging TV Frame 0x11Debugging TV Frame 0x11
Debugging TV Frame 0x11
Dmitry Vostokov98 visualizações
Debugging TV Frame 0x10 por Dmitry Vostokov
Debugging TV Frame 0x10Debugging TV Frame 0x10
Debugging TV Frame 0x10
Dmitry Vostokov91 visualizações
Debugging TV Frame 0x0F por Dmitry Vostokov
Debugging TV Frame 0x0FDebugging TV Frame 0x0F
Debugging TV Frame 0x0F
Dmitry Vostokov96 visualizações

Último

2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx por
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptxanimuscrm
11 visualizações19 slides
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... por
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...Deltares
9 visualizações26 slides
WebAssembly por
WebAssemblyWebAssembly
WebAssemblyJens Siebert
32 visualizações18 slides
El Arte de lo Possible por
El Arte de lo PossibleEl Arte de lo Possible
El Arte de lo PossibleNeo4j
34 visualizações35 slides
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... por
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...Deltares
6 visualizações15 slides
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... por
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Donato Onofri
643 visualizações34 slides

Último(20)

2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx por animuscrm
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
animuscrm11 visualizações
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... por Deltares
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
Deltares9 visualizações
WebAssembly por Jens Siebert
WebAssemblyWebAssembly
WebAssembly
Jens Siebert32 visualizações
El Arte de lo Possible por Neo4j
El Arte de lo PossibleEl Arte de lo Possible
El Arte de lo Possible
Neo4j34 visualizações
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... por Deltares
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
Deltares6 visualizações
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... por Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri643 visualizações
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)... por Deltares
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
Deltares9 visualizações
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove... por Deltares
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...
DSD-INT 2023 HydroMT model building and river-coast coupling in Python - Bove...
Deltares15 visualizações
ict act 1.pptx por sanjaniarun08
ict act 1.pptxict act 1.pptx
ict act 1.pptx
sanjaniarun0812 visualizações
SAP FOR TYRE INDUSTRY.pdf por Virendra Rai, PMP
SAP FOR TYRE INDUSTRY.pdfSAP FOR TYRE INDUSTRY.pdf
SAP FOR TYRE INDUSTRY.pdf
Virendra Rai, PMP19 visualizações
DSD-INT 2023 Baseline studies for Strategic Coastal protection for Long Islan... por Deltares
DSD-INT 2023 Baseline studies for Strategic Coastal protection for Long Islan...DSD-INT 2023 Baseline studies for Strategic Coastal protection for Long Islan...
DSD-INT 2023 Baseline studies for Strategic Coastal protection for Long Islan...
Deltares10 visualizações
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J... por Deltares
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
DSD-INT 2023 3D hydrodynamic modelling of microplastic transport in lakes - J...
Deltares7 visualizações
Mark Simpson - UKOUG23 - Refactoring Monolithic Oracle Database Applications ... por marksimpsongw
Mark Simpson - UKOUG23 - Refactoring Monolithic Oracle Database Applications ...Mark Simpson - UKOUG23 - Refactoring Monolithic Oracle Database Applications ...
Mark Simpson - UKOUG23 - Refactoring Monolithic Oracle Database Applications ...
marksimpsongw74 visualizações
What Can Employee Monitoring Software Do?​ por wAnywhere
What Can Employee Monitoring Software Do?​What Can Employee Monitoring Software Do?​
What Can Employee Monitoring Software Do?​
wAnywhere18 visualizações
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ... por Deltares
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
DSD-INT 2023 Wave-Current Interaction at Montrose Tidal Inlet System and Its ...
Deltares9 visualizações
SAP FOR CONTRACT MANUFACTURING.pdf por Virendra Rai, PMP
SAP FOR CONTRACT MANUFACTURING.pdfSAP FOR CONTRACT MANUFACTURING.pdf
SAP FOR CONTRACT MANUFACTURING.pdf
Virendra Rai, PMP11 visualizações
SUGCON ANZ Presentation V2.1 Final.pptx por Jack Spektor
SUGCON ANZ Presentation V2.1 Final.pptxSUGCON ANZ Presentation V2.1 Final.pptx
SUGCON ANZ Presentation V2.1 Final.pptx
Jack Spektor21 visualizações
Unleash The Monkeys por Jacob Duijzer
Unleash The MonkeysUnleash The Monkeys
Unleash The Monkeys
Jacob Duijzer7 visualizações
Cycleops - Automate deployments on top of bare metal.pptx por Thanassis Parathyras
Cycleops - Automate deployments on top of bare metal.pptxCycleops - Automate deployments on top of bare metal.pptx
Cycleops - Automate deployments on top of bare metal.pptx
Thanassis Parathyras30 visualizações
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida por Deltares
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - PridaDSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
DSD-INT 2023 Dam break simulation in Derna (Libya) using HydroMT_SFINCS - Prida
Deltares17 visualizações

Accelerated .NET Memory Dump Analysis training public slides

  • 1. .NET Memory Dump Analysis Dmitry Vostokov Software Diagnostics Services Version 3.0
  • 2. Prerequisites Basic .NET programming and debugging WinDbg Commands We use these boxes to introduce some WinDbg commands used in practice exercises © 2018 Software Diagnostics Services
  • 3. Training Goals  Review fundamentals  Learn how to analyze process dumps  Learn necessary commands in context  Cover CLR 4 (x86 and x64) © 2018 Software Diagnostics Services
  • 4. Training Principles  Talk only about what I can show  Lots of pictures  Lots of examples  Original content and examples © 2018 Software Diagnostics Services
  • 5. Part 1: Fundamentals © 2018 Software Diagnostics Services
  • 6. Memory Space (x86) Kernel Space User Space FFFFFFFF 80000000 7FFFFFFF 00000000 © 2018 Software Diagnostics Services
  • 7. Memory Space (x64) © 2018 Software Diagnostics Services Kernel Space User Space FFFFFFFF`FFFFFFFF FFFF8000`00000000 00007FFF`FFFFFFFF 00000000`00000000
  • 8. User / Managed Space WinDbg Commands lmv command lists all loaded modules (EXE and DLLs) © 2018 Software Diagnostics Services User Space (PID e364) 00000000`00000000 00007fff`ffffffff LINQPad kernel32 CLR ntdll
  • 9. Types/Assemblies/Modules WinDbg Commands lmv command lists all loaded modules (EXE and DLLs) !IP2MD command shows type method and module address !DumpModule command shows module name Types Assembly Modules 1..* © 2018 Software Diagnostics Services
  • 10. Process Threads WinDbg Commands .load <a path to SOS> Loads SOS WinDbg extension ~<n>s command switches between threads k command shows unmanaged stack trace !Threads command shows managed threads !CLRStack command shows managed stack trace © 2018 Software Diagnostics Services User Space (PID e364) 00000000`00000000 00007fff`ffffffff LINQPad kernel32 CLR ntdll JIT code
  • 11. Example 0:000> k # Child-SP RetAddr Call Site 00 000000dc`219be178 00007ffb`41ddddb8 win32u!NtUserWaitMessage+0x14 01 000000dc`219be180 00007ffb`41d71535 System_Windows_Forms_ni+0x2cddb8 02 000000dc`219be230 00007ffb`41d70c88 System_Windows_Forms_ni+0x261535 03 000000dc`219be330 00007ffb`41d70a8f System_Windows_Forms_ni+0x260c88 04 000000dc`219be3d0 00007ffb`12f4dbc0 System_Windows_Forms_ni+0x260a8f 05 000000dc`219be430 00007ffb`12f45a94 0x00007ffb`12f4dbc0 06 000000dc`219be5e0 00007ffb`12f41c9d 0x00007ffb`12f45a94 07 000000dc`219bed20 00007ffb`12f420b6 0x00007ffb`12f41c9d 08 000000dc`219bee00 00007ffb`12f406e4 0x00007ffb`12f420b6 09 000000dc`219bee30 00007ffb`724d5863 0x00007ffb`12f406e4 0a 000000dc`219bef20 00007ffb`724d5702 clr!CallDescrWorkerInternal+0x83 0b 000000dc`219bef60 00007ffb`724d5e05 clr!CallDescrWorkerWithHandler+0x4e 0c 000000dc`219befa0 00007ffb`72633598 clr!MethodDescCallSite::CallTargetWorker+0xf8 0d 000000dc`219bf0a0 00007ffb`72633ede clr!RunMain+0x1e7 0e 000000dc`219bf280 00007ffb`72633d9d clr!Assembly::ExecuteMainMethod+0xb6 0f 000000dc`219bf570 00007ffb`72633750 clr!SystemDomain::ExecuteMainMethod+0x639 10 000000dc`219bfb90 00007ffb`726336ce clr!ExecuteEXE+0x3f 11 000000dc`219bfc00 00007ffb`72634234 clr!_CorExeMainInternal+0xb2 12 000000dc`219bfc90 00007ffb`72ec7a6d clr!CorExeMain+0x14 13 000000dc`219bfcd0 00007ffb`7303a44c mscoreei!CorExeMain+0x112 14 000000dc`219bfd30 00007ffb`85591fe4 MSCOREE!CorExeMain_Exported+0x6c 15 000000dc`219bfd60 00007ffb`8797f061 KERNEL32!BaseThreadInitThunk+0x14 16 000000dc`219bfd90 00000000`00000000 ntdll!RtlUserThreadStart+0x21 0:000> !IP2MD 0x00007ffb`12f45a94 MethodDesc: 00007ffb12f81c40 Method Name: LINQPad.Program.Go(System.String[]) Class: 00007ffb12f322e0 MethodTable: 00007ffb12f81e10 mdToken: 0000000006000579 Module: 00007ffb12dc4110 IsJitted: yes CodeAddr: 00007ffb12f436f0 Transparency: Critical 0:000> !DumpModule 00007ffb12dc4110 Name: C:Program FilesLINQPad5LINQPad.exe Attributes: PEFile Assembly: 000001f80c3cf620 LoaderHeap: 0000000000000000 TypeDefToMethodTableMap: 00007ffb12ed0020 TypeRefToMethodTableMap: 00007ffb12ed3a88 MethodDefToDescMap: 00007ffb12ed7000 FieldDefToDescMap: 00007ffb12eefcc8 MemberRefToDescMap: 0000000000000000 FileReferencesMap: 00007ffb12f036c8 AssemblyReferencesMap: 00007ffb12f036d0 MetaData start address: 000001f808cffb04 (1498300 bytes) © 2018 Software Diagnostics Services
  • 12. Thread Stack Raw Data WinDbg Commands Get stack range: !teb Dump raw data: dc / dps / dpp / dpa / dpu Dump managed references: !DumpStackObjects © 2018 Software Diagnostics Services User Space (PID e364) 00000000`00000000 00007fff`ffffffff LINQPad kernel32 CLR ntdll JIT code User Stack for TID 102 Managed Heap
  • 13. Pattern-Oriented Diagnostic Analysis Information Collection (Scripts) Information Extraction (Checklists) Problem Identification (Patterns) Problem Resolution Troubleshooting Suggestions Debugging Strategy Diagnostic Pattern: a common recurrent identifiable problem together with a set of recommendations and possible solutions to apply in a specific context. Diagnostic Analysis Pattern: a common recurrent analysis technique and method of diagnostic pattern identification in a specific context. Diagnostic Problem: a set of indicators (symptoms, signs) describing a problem. Diagnostics Pattern Language: common names of diagnostic and diagnostic analysis patterns. The same language for any operating system: Windows, Mac OS X, Linux, ... © 2018 Software Diagnostics Services Checklist: http://www.dumpanalysis.org/windows-memory-analysis-checklist
  • 14. Part 2: Practice Exercises © 2018 Software Diagnostics Services
  • 15. Links  Memory Dumps: Not available in preview version  Exercise Transcripts: Not available in preview version © 2018 Software Diagnostics Services
  • 16. Exercise 0  Goal: Install Debugging Tools for Windows and learn how to set up symbols correctly  Patterns: Incorrect Stack Trace  Commands: .symfix, .reload, k  ANETMDA-DumpsExercise-0-Download-Setup-WinDbg.pdf © 2018 Software Diagnostics Services
  • 17. Process Memory Dumps Exercises PN1 – PN12 © 2018 Software Diagnostics Services
  • 18. Modeling with LINQPad http://www.linqpad.net/ © 2018 Software Diagnostics Services
  • 19. Exercise PN1  Goal: Learn how to load the correct .NET SOS WinDbg extension and analyze managed space  Patterns: Stack Trace Collection; CLR Thread; Version- Specific Extension; Software Exception; Exception Stack Trace; Managed Code Exception; Managed Stack Trace  Commands: .logopen, .symfix, .reload, ~*k, .load, !pe, ~*e, lmv, .chain, .unload, !analyze -v, !CLRStack, .logclose  ANETMDA-DumpsExercise-PN1-Analysis-process-dump- ApplicationA.pdf © 2018 Software Diagnostics Services
  • 20. Exercise PN2  Goal: Compare 64-bit process memory dump from exercise PN1 with 32-bit process memory dump  Patterns: Platform-Specific Debugger  ANETMDA-DumpsExercise-PN2-Analysis-process-dump- ApplicationA-32.pdf © 2018 Software Diagnostics Services
  • 21. Exercise PN3  Goal: Learn how to find problem assemblies, modules, classes and methods, disassemble code, analyze CPU spikes  Patterns: Active Thread; Technology-Specific Subtrace; JIT Code; Spiking Thread; Annotated Disassembly  Commands: !analyze -v -hang, !IP2MD, !runaway, .prompt_allow, ~<>s, ~<>k, !U, !DumpMD, !DumpClass, !DumpMT, !DumpModule, !DumpAssembly, !DumpDomain  ANETMDA-DumpsExercise-PN3-Analysis-process-dump- LINQPadB.pdf © 2018 Software Diagnostics Services
  • 22. Exercise PN4  Goal: Compare 64-bit process memory dump from exercise PN3 with 32-bit process memory dump  ANETMDA-DumpsExercise-PN4-Analysis-process-dump- LINQPadB-32.pdf © 2018 Software Diagnostics Services
  • 23. Exercise PN5  Goal: Learn how to recognize and analyze deadlocks using SOS(EX), execution residue, handled exceptions, dump object references  Patterns: Special Thread; Wait Chain; Deadlock; Execution Residue (user space); Hidden Exception (user space); Coincidental Symbolic Information; Caller-n-Callee  Commands: ~*kL, !Threads, !syncblk, !DumpObj, ub, dp, !dlk, !DumpStack, !teb, dpS  ANETMDA-DumpsExercise-PN5-Analysis-process-dump- LINQPadC.pdf © 2018 Software Diagnostics Services
  • 24. Deadlock © 2018 Software Diagnostics Services Object 000001f498185fe8 Object 000001f498186028 Thread #12 Thread #12 (owns) Thread #11 Thread #11 (owns) Thread #12 (waiting) Thread #11 (waiting)
  • 25. Exercise PN6  Goal: Compare 64-bit process memory dump from exercise PN5 with 32-bit process memory dump  Patterns: Execution Residue (managed space); Hidden Exception (managed space), Handled Exception  Commands: !DumpStackObjects  ANETMDA-DumpsExercise-PN6-Analysis-process-dump- LINQPadC-32.pdf © 2018 Software Diagnostics Services
  • 26. Deadlock (x86) © 2018 Software Diagnostics Services
  • 27. Exercise PN7  Goal: Learn how to analyze multiple managed exceptions  Patterns: Managed Stack Trace Collection; Multiple Exceptions; Nested Exceptions; NULL Pointer  ANETMDA-DumpsExercise-PN7-Analysis-process-dump- ApplicationD.pdf © 2018 Software Diagnostics Services
  • 28. Exercise PN8  Goal: Compare 64-bit process memory dump from exercise PN7 with 32-bit process memory dump  ANETMDA-DumpsExercise-PN8-Analysis-process-dump- ApplicationD-32.pdf © 2018 Software Diagnostics Services
  • 29. Exercise PN9  Goal: Learn how to diagnose heap and handle leaks  Patterns: Handle Leak; Memory Leak  Commands: !heap, !address, !DumpHeap, ?, !eeheap, !GCHandles, !FinalizeQueue, !handle, .cxr  ANETMDA-DumpsExercise-PN9-Analysis-process-dump- LINQPadD.pdf © 2018 Software Diagnostics Services
  • 30. Exercise PN10  Goal: Compare 64-bit process memory dump from exercise PN9 with 32-bit process memory dump  ANETMDA-DumpsExercise-PN9-Analysis-process-dump- LINQPadD-32.pdf © 2018 Software Diagnostics Services
  • 31. Exercise PN11  Goal: Learn how to recognize and analyze heap corruption  Patterns: Invalid Pointer; Regular Data; Managed Heap Corruption  Commands: .formats, !VerifyHeap  ANETMDA-DumpsExercise-PN11-Analysis-process-dump- LINQPadE.pdf © 2018 Software Diagnostics Services
  • 32. Exercise PN12  Goal: Compare 64-bit process memory dump from exercise PN11 with 32-bit process memory dump  ANETMDA-DumpsExercise-PN12-Analysis-process-dump- LINQPadE-32.pdf © 2018 Software Diagnostics Services
  • 33. Pattern Links CLR Thread Deadlock Managed Code Exception Duplicate Extension Nested Exceptions Stack Trace Collection Mixed Exception Dynamic Memory Corruption Memory Leak Special Thread JIT Code Execution Residue Managed Stack Trace Handled Exception Multiple Exceptions Annotated Disassembly Version-Specific Extension Technology-Specific Subtrace Caller-n-Callee Wait Chain Hidden Exception Object Distribution Anomaly Incorrect Stack Trace Execution Residue NULL Pointer Handle Leak Exception Stack Trace Software Exception Platform-Specific Debugger Spiking Thread Hidden Exception Regular Data Coincidental Symbolic Information © 2018 Software Diagnostics Services CLR-related and managed Unmanaged user space
  • 34. SOS Checklist  CLR module and SOS extension versions (lmv and .chain)  Managed exceptions (~*e !pe -nested)  Managed threads (!Threads -special)  Managed stack traces (~*e !CLRStack)  Managed execution residue (~*e !DumpStackObjects)  Managed heap (!VerifyHeap, !DumpHeap -stat and !eeheap -gc)  GC handles (!GCHandles)  Finalizer queue (!FinalizeQueue)  Sync blocks (!syncblk) © 2018 Software Diagnostics Services
  • 35. Resources  WinDbg Help / WinDbg.org (quick links) / DumpAnalysis.org  C# 7.0 Pocket Reference  CLR via C#, Fourth Edition  Advanced .NET Debugging  Debugging Microsoft .NET 2.0 Applications  Shared Source CLI 2.0 Internals  Accelerated Windows Memory Dump Analysis, 4th edition  Memory Dump Analysis Anthology (Volumes 1 – 10) © 2018 Software Diagnostics Services
  • 36. Q&A Please send your feedback using the contact form on PatternDiagnostics.com © 2018 Software Diagnostics Services
  • 37. Thank you for attendance! © 2018 Software Diagnostics Services