SlideShare a Scribd company logo
Sainath  BT Frontline  [email_address]   MVP – Active Directory Microsoft Technet Moderator – Win2k8 , Networking Microsoft Technet Magazine – Author Microsoft Speaker – SWUG
Windows Debugging
Basic Terms Process  Thread  User mode  Kernel mode  Call stack  Register  Exception
Basic Terms IRQL  Interrupt  Free Build Check Build Paging Non paged pool Paged pool
Basic Terms Complete Memory Dump  HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\CrashControl CrashDumpEnabled REG_DWORD 0x0 = None CrashDumpEnabled REG_DWORD 0x1 = Complete memory dump CrashDumpEnabled REG_DWORD 0x2 = Kernel memory dump CrashDumpEnabled REG_DWORD 0x3 = Small memory dump (64KB)
ASK A QUESTION TO PROCEED  
Debugger Installation Setup Http://www.microsoft.com/ddk/debugging Symbol file  public symbols – global variables, FPO private symbols – local symbol, global var
Debugger Setup  Problem with Symbol File  ERROR: Symbol file could not be found. Defaulted to export symbols for <xxx.exe>   Solution  Check for the symbol file path  Use .reload command
AdPlus Tool User mode debugging tool  Produces memory dumps of an application and processes -notify switch notifies user using live messenger You Cannot  Debug startup applications  Programs generating lot of debug information
AdPlus Tool Adplus Modes  Hang Mode Crash Mode  First chance exception  second chance exception
AdPlus Tool Command Line Switches  Adplus –help Adplus –hang Adplus –crash Adplus –pn Adplus –iis
AdPlus Tool Demo 1  Adplus hang dump  Adplus crah dump  Configuring symbols  Dumping process Analyzing dump
Understanding Assembly c pgm   void main() { int x =10; int y = 20; x= 30;  y = 40 ;  Printf(&quot;value of x is %d \n&quot;, x);  }
Understanding Assembly Important Note :  CPU registers and Variables are different in assembly but serve similar purpose 12 Major CPU registers  AX, BX, CX, DX, SI, DI, CS , IP etc.. Declaring variables  : X dw 10; Y dw 20 ;
Understanding Assembly Assembly  Mov [x], 10  Mov [y], 20 Windbg  Mov dword ptr [ saiprj!x (0a003456) ], 10
Assembly Continued Writing data to registers  Mov eax, 15  Mov eax, [x] Windbg  mov eax, [saipgm!x (a0302934)]
Assembly Continued C program Int b = 10; Int a = 20 ;  B = b+a ;  Assembly  mov eax , b Add [a], eax Windbg  Mov eax, [saipgm!b ( a0308923)] Add [saipgm!a (02342343)], eax
Assembly Continued Mov [x], 1 Mov [y], 1  Mov eax, [x] Add [b], eax  Inc eax  What is the output ???
Registers  Registers are small storage units generally 32 or 64bit wide Registers are always accessed using names  Wrong data in the registers are source of bug  R command to display registers
Registers Deep Dive EAX = contains return values  EBX  ECX = contains loop counter info EDX  EIP = points to next instruction to be executed ESP = Stack pointer , points to top of stack.
Registers Deep Dive  EBP = Base pointer / Stack Frame Pointer EBP will be set before function is called
Reading Memory Variable Types  Local variables Global variables Strings Unicode  Arrays  constants.
Reading Memory D DD – display memory 32 bits Dw – display as words ( 16 bits )  DT – display type  Example: Eg: dt nt!<function name> dt yourexe!<function name>
Stacks Program 1  function 1  function 2  program 2  calling function 1  (assigns stack )  return  ( clears stack )  calling function 2
Stacks Continued Every thread has 2 stacks  User Mode 1 MB Kernel Mode 12 KB  When ever a function is called you see a return instruction.
Deep Dive Stacks. Dd esp  0012fe6c  004113e0 00000005 0000000a 0127f558 0012fe7c  007dca76 7ffd8000 cccccccc cccccccc 004113e0 = return address  00000005 = argument 1  0000000a = argument 2
Questions Please  

More Related Content

PDF
Make A Shoot ‘Em Up Game with Amethyst Framework
PDF
Introduction to nand2 tetris
PDF
Gameboy emulator in rust and web assembly
PDF
GLX, DRI, and i965
PDF
OSTEP Chapter2 Introduction
PDF
Linux fundamental - Chap 00 shell
PDF
Building Network Functions with eBPF & BCC
PDF
Java JVM Memory Cheat Sheet
Make A Shoot ‘Em Up Game with Amethyst Framework
Introduction to nand2 tetris
Gameboy emulator in rust and web assembly
GLX, DRI, and i965
OSTEP Chapter2 Introduction
Linux fundamental - Chap 00 shell
Building Network Functions with eBPF & BCC
Java JVM Memory Cheat Sheet

What's hot (20)

PPTX
Mysql5.1 character set testing
PDF
Timur Shemsedinov "Пишу на колбеках, а что... (Асинхронное программирование)"
PPTX
Compare mysql5.1.50 mysql5.5.8
PPTX
Mysql handle socket
PDF
37562259 top-consuming-process
PDF
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
PDF
App secforum2014 andrivet-cplusplus11-metaprogramming_applied_to_software_obf...
PPTX
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
PDF
Preparation for mit ose lab4
ODP
Java 7 new features
PPTX
Making a Process (Virtualizing Memory)
DOC
100 comment win xp
PDF
ch6-pv2-device-drivers
PDF
Linux fundamental - Chap 05 filter
PPTX
System Calls
PPTX
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle Games
PDF
Taipei.py 2018 - Control device via ioctl from Python
PDF
A CTF Hackers Toolbox
PDF
Tracer Evaluation
PPTX
MongoDB 2.8 Replication Internals: Fitting it all together
Mysql5.1 character set testing
Timur Shemsedinov "Пишу на колбеках, а что... (Асинхронное программирование)"
Compare mysql5.1.50 mysql5.5.8
Mysql handle socket
37562259 top-consuming-process
Yurii Shevtsov "V8 + libuv = Node.js. Under the hood"
App secforum2014 andrivet-cplusplus11-metaprogramming_applied_to_software_obf...
Segmentation Faults, Page Faults, Processes, Threads, and Tasks
Preparation for mit ose lab4
Java 7 new features
Making a Process (Virtualizing Memory)
100 comment win xp
ch6-pv2-device-drivers
Linux fundamental - Chap 05 filter
System Calls
We Love Performance! How Tic Toc Games Uses ECS in Mobile Puzzle Games
Taipei.py 2018 - Control device via ioctl from Python
A CTF Hackers Toolbox
Tracer Evaluation
MongoDB 2.8 Replication Internals: Fitting it all together
Ad

Viewers also liked (20)

PDF
PDF
Culinaria para uma boa saude
PPSX
Bronk ppshow
PPT
Lu isfer
DOC
Rajeev_CV
PPTX
New microsoft office power point presentation
PDF
5 Steps to Secure Google Drive
PPTX
19 Luglio 2013 - Il futuro della TV - Marco Cantamessa - I3P
PPT
PDF
Powerbreathe - Final Presentation
PDF
Svea piemonte regional_analysis_report
PDF
Event driven actors - lessons learned
PPTX
Marketing On The Internet
PPT
Radisson Hotel Whittier Feb2010 Powerpoints
PDF
e-Commerce are you there?
PDF
Csp@scuola uav corso1_lez2
PDF
The Wizards Behind Google Apps: 11 Google Apps Setup Tips for Admins by Admins
Culinaria para uma boa saude
Bronk ppshow
Lu isfer
Rajeev_CV
New microsoft office power point presentation
5 Steps to Secure Google Drive
19 Luglio 2013 - Il futuro della TV - Marco Cantamessa - I3P
Powerbreathe - Final Presentation
Svea piemonte regional_analysis_report
Event driven actors - lessons learned
Marketing On The Internet
Radisson Hotel Whittier Feb2010 Powerpoints
e-Commerce are you there?
Csp@scuola uav corso1_lez2
The Wizards Behind Google Apps: 11 Google Apps Setup Tips for Admins by Admins
Ad

Similar to Swug July 2010 - windows debugging by sainath (20)

PDF
CNIT 127 Ch 1: Before you Begin
PDF
CNIT 126 4: A Crash Course in x86 Disassembly
PDF
CNIT 127 Ch Ch 1: Before you Begin
PPTX
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
PDF
Debugger Principle Overview & GDB Tricks
PPTX
Driver Debugging Basics
PPTX
amr_systemsdadwdsdasdsadsadsaaddsdw.pptx
PDF
N_Asm Assembly macros (sol)
PDF
Assembly level language
PPT
Advanced driver debugging (13005399) copy
PPTX
Reversing malware analysis training part4 assembly programming basics
PDF
X86 assembly & GDB
PDF
Mp lab manual
PPTX
Coal (1)
PPTX
Introduction to debugging linux applications
PDF
CNIT 126: 10: Kernel Debugging with WinDbg
PPT
Assembler
PDF
Debug tutorial
PPTX
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
PPT
Malware Analysis - x86 Disassembly
CNIT 127 Ch 1: Before you Begin
CNIT 126 4: A Crash Course in x86 Disassembly
CNIT 127 Ch Ch 1: Before you Begin
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
Debugger Principle Overview & GDB Tricks
Driver Debugging Basics
amr_systemsdadwdsdasdsadsadsaaddsdw.pptx
N_Asm Assembly macros (sol)
Assembly level language
Advanced driver debugging (13005399) copy
Reversing malware analysis training part4 assembly programming basics
X86 assembly & GDB
Mp lab manual
Coal (1)
Introduction to debugging linux applications
CNIT 126: 10: Kernel Debugging with WinDbg
Assembler
Debug tutorial
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
Malware Analysis - x86 Disassembly

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Approach and Philosophy of On baking technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Electronic commerce courselecture one. Pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectral efficient network and resource selection model in 5G networks
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Review of recent advances in non-invasive hemoglobin estimation
Approach and Philosophy of On baking technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Understanding_Digital_Forensics_Presentation.pptx
Network Security Unit 5.pdf for BCA BBA.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
cuic standard and advanced reporting.pdf
Unlocking AI with Model Context Protocol (MCP)
Electronic commerce courselecture one. Pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Swug July 2010 - windows debugging by sainath

  • 1. Sainath BT Frontline [email_address] MVP – Active Directory Microsoft Technet Moderator – Win2k8 , Networking Microsoft Technet Magazine – Author Microsoft Speaker – SWUG
  • 3. Basic Terms Process Thread User mode Kernel mode Call stack Register Exception
  • 4. Basic Terms IRQL Interrupt Free Build Check Build Paging Non paged pool Paged pool
  • 5. Basic Terms Complete Memory Dump HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\CrashControl CrashDumpEnabled REG_DWORD 0x0 = None CrashDumpEnabled REG_DWORD 0x1 = Complete memory dump CrashDumpEnabled REG_DWORD 0x2 = Kernel memory dump CrashDumpEnabled REG_DWORD 0x3 = Small memory dump (64KB)
  • 6. ASK A QUESTION TO PROCEED 
  • 7. Debugger Installation Setup Http://www.microsoft.com/ddk/debugging Symbol file public symbols – global variables, FPO private symbols – local symbol, global var
  • 8. Debugger Setup Problem with Symbol File ERROR: Symbol file could not be found. Defaulted to export symbols for <xxx.exe> Solution Check for the symbol file path Use .reload command
  • 9. AdPlus Tool User mode debugging tool Produces memory dumps of an application and processes -notify switch notifies user using live messenger You Cannot Debug startup applications Programs generating lot of debug information
  • 10. AdPlus Tool Adplus Modes Hang Mode Crash Mode First chance exception second chance exception
  • 11. AdPlus Tool Command Line Switches Adplus –help Adplus –hang Adplus –crash Adplus –pn Adplus –iis
  • 12. AdPlus Tool Demo 1 Adplus hang dump Adplus crah dump Configuring symbols Dumping process Analyzing dump
  • 13. Understanding Assembly c pgm void main() { int x =10; int y = 20; x= 30; y = 40 ; Printf(&quot;value of x is %d \n&quot;, x); }
  • 14. Understanding Assembly Important Note : CPU registers and Variables are different in assembly but serve similar purpose 12 Major CPU registers AX, BX, CX, DX, SI, DI, CS , IP etc.. Declaring variables : X dw 10; Y dw 20 ;
  • 15. Understanding Assembly Assembly Mov [x], 10 Mov [y], 20 Windbg Mov dword ptr [ saiprj!x (0a003456) ], 10
  • 16. Assembly Continued Writing data to registers Mov eax, 15 Mov eax, [x] Windbg mov eax, [saipgm!x (a0302934)]
  • 17. Assembly Continued C program Int b = 10; Int a = 20 ; B = b+a ; Assembly mov eax , b Add [a], eax Windbg Mov eax, [saipgm!b ( a0308923)] Add [saipgm!a (02342343)], eax
  • 18. Assembly Continued Mov [x], 1 Mov [y], 1 Mov eax, [x] Add [b], eax Inc eax What is the output ???
  • 19. Registers Registers are small storage units generally 32 or 64bit wide Registers are always accessed using names Wrong data in the registers are source of bug R command to display registers
  • 20. Registers Deep Dive EAX = contains return values EBX ECX = contains loop counter info EDX EIP = points to next instruction to be executed ESP = Stack pointer , points to top of stack.
  • 21. Registers Deep Dive EBP = Base pointer / Stack Frame Pointer EBP will be set before function is called
  • 22. Reading Memory Variable Types Local variables Global variables Strings Unicode Arrays constants.
  • 23. Reading Memory D DD – display memory 32 bits Dw – display as words ( 16 bits ) DT – display type Example: Eg: dt nt!<function name> dt yourexe!<function name>
  • 24. Stacks Program 1 function 1 function 2 program 2 calling function 1 (assigns stack ) return ( clears stack ) calling function 2
  • 25. Stacks Continued Every thread has 2 stacks User Mode 1 MB Kernel Mode 12 KB When ever a function is called you see a return instruction.
  • 26. Deep Dive Stacks. Dd esp 0012fe6c 004113e0 00000005 0000000a 0127f558 0012fe7c 007dca76 7ffd8000 cccccccc cccccccc 004113e0 = return address 00000005 = argument 1 0000000a = argument 2