SlideShare a Scribd company logo
Little Known
Native Debugging Tricks

            Ofek Shilon
 Director of Algorithms @ Sarin Technologies
       www.thetweaker.wordpress.com
VS Debugging Tricks
DISCLAIMER
VS AS AN INTERPRETER
Expression Evaluator
• Demo
• Scope
  – Watch, QuickWatch,
  – Immediate,
  – BP conditions, ‘when hit’
• Call Functions from the debugger!
Expression Evaluator
• Context Operator
  – Documentation is wrong.
  – Might require decorated names.
  – VS2010 blocked WIN-API, but eased usage of
    others.
  – VS11B supports the simpler syntax
     msvcr110d.dll!fabs(-8.0f)
Expression Evaluator
•   Thread context
•   Access insensitive
•   Blind to inlined functions
•   Things to try when evaluation fails:
    – Very explicit casting,
    – Explicit addresses.
Edit and Continue
• Demo
• Stale code
Edit and Continue
• Preparation: /ZI, /INCREMENTAL
Edit and Continue
• Limitations:
  – Inconsistent with /RELEASE, /OPT:REF, /OPT:ICF,
    /ORDER, /FORCE,
  – Does not invoke custom build steps,
  – Isn’t supported on attached processes,
  – Can’t change object layout,
  – Doesn’t regenerate IDL files,
  – Can’t change resource files,
  – Does not build static libs.
CLICK SAVERS
StepOver
• Demo
StepOver
• VC6: autoexp section [ExecutionControl]
• VC7: Reg key -
 HKCUSoftwareMicrosoftVisualStudio7.0NativeDEStepOver

• VC8:
 HKLMSoftwareMicrosoftVisualStudio8.0NativeDEStepOver

• VC10, VC11B:
 HKCUSoftwareMicrosoftVisualStudio10.0_ConfigNativeDEStepOver
 Dropped ‘=NoStepInto’ syntax
StepOver
• Warning!
  When 2 or more
  instances of VS
  are active, occasionally
  it would create and use
  a duplicate reg key



  … and all ’10.0_Config’ modifications would have no effect !
StepOver
• Credit: Andy Pennell
  http://blogs.msdn.com/b/andypennell/archive/2004/02/06/69004.aspx


• A request to make StepOver official:
  http://visualstudio.uservoice.com/forums/121579-visual-
  studio/suggestions/2668765-support-nostepinto-registry-mechanism
autoexp
• How’s the debugger ‘aware’ of STL containers?
• autoexp.dat
  – By default at
    %VS folder %Common7PackagesDebugger
autoexp
• Demo

• Specialized syntax for common containers:
  Array, List, Map, Tree.
• Re-parsed on every debugging session
• Extremely fragile, yet excellent investment
autoexp
• Status limbo:
autoexp
• Bypass file path via env var: _vcee_autoexp
• Bypass visualizer locally: xxx,!
• Bypass
  globally
  in
  Tools/Options:
autoexp
• Resources:
  – Avery Lee
    http://virtualdub.org/blog/pivot/entry.php?id=120
  – Stephan T. Lavavej BoostCon presentation
    http://filetolink.com/d/?h=a456fc7fd3d35644edcbe5e764d1ba63&t=1315076450&f=17ad36ef

  – My blog: complete MFC containers visualization, Matrix 2D
    visualization, and more
    www.thetweaker.wordpress.org
  – A request to make autoexp official:
    http://visualstudio.uservoice.com/forums/121579-visual-
    studio/suggestions/2056273-support-debug-visualizers-through-
    autoexp-dat
Sound Alerts
• Win7:
 Control Panel 
 Hardware and Sounds 
 Sound 
 Change system sounds
• WinXP:
 Control Panel 
 Sounds and Audio... 
 Program Events –
 Microsoft Developer
TRACING ERRORS
GetLastError Interactively
• GetLastError implementation:



•   (int*)($fs)+0x34
•   (int*)($tib)+0x34
•   $err !
•   Credit: msdn
    http://msdn.microsoft.com/en-us/library/dtw169z6.aspx
Extensions
• Customizing ‘,hr’ display in autoexp.dat:




• Other TEB data: (_TEB*)$tib
Breaking on Errors
• BP location: (int*)($tib)+0x34
• Specific error: BP condition
  – Slooooooooow
• g_dwLastErrorToBreakOn !
  – (int*){,,ntdll.dll}_g_dwLastErrorToBreakOn
  – Fails in VC10 over Win7. Restored in VC11B
• Credit: Daniel Pearson,
  http://blogs.msdn.com/b/danpear/archive/2007/04/06/2033100.aspx
INVESTIGATING CODE
Breaking on all class methods
• Break at function:
           Class::*

• Credit: Habib Heydarian
 http://blogs.msdn.com/b/habibh/archive/2009/09/10/class-breakpoint-
 how-to-set-a-breakpoint-on-a-c-class-in-the-visual-studio-debugger.aspx
Naming Native Threads
• Demo

• ‘Documented hack’
  Credit: MSDN
 http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
Breaking on Data Read
• Some code required.
• Links to 4 implementations:
  http://thetweaker.wordpress.com/2011/05/22/breaking-on-data-read/


• Request to make it official:
  http://visualstudio.uservoice.com/forums/121579-visual-
  studio/suggestions/2668700-expose-break-on-read-breakpoints
Static Object Layout
• /d1reportSingleClassLayout
• /d1reportAllClassLayout


• Credit: Andy Rich
  http://blogs.msdn.com/b/vcblog/archive/2007/05/17/diagnosing-hidden-
  odr-violations-in-visual-c-and-fixing-lnk2022.aspx
ENHANCED DIAGNOSIS
Useful Pseudo-registers
• $tid
  -> very useful as a BP condition.
• $env=0
  -> view debugee environment variables
  – In VC11: just $env in watch
• $cmdline = 0
  -> view launching command line
  Credit: John Cunningham,
  http://blogs.msdn.com/b/ms_joc/archive/2004/08/23/218912.aspx
Useful Pseudo-registers
• $handles
  -> narrows down handle leaks
• $clk
  -> rough profiling
• $user
  -> view permissions info

• Credits: Steve Steiner, Gregg Miskelly, et. al.
  http://blogs.msdn.com/b/stevejs/
  http://blogs.msdn.com/b/greggm/
Searching Through Memory




• Credit: msdn
 http://msdn.microsoft.com/en-us/library/ms171363.aspx
www.thetweaker.wordpress.com
ofekshilon@gmail.com
                           THANK YOU.

More Related Content

What's hot (20)

ODP
Os Cook
oscon2007
 
PDF
Экспресс-анализ вредоносов / Crowdsourced Malware Triage
Positive Hack Days
 
PPTX
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Peter Hlavaty
 
PPTX
Power of linked list
Peter Hlavaty
 
PPTX
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
Peter Hlavaty
 
PPTX
Racing with Droids
Peter Hlavaty
 
PDF
syzkaller: the next gen kernel fuzzer
Dmitry Vyukov
 
PDF
How to Root 10 Million Phones with One Exploit
Jiahong Fang
 
PDF
TriplePlay-WebAppPenTestingTools
Yury Chemerkin
 
PDF
Modern Evasion Techniques
Jason Lang
 
PDF
syzbot and the tale of million kernel bugs
Dmitry Vyukov
 
PDF
Nikto
Sorina Chirilă
 
PDF
JavaCro'15 - Conquer the Internet of Things with Java and Docker - Johan Jans...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PDF
Multiply your Testing Effectiveness with Parameterized Testing, v1
Brian Okken
 
PPTX
How Safe is your Link ?
Peter Hlavaty
 
PPTX
Guardians of your CODE
Peter Hlavaty
 
PDF
Статический анализ кода в контексте SSDL
Positive Hack Days
 
PDF
When is something overflowing
Peter Hlavaty
 
PPTX
Security research over Windows #defcon china
Peter Hlavaty
 
Os Cook
oscon2007
 
Экспресс-анализ вредоносов / Crowdsourced Malware Triage
Positive Hack Days
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Peter Hlavaty
 
Power of linked list
Peter Hlavaty
 
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
Peter Hlavaty
 
Racing with Droids
Peter Hlavaty
 
syzkaller: the next gen kernel fuzzer
Dmitry Vyukov
 
How to Root 10 Million Phones with One Exploit
Jiahong Fang
 
TriplePlay-WebAppPenTestingTools
Yury Chemerkin
 
Modern Evasion Techniques
Jason Lang
 
syzbot and the tale of million kernel bugs
Dmitry Vyukov
 
JavaCro'15 - Conquer the Internet of Things with Java and Docker - Johan Jans...
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Multiply your Testing Effectiveness with Parameterized Testing, v1
Brian Okken
 
How Safe is your Link ?
Peter Hlavaty
 
Guardians of your CODE
Peter Hlavaty
 
Статический анализ кода в контексте SSDL
Positive Hack Days
 
When is something overflowing
Peter Hlavaty
 
Security research over Windows #defcon china
Peter Hlavaty
 

Similar to VS Debugging Tricks (20)

PPT
Little Known VC++ Debugging Tricks
Ofek Shilon
 
PDF
Beyond Breakpoints: A Tour of Dynamic Analysis
C4Media
 
PPT
.NET Debugging Tips and Techniques
Bala Subra
 
PPT
.Net Debugging Techniques
Bala Subra
 
PPTX
Case Study of the Unexplained
shannomc
 
PPTX
C++ and Assembly: Debugging and Reverse Engineering
corehard_by
 
PPTX
PVS-Studio, a solution for resource intensive applications development
OOO "Program Verification Systems"
 
PPTX
44CON London 2015 - How to drive a malware analyst crazy
44CON
 
PPTX
How to drive a malware analyst crazy
Michael Boman
 
PPTX
Debugging application using visual studio 2010 and intellitrace
Abhimanyu Singhal
 
PDF
CNIT 126: 8: Debugging
Sam Bowne
 
PDF
Binary art - Byte-ing the PE that fails you (extended offline version)
Ange Albertini
 
PPTX
Windows Debugging with WinDbg
Arno Huetter
 
PDF
CNIT 126 8: Debugging
Sam Bowne
 
PDF
CNIT 127 Ch Ch 1: Before you Begin
Sam Bowne
 
PDF
Practical Malware Analysis: Ch 8: Debugging
Sam Bowne
 
PDF
CNIT 127 Ch 1: Before you Begin
Sam Bowne
 
PDF
Basic buffer overflow part1
Payampardaz
 
PDF
PPU Optimisation Lesson
slantsixgames
 
Little Known VC++ Debugging Tricks
Ofek Shilon
 
Beyond Breakpoints: A Tour of Dynamic Analysis
C4Media
 
.NET Debugging Tips and Techniques
Bala Subra
 
.Net Debugging Techniques
Bala Subra
 
Case Study of the Unexplained
shannomc
 
C++ and Assembly: Debugging and Reverse Engineering
corehard_by
 
PVS-Studio, a solution for resource intensive applications development
OOO "Program Verification Systems"
 
44CON London 2015 - How to drive a malware analyst crazy
44CON
 
How to drive a malware analyst crazy
Michael Boman
 
Debugging application using visual studio 2010 and intellitrace
Abhimanyu Singhal
 
CNIT 126: 8: Debugging
Sam Bowne
 
Binary art - Byte-ing the PE that fails you (extended offline version)
Ange Albertini
 
Windows Debugging with WinDbg
Arno Huetter
 
CNIT 126 8: Debugging
Sam Bowne
 
CNIT 127 Ch Ch 1: Before you Begin
Sam Bowne
 
Practical Malware Analysis: Ch 8: Debugging
Sam Bowne
 
CNIT 127 Ch 1: Before you Begin
Sam Bowne
 
Basic buffer overflow part1
Payampardaz
 
PPU Optimisation Lesson
slantsixgames
 
Ad

More from Sasha Goldshtein (20)

PPTX
Modern Linux Tracing Landscape
Sasha Goldshtein
 
PPTX
The Next Linux Superpower: eBPF Primer
Sasha Goldshtein
 
PPTX
Staring into the eBPF Abyss
Sasha Goldshtein
 
PPTX
Visual Studio 2015 and the Next .NET Framework
Sasha Goldshtein
 
PPT
Swift: Apple's New Programming Language for iOS and OS X
Sasha Goldshtein
 
PPT
C# Everywhere: Cross-Platform Mobile Apps with Xamarin
Sasha Goldshtein
 
PPT
Modern Backends for Mobile Apps
Sasha Goldshtein
 
PPT
Performance and Debugging with the Diagnostics Hub in Visual Studio 2013
Sasha Goldshtein
 
PPT
Mastering IntelliTrace in Development and Production
Sasha Goldshtein
 
PPTX
Introduction to RavenDB
Sasha Goldshtein
 
PPTX
State of the Platforms
Sasha Goldshtein
 
PPTX
Delivering Millions of Push Notifications in Minutes
Sasha Goldshtein
 
PPTX
Building Mobile Apps with a Mobile Services .NET Backend
Sasha Goldshtein
 
PPTX
Building iOS and Android Apps with Mobile Services
Sasha Goldshtein
 
PPT
Task and Data Parallelism
Sasha Goldshtein
 
PPT
What's New in C++ 11?
Sasha Goldshtein
 
PDF
Attacking Web Applications
Sasha Goldshtein
 
PPTX
Windows Azure Mobile Services
Sasha Goldshtein
 
PPTX
First Steps in Android Development
Sasha Goldshtein
 
PPTX
First Steps in iOS Development
Sasha Goldshtein
 
Modern Linux Tracing Landscape
Sasha Goldshtein
 
The Next Linux Superpower: eBPF Primer
Sasha Goldshtein
 
Staring into the eBPF Abyss
Sasha Goldshtein
 
Visual Studio 2015 and the Next .NET Framework
Sasha Goldshtein
 
Swift: Apple's New Programming Language for iOS and OS X
Sasha Goldshtein
 
C# Everywhere: Cross-Platform Mobile Apps with Xamarin
Sasha Goldshtein
 
Modern Backends for Mobile Apps
Sasha Goldshtein
 
Performance and Debugging with the Diagnostics Hub in Visual Studio 2013
Sasha Goldshtein
 
Mastering IntelliTrace in Development and Production
Sasha Goldshtein
 
Introduction to RavenDB
Sasha Goldshtein
 
State of the Platforms
Sasha Goldshtein
 
Delivering Millions of Push Notifications in Minutes
Sasha Goldshtein
 
Building Mobile Apps with a Mobile Services .NET Backend
Sasha Goldshtein
 
Building iOS and Android Apps with Mobile Services
Sasha Goldshtein
 
Task and Data Parallelism
Sasha Goldshtein
 
What's New in C++ 11?
Sasha Goldshtein
 
Attacking Web Applications
Sasha Goldshtein
 
Windows Azure Mobile Services
Sasha Goldshtein
 
First Steps in Android Development
Sasha Goldshtein
 
First Steps in iOS Development
Sasha Goldshtein
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
July Patch Tuesday
Ivanti
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 

VS Debugging Tricks

  • 1. Little Known Native Debugging Tricks Ofek Shilon Director of Algorithms @ Sarin Technologies www.thetweaker.wordpress.com
  • 4. VS AS AN INTERPRETER
  • 5. Expression Evaluator • Demo • Scope – Watch, QuickWatch, – Immediate, – BP conditions, ‘when hit’ • Call Functions from the debugger!
  • 6. Expression Evaluator • Context Operator – Documentation is wrong. – Might require decorated names. – VS2010 blocked WIN-API, but eased usage of others. – VS11B supports the simpler syntax msvcr110d.dll!fabs(-8.0f)
  • 7. Expression Evaluator • Thread context • Access insensitive • Blind to inlined functions • Things to try when evaluation fails: – Very explicit casting, – Explicit addresses.
  • 8. Edit and Continue • Demo • Stale code
  • 9. Edit and Continue • Preparation: /ZI, /INCREMENTAL
  • 10. Edit and Continue • Limitations: – Inconsistent with /RELEASE, /OPT:REF, /OPT:ICF, /ORDER, /FORCE, – Does not invoke custom build steps, – Isn’t supported on attached processes, – Can’t change object layout, – Doesn’t regenerate IDL files, – Can’t change resource files, – Does not build static libs.
  • 13. StepOver • VC6: autoexp section [ExecutionControl] • VC7: Reg key - HKCUSoftwareMicrosoftVisualStudio7.0NativeDEStepOver • VC8: HKLMSoftwareMicrosoftVisualStudio8.0NativeDEStepOver • VC10, VC11B: HKCUSoftwareMicrosoftVisualStudio10.0_ConfigNativeDEStepOver Dropped ‘=NoStepInto’ syntax
  • 14. StepOver • Warning! When 2 or more instances of VS are active, occasionally it would create and use a duplicate reg key … and all ’10.0_Config’ modifications would have no effect !
  • 15. StepOver • Credit: Andy Pennell http://blogs.msdn.com/b/andypennell/archive/2004/02/06/69004.aspx • A request to make StepOver official: http://visualstudio.uservoice.com/forums/121579-visual- studio/suggestions/2668765-support-nostepinto-registry-mechanism
  • 16. autoexp • How’s the debugger ‘aware’ of STL containers? • autoexp.dat – By default at %VS folder %Common7PackagesDebugger
  • 17. autoexp • Demo • Specialized syntax for common containers: Array, List, Map, Tree. • Re-parsed on every debugging session • Extremely fragile, yet excellent investment
  • 19. autoexp • Bypass file path via env var: _vcee_autoexp • Bypass visualizer locally: xxx,! • Bypass globally in Tools/Options:
  • 20. autoexp • Resources: – Avery Lee http://virtualdub.org/blog/pivot/entry.php?id=120 – Stephan T. Lavavej BoostCon presentation http://filetolink.com/d/?h=a456fc7fd3d35644edcbe5e764d1ba63&t=1315076450&f=17ad36ef – My blog: complete MFC containers visualization, Matrix 2D visualization, and more www.thetweaker.wordpress.org – A request to make autoexp official: http://visualstudio.uservoice.com/forums/121579-visual- studio/suggestions/2056273-support-debug-visualizers-through- autoexp-dat
  • 21. Sound Alerts • Win7: Control Panel Hardware and Sounds Sound Change system sounds • WinXP: Control Panel Sounds and Audio... Program Events – Microsoft Developer
  • 23. GetLastError Interactively • GetLastError implementation: • (int*)($fs)+0x34 • (int*)($tib)+0x34 • $err ! • Credit: msdn http://msdn.microsoft.com/en-us/library/dtw169z6.aspx
  • 24. Extensions • Customizing ‘,hr’ display in autoexp.dat: • Other TEB data: (_TEB*)$tib
  • 25. Breaking on Errors • BP location: (int*)($tib)+0x34 • Specific error: BP condition – Slooooooooow • g_dwLastErrorToBreakOn ! – (int*){,,ntdll.dll}_g_dwLastErrorToBreakOn – Fails in VC10 over Win7. Restored in VC11B • Credit: Daniel Pearson, http://blogs.msdn.com/b/danpear/archive/2007/04/06/2033100.aspx
  • 27. Breaking on all class methods • Break at function: Class::* • Credit: Habib Heydarian http://blogs.msdn.com/b/habibh/archive/2009/09/10/class-breakpoint- how-to-set-a-breakpoint-on-a-c-class-in-the-visual-studio-debugger.aspx
  • 28. Naming Native Threads • Demo • ‘Documented hack’ Credit: MSDN http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
  • 29. Breaking on Data Read • Some code required. • Links to 4 implementations: http://thetweaker.wordpress.com/2011/05/22/breaking-on-data-read/ • Request to make it official: http://visualstudio.uservoice.com/forums/121579-visual- studio/suggestions/2668700-expose-break-on-read-breakpoints
  • 30. Static Object Layout • /d1reportSingleClassLayout • /d1reportAllClassLayout • Credit: Andy Rich http://blogs.msdn.com/b/vcblog/archive/2007/05/17/diagnosing-hidden- odr-violations-in-visual-c-and-fixing-lnk2022.aspx
  • 32. Useful Pseudo-registers • $tid -> very useful as a BP condition. • $env=0 -> view debugee environment variables – In VC11: just $env in watch • $cmdline = 0 -> view launching command line Credit: John Cunningham, http://blogs.msdn.com/b/ms_joc/archive/2004/08/23/218912.aspx
  • 33. Useful Pseudo-registers • $handles -> narrows down handle leaks • $clk -> rough profiling • $user -> view permissions info • Credits: Steve Steiner, Gregg Miskelly, et. al. http://blogs.msdn.com/b/stevejs/ http://blogs.msdn.com/b/greggm/
  • 34. Searching Through Memory • Credit: msdn http://msdn.microsoft.com/en-us/library/ms171363.aspx

Editor's Notes

  • #3: C++התחלות שלא הבשילו בזמןמקור עיקרי – בלוגים של מפתחי VSדברים מאד שימושיים – לחלק שמתי בקשות להפוך לפיצ'רים רשמייםVS2010 / VS2011B
  • #5: Many people think that editing variables is the most they can intervene with the debugeeEdit variables, move execution around
  • #7: אינליין – רלבנטי בRELEASE
  • #9: Break *before* code change, greatly reduces the chance of stale codeUse directX sample!
  • #10: Incremental linking: pads functions code, contains jump thunks to handle function relocationInconsistent with /OPT:REF, /OPT:ICF, /ORDER, /RELEASE, /FORCESome changes are too great, full linking occurs.All options are on by default in debug
  • #14: 2005: for all users
  • #18: comment std::vector רפרוף בסיסי על הסינטקס, רפרנסים טובים בסוףInsert carray childrenCarray previewVect3d preview
  • #20: טוב גם לבדוק שם אם נדמה שלא פועל
  • #21: כשיודעים מה לחפש – מוצאים המון
  • #22: לא מוחבא ברג'יסטרי, יש UI, אבל במקום ממש לא סביר ורחוק מאד מVS עצמוהועף ב2005, הוחזר ב2008 לקול מחאות הציבור
  • #24: Code: ::DeleteFile, GetLastError$fs fakes it...(int*)($fs)+0x18(int*)($tib)+0x34$errFormatting strings:12.3412.34,g$err,hr(_TEB*)$tib
  • #25: HRESULT customization doesn’t even require debugger restart!!_TEB is not defined publically, but the debugger is aware of it. Contains much useful data for advanced scenarios (fiber-specific data, etc)
  • #28: Doesn’t work for templated classes/methodsDoesn’t extend to wildcards/regexGood way to find entry points
  • #29: No ‘name’ slot in TEB
  • #30: Write-to BPs are implemented in hardware – dedicated x86 debug registers.Read-from debugs registers are available too, but were never exposed in VS.Some code required Maybe historical portability constraints? Dunno4 very similar implementations
  • #31: Not investigating code *flow* - static feature.After /d1reportSingleClassLayout, type immediatelly your classTest: /d1reportSingleClassLayoutCDialog . show vftable, alignment, adjustorsDebug ODR violationsOptimize storageGain deep insightSince VS2010, collides with /showIncludes (?)Watch out for PCH – if your class definition isn’t compiled, its layout won’t be shown
  • #33: $cmdline credit: John Cunningham, http://blogs.msdn.com/b/ms_joc/archive/2004/08/23/218912.aspx$env=0 no longer works in VS2010
  • #35: Demo – on envvars.S -U 0x006fdad0 60 "ALLUSERSPROFILE"שימושי בדיבוג של דמפים מלאים