John Cunningham Development Manager Microsoft DTL323 Overview Tips and tricks in the following areas: Execution Control Breakpoints Symbols Multi-threaded Debugging Postmortem Debugging Data Viewing Behind the Debugger Magic.

Download Report

Transcript John Cunningham Development Manager Microsoft DTL323 Overview Tips and tricks in the following areas: Execution Control Breakpoints Symbols Multi-threaded Debugging Postmortem Debugging Data Viewing Behind the Debugger Magic.

John Cunningham
Development Manager
Microsoft
DTL323
Overview
Tips and tricks in the following areas:
Execution Control
Breakpoints
Symbols
Multi-threaded Debugging
Postmortem Debugging
Data Viewing
Behind the Debugger Magic
VS Debugger Overview
Debugs many different code environments
Native Windows
X86
X64
IA64
Managed code
Windows (32bit and 64bit)
SQLCLR
Script
T-SQL
Native device programs
And many, many more…
VS Debugger Architecture
VSDebug
Package
SDM
CPDE
(Managed)
NatDbgDE
(Native)
Your Engine
Here
Your EE Here
See resources at the end for more info on extending and customizing
Overview
Tips and tricks in the following areas:
 Execution control
Breakpoints
Symbols
Multi-threaded Debugging
Postmortem Debugging
Data Viewing
Execution Control
NEW
SP1
Step Filtering for Managed
Adds support for automatically stepping over
simple properties
Right click to “step into specific” pick step
into target
Step Filtering
How it Works: Step Filtering
Step in as normal
If (stepcomplete outside of targetrange)
{
complete as a step over
}
Else If (step completed as a stepin)
{
If (current location is property ||
current location is operator)
{
Step out and try another stepin
}
}
How it Works: Step into Specific
Disassemble instruction range for line
Populate drop down with targets
User selects specific call
If (stepcomplete outside of targetrange)
{
complete as a step over
}
Else If (step completed as a stepin)
{
If (currentframe return !=
target call location)
{
Step out and try step in again
}
}
Overview
Tips and tricks in the following areas:
Execution Control
 Breakpoints
Symbols
Multi-threaded Debugging
Postmortem Debugging
Data Viewing
Tracepoints
Tracepoints
Print a variety of program state types
without stopping
Program location, including stack
Expressions (including @clk in native
for quick timing)
Thread info
<Your message here>
Run a macro
Useful to stop on a certain condition that is difficult to
express as a “watch window” expression
(for example, “Stop if this method is in the callstack”)
Tracepoints
Overview
Tips and tricks in the following areas:
Execution Control
Breakpoints
 Symbols
Multi-threaded Debugging
Postmortem Debugging
Data Viewing
Symbols
You’ve got to
hold them
squeeze them
never *EVER* ship without archiving them
Ensure symbols are switched
on in final/retail/optimized builds
Archive symbols using symbol server
Setting Up and Using a Symbol Server
Download windows debugging tools
Get a file server with a big hard disk 
Build daily build
Use SYMSTORE to push binaries and PDBs to
fileshare e.g.:
SYMSTORE add /r /f c:\BUILTFILES\*.* /s
\\MYSERVER\SYMBOLSHARE /t “Application” /v
“BuildVersion3”
Point Visual Studio to that share and set a local
cache
Symbol Paths
Symbols
NEW
SP1
Reference Source Support
Symbols
NEW
SP1
Reference Source Support
Symbol Loading Internals
VS Never loads mismatched symbols
Never. Never, ever.
Path plan is
where the exe thinks it is
on the path we create from the symbols dialog
on the path at HKLM/HKCU
Software\Microsoft\VisualStudio\MSPDB\SymbolSearchPath
on the path at any of these
_NT_ALT_SYMBOL_PATH
_NT_SYMBOL_PATH
SystemRoot
Use Right Click on Module -> “Symbol Load
Information…” to find out where we looked
Overview
Tips and tricks in the following areas:
Execution Control
Breakpoints
Symbols
 Multi-threaded Debugging
Postmortem Debugging
Data Viewing
Threads
NEW
Flagging
Thread Categories and
Threads
Threads
Using Breakpoint Filters
Right-click on breakpoint, select Filter…
Freezing and Thawing
Right-click on thread, select
Stack Tips and Thread Flags
Naming Threads
Managed – Thread.Name
Native – Use the SetThreadName
exception wrapper
See resources at end of deck…
Overview
Tips and tricks in the following areas:
Execution Control
Breakpoints
Symbols
Multi-threaded Debugging
 Postmortem Debugging
Data viewing
Post Mortem Debugging
Increasingly important as Microsoft continues
to invest in Windows
Error Reporting
ISVs can participate in WER by visiting
http://winqual.microsoft.com
Create an account
Complete a request file mapping form
Enterprise customers can use CER to keep data
local and verify/analyze
See resources at the end
Postmortem debugging
Postmortem – Optimized tips
Take the red pill!
Open the disassembly window
Open the autos window to see
pertinent registers
Trust statics/globals and trust stacks when you
have symbols
You do have symbols right?
Don’t necessarily trust Watch and Locals
Not enough information is around for the debugger
to make sense of which variable is alive
Overview
Tips and tricks in the following areas:
Execution Control
Breakpoints
Symbols
Multi-threaded Debugging
Postmortem Debugging
 Data Viewing
Data viewing
Numerous Tricks for Formatting Your Data
Managed Code
Watch window qualifiers
Type proxies
Custom visualizers
Native Code
Watch window qualifiers
Autoexp.dat
Magic Watch Window Values
Native - numerous magic values to help track
down tricky bugs
$user
$CLK
$env
$cmdline
Data Viewing and Watch Magic
VS Debugger Resources
Extending and Customizing the Debugger
http://msdn.microsoft.com/enus/library/bb161718.aspx
Setting up a Symbol Server
http://www.microsoft.com/whdc/devtools/debugg
ing/default.mspx
Using Thread Names
http://blogs.msdn.com/stevejs/archive/2005/12/1
9/505815.aspx
VS Debugger Resources
Corporate Error Reporting
http://msdn.microsoft.com/enus/library/aa939342.aspx
Optimized Code Debugging Deep Dive
http://blogs.msdn.com/greggm/archive/2004/12/1
5/315673.aspx
Debugger Visualizers
http://msdn.microsoft.com/enus/library/bb161718.aspx
VS Debugger Blogs
http://blogs.msdn.com/ms_joc/
http://blogs.msdn.com/greggm/
http://blogs.msdn.com/jacdavis
http://blogs.msdn.com/jimgries
http://blogs.msdn.com/rchiodo
DTL Track Resources
Visit the DPR TLC for a chance to win a copy of Visual Studio Team Suite. Daily drawing
occurs every day in the TLC at 4:15pm. Stop by for a raffle ticket
http://www.microsoft.com/visualstudio
http://www.microsoft.com/visualstudio/en-us/products/teamsystem/default.mspx
Please visit us in the TLC blue area
Resources
www.microsoft.com/teched
www.microsoft.com/learning
Sessions On-Demand & Community
Microsoft Certification & Training Resources
http://microsoft.com/technet
http://microsoft.com/msdn
Resources for IT Professionals
Resources for Developers
www.microsoft.com/learning
Microsoft Certification and Training Resources
Complete an
evaluation on
CommNet and
enter to win!
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should
not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.