Power Debugging with Visual Studio .NET - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Power Debugging with Visual Studio .NET

Description:

Visual C .NET has a great many new features for the native ... Caveats: may not work 100% or exist in future versions and Not Supported. New Pseudo-Registers ... – PowerPoint PPT presentation

Number of Views:82
Avg rating:3.0/5.0
Slides: 22
Provided by: andype2
Category:

less

Transcript and Presenter's Notes

Title: Power Debugging with Visual Studio .NET


1
Power Debugging with Visual Studio .NET
  • Andy Pennell
  • Development Lead
  • Visual Studio Debugger
  • Microsoft Corporation

2
Contents
  • 6.0 Issues
  • Why Switch to 7.0
  • New 7.0 UI
  • Remote Debugging
  • Debugger Automation
  • Minidumps
  • Runtime Checks
  • More New Stuff
  • Undocumented Goodies

3
Microsoft .NET
  • Visual C .NET has a great many new features
    for the native code developer (despite the name)
  • No more references to .NET (I promise)

4
What Sucked in the 6.0 Debugger
  • Remote Debugging
  • Painful to set up, not very reliable
  • Additional DLLs
  • Painful to set up, remote was even more so
  • Modal Threads Dialog
  • Multi-threaded apps painful to debug
  • Debugging STL code
  • 255 char limit in debug information

5
Why Switch to 7.0 Debugger
  • You dont have to switch to 7.0 compiler/libs/crt
    for 7.0 debugger
  • Changing your toolset is a bigger decision
  • One IDE for everything
  • C / C / C / VB / ASP / VBS / SQL etc
  • New UI
  • Tab-dock everything
  • Simple Remote Debugging
  • Debug Multiple Processes

6
Why Switch (continued)
  • Rich Automation Support
  • Read and Write Minidumps
  • No 255 char limit on debug info
  • Debugging STL suddenly feasible
  • Requires 7.0 toolset
  • Runtime Checks
  • More Good Stuff

7
New 7.0 UI
  • Demo
  • New Debugger windows
  • Four memory windows
  • Threads/Breakpoints/Modules modeless
  • Command Window
  • Processes window
  • Almost everything is modeless can be tab-docked
    with anything
  • e.g. see Threads with Stack
  • Wheel and Multi-Mon friendly

8
Remote Debugging
  • Particularly important for DirectX and earlier
    versions of Windows
  • Pretty painful in 6.0
  • Additional DLLs
  • Not completely reliable
  • Hidden in docs
  • Additional DLLs is Dead
  • For local too
  • Breakpoints re-bind when a DLL loads
  • As reliable as the network permits

9
Remote Debugging 2
  • Use Transport TCP/IP
  • See Remote Debug Setup docs
  • Change Project Properties
  • Right click on Project / Properties
  • Go to Configuration Properties / Debugging
  • Debugger Type Native Only
  • Connection Remote via TCP/IP (Native)
  • Remote Machine pingable name
  • Remote Command path to exe as remote machine
    sees it

10
Remote Debugging 3
  • Start MSVCMon on remote machine
  • Press F5 on IDE
  • Thats it!
  • Recommend you share the .exe from your IDE box to
    the Target box
  • New Debug gt1 remote process
  • New Remote Attach

11
Debugger Automation
  • Rich API set
  • Threw out 6.0 automation APIs
  • Write macros to control debugger
  • Write event handlers
  • e.g. to react to breakpoints
  • Demo

12
Lots of Registers Now
  • Reg window supports groups, x86
  • CPU
  • CPU Segments
  • Floating point
  • MMX
  • SSE1
  • SSE2
  • 3DNow!
  • Flags
  • Effective Address

13
Minidumps
  • A (small) file that captures the state of a
    process
  • You can save nasty crashes for later
    investigation
  • Your QA can do the same
  • Customers can send you the crash info for
    off-line tracking and investigation
  • Latest Microsoft software uses minidumps to
    report crashes direct to microsoft.com (and send
    fixes back to you)

14
Minidumps 2
  • Create with
  • Visual Studio Debugger (Debug / Save As Dump )
  • Windows XP, Office XP, Internet Explorer,
    VisualStudio (automatically via Watson)
  • YourApp.exe
  • See MSDN MiniDumpWriteDump
  • Read With Visual C 7 Debugger
  • Open Solution / Foo.mdmp

15
Runtime Checks
  • New compiler option to find bugs earlier
  • cl /RTC1 finds
  • Buffer overruns
  • Calling convention mismatches
  • Using uninitialized locals
  • Debugger understands them
  • Use in debug builds only
  • See run-time error checks in docs

16
DirectX Data Display
  • Add to autoexp.dat file
  • D3DXQUATERNION xltxgt yltygt zltzgt wltwgt
  • _D3DMATRIX _11lt_11gt _22lt_22gt _33lt_33gt
    _44lt_44gt
  • D3DXVECTOR4 xltxgt yltygt zltzgt wltwgt
  • _D3DVECTOR xltxgt yltygt zltzgt
  • D3DXVECTOR2 xltxgt yltygt
  • _D3DCOLORVALUE rltrgt gltggt bltbgt altagt
  • _D3DPRESENT_PARAMETERS_ hwndlthDeviceWindowgt
    FmtltBackBufferFormatgt ZBuffltEnableAutoDepthStenc
    ilgt
  • _D3DDISPLAYMODE wltWidthgt hltHeightgt
    HzltRefreshRategt FmtltFormatgt
  • _D3DVIEWPORT8 xltxgt yltygt widthltWidthgt
    heightltHeightgt
  • (Works in Visual C 6.0 too)

17
More New Stuff
  • Detach from processes
  • On Windows XP uses new API
  • On Windows 2000 uses Debugger Proxy Service
  • Reload Symbols
  • C Exceptions support
  • Stop on them by name
  • F5 can Attach (as well as Launch)
  • Step Into Specific
  • Smarter Tooltips (e.g. structs)

18
Even More New Stuff
  • (these all require 7.0 compiler)
  • Tooltips on HRESULTs
  • Full bool type support
  • Full wchar_t type support
  • Improved Edit Continue
  • More changes allowed
  • Edit code in .libs

19
Undocumented Goodies
  • Caveats may not work 100 or exist in future
    versions and Not Supported
  • New Pseudo-Registers
  • handles how may handles open
  • NT OSes only
  • vframe virtual frame pointer
  • very handy for retail debugging
  • Symbol Server
  • See NT debugger docs for setup
  • Use symsrvsymsrv.dll\\server\share

20
SetThreadName
  • typedef struct tagTHREADNAME_INFO
  • DWORD dwType // must be 0x1000
  • LPCSTR szName // pointer to name (in user addr
    space)
  • DWORD dwThreadID // thread ID (-1caller
    thread)
  • DWORD dwFlags // reserved for future use, must
    be zero
  • THREADNAME_INFO
  • void SetThreadName( DWORD dwThread, LPCSTR
    szThreadName, DWORD dwFlags )
  • THREADNAME_INFO info
  • info.dwType 0x1000
  • info.szName szThreadName
  • info.dwThreadID dwThread
  • info.dwFlags dwFlags
  • __try
  • RaiseException( 0x406D1388, 0,
    sizeof(info)/sizeof(DWORD), (DWORD)info )

21
Call To Action
  • Switch to 7.0 Debugger Now
  • Your life will be easier
  • There are no excuses
  • Switch to 7.0 Toolset Soon
  • Better / faster / smaller codegen
  • Better debugging (and Edit Continue)
  • Better MFC/ATL/STL
  • Timing depends on your project

22
QA
Write a Comment
User Comments (0)
About PowerShow.com