Power Debugging with Visual C 7'0 - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Power Debugging with Visual C 7'0

Description:

HiSoft Devpac circa 1984. Sinclair QL, Atari ST, CBM Amiga ... Visual C .net has a great many new features for the native code developer (despite the name) ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 23
Provided by: andype2
Category:

less

Transcript and Presenter's Notes

Title: Power Debugging with Visual C 7'0


1
(No Transcript)
2
Power Debugging with Visual C 7.0 Andy
PennellDevelopment LeadVisual C
Debugger Microsoft Corporation
3
Sins of the Past
  • HiSoft Devpac circa 1984
  • Sinclair QL, Atari ST, CBM Amiga
  • 17 years later Im still doing debuggers
  • I must be mad

4
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

5
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)

6
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

7
Why Switch to 7.0 Debugger
  • You do not have to switch to 7.0 compiler / libs
    / crt to use 7.0 debugger
  • Changing your toolset is a bigger decision
  • One IDE for everything
  • C / C / C / Visual Basic / ASP / Visual Basic
    Script / SQL etc.
  • New UI
  • Everything can be tab-docked to anything
  • Simple Remote Debugging
  • Debug Multiple Processes

8
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

9
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 else
  • e.g. see Threads at the same time as Stack
  • Mouse wheel and Multi-Mon friendly

10
Remote Debugging
  • Particularly important for DirectX /Windows9x
  • Pretty painful in 6.0
  • Additional DLLs
  • Not completely reliable
  • Hidden in docs
  • Additional DLLs is Dead
  • For local too
  • Breakpoints re-bind whenever a DLL loads
  • As Reliable as your network permits

11
Remote Debugging 2
  • DirectX should use Transport TCP/IP
  • See Remote Debug Setup in Index
  • 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

12
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 more than one remote process
  • New Remote Attach
  • Requires MSVCMon on remote machine

13
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

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

15
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)

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

17
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

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

19
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

20
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 Windows NT debugger docs for setup
  • Use symsrvsymsrv.dll\\server\share

21
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 )

22
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
  • Better MFC/ATL/STL
  • Timing depends on your project

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