Udostępnij za pośrednictwem


Debugging Native Code

This topic applies to:

Edition

Visual Basic

C#

C++

Web Developer

Express

Topic does not apply Topic does not apply

Native only

Topic does not apply

Standard

Topic does not apply Topic does not apply

Native only

Topic does not apply

Pro and Team

Topic does not apply Topic does not apply

Native only

Topic does not apply

Table legend:

Topic applies

Applies

Topic does not apply

Does not apply

Topic applies but command hidden by default

Command or commands hidden by default.

The section covers some common debugging problems and techniques for native applications. The techniques covered in this section are high-level techniques. For the mechanics of using the Visual Studio debugger, see Debugger Roadmap.

In This Section

  • How to: Debug Optimized Code
    Gives tips for debugging optimized code, specifically, why you should debug an unoptimized version of your program, default optimization settings for Debug and Release configurations, and tips for finding bugs that only appear in optimized code (turning on optimization in a Debug build configuration).

  • DebugBreak and __debugbreak
    Describes the Win32 DebugBreak function and provides a link to its reference topic in the Platform SDK. Also describes the __debugbreak intrinsic.

  • Assertions
    Discusses assertion statements, how they work, the benefits of using them (catching logic errors, checking results of an operation, and testing error conditions), their interaction with _DEBUG, and the types of assertions supported in Visual Studio.

  • Memory Leak Detection and Isolation
    Covers memory leaks and provides links to topics regarding the tools in the debugger, the C Run-Time Library, and MFC for detecting and identifying memory leaks. Links include enabling memory leak detection, interpreting memory block types, setting a breakpoint on a memory allocation number, comparing memory states, and detecting memory leaks in MFC.

  • How to: Debug Inline Assembly Code
    Provides short instructions on using the Disassembly window to view the assembly instructions and the Registers window to view register contents and provides links to topics regarding those windows.

  • MFC Debugging Techniques
    Links you to debugging techniques for MFC programs, including: afxDebugBreak, the TRACE macro, detecting memory leaks in MFC, MFC assertions, and reducing the size of MFC Debug builds.

  • CRT Debugging Techniques
    Links you to debugging techniques for the C Run-Time Library, including using the CRT Debug Library, macros for reporting, differences between malloc and _malloc_dbg, writing debug hook functions, and the CRT debug heap.

  • Debugging Native Code FAQs
    Provides answers to frequently asked questions about debugging Visual C++ programs

  • COM and ActiveX Debugging
    Provides information on debugging COM and ActiveX applications, including tools you can use for COM and ActiveX debugging.

  • How to: Debug DLLs
    Explains how to set up debugging for DLLs from native code.

  • How to: Debug Injected Code
    Provides guidance on debugging code that uses attributes. Instructions include how to turn on Source Annotation, how to view injected code, and how to view the disassembly code at the current execution point.

  • Debugging Preparation: Visual C++ Project Types
    Provides links to topics that describe how to debug the native project types created by the Visual C++ project templates.

  • Debugging in Visual Studio
    Provides links to the larger sections of the debugging documentation. Information includes what's new in the debugger, settings and preparation, breakpoints, handling exceptions, edit and continue, debugging managed code, debugging native code, debugging SQL, and the user interface references.

See Also

Concepts

Debugger Security

Other Resources

Debugging in Visual Studio