Click to Rate and Give Feedback
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Visual Studio Automation and Extensibility Reference
Breakpoints.Add Method

Creates and enables a new breakpoint.

Namespace: EnvDTE
Assembly: EnvDTE (in envdte.dll)

Visual Basic (Declaration)
Function Add ( _
    <InAttribute> <OptionalAttribute> Optional Function As String = "", _
    <InAttribute> <OptionalAttribute> Optional File As String = "", _
    <InAttribute> <OptionalAttribute> Optional Line As Integer = 1, _
    <InAttribute> <OptionalAttribute> Optional Column As Integer = 1, _
    <InAttribute> <OptionalAttribute> Optional Condition As String = "", _
    <InAttribute> <OptionalAttribute> Optional ConditionType As dbgBreakpointConditionType = dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, _
    <InAttribute> <OptionalAttribute> Optional Language As String = "", _
    <InAttribute> <OptionalAttribute> Optional Data As String = "", _
    <InAttribute> <OptionalAttribute> Optional DataCount As Integer = 1, _
    <InAttribute> <OptionalAttribute> Optional Address As String = "", _
    <InAttribute> <OptionalAttribute> Optional HitCount As Integer = 0, _
    <InAttribute> <OptionalAttribute> Optional HitCountType As dbgHitCountType = dbgHitCountType.dbgHitCountTypeNone _
) As Breakpoints
Visual Basic (Usage)
Dim instance As Breakpoints
Dim Function As String
Dim File As String
Dim Line As Integer
Dim Column As Integer
Dim Condition As String
Dim ConditionType As dbgBreakpointConditionType
Dim Language As String
Dim Data As String
Dim DataCount As Integer
Dim Address As String
Dim HitCount As Integer
Dim HitCountType As dbgHitCountType
Dim returnValue As Breakpoints

returnValue = instance.Add(Function, File, Line, Column, Condition, ConditionType, Language, Data, DataCount, Address, HitCount, HitCountType)
C#
Breakpoints Add (
    [OptionalAttribute] [InAttribute] string Function,
    [OptionalAttribute] [InAttribute] string File,
    [OptionalAttribute] [InAttribute] int Line,
    [OptionalAttribute] [InAttribute] int Column,
    [OptionalAttribute] [InAttribute] string Condition,
    [OptionalAttribute] [InAttribute] dbgBreakpointConditionType ConditionType,
    [OptionalAttribute] [InAttribute] string Language,
    [OptionalAttribute] [InAttribute] string Data,
    [OptionalAttribute] [InAttribute] int DataCount,
    [OptionalAttribute] [InAttribute] string Address,
    [OptionalAttribute] [InAttribute] int HitCount,
    [OptionalAttribute] [InAttribute] dbgHitCountType HitCountType
)
C++
Breakpoints^ Add (
    [InAttribute] [OptionalAttribute] String^ Function, 
    [InAttribute] [OptionalAttribute] String^ File, 
    [InAttribute] [OptionalAttribute] int Line, 
    [InAttribute] [OptionalAttribute] int Column, 
    [InAttribute] [OptionalAttribute] String^ Condition, 
    [InAttribute] [OptionalAttribute] dbgBreakpointConditionType ConditionType, 
    [InAttribute] [OptionalAttribute] String^ Language, 
    [InAttribute] [OptionalAttribute] String^ Data, 
    [InAttribute] [OptionalAttribute] int DataCount, 
    [InAttribute] [OptionalAttribute] String^ Address, 
    [InAttribute] [OptionalAttribute] int HitCount, 
    [InAttribute] [OptionalAttribute] dbgHitCountType HitCountType
)
J#
Breakpoints Add (
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Function, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String File, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int Line, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int Column, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Condition, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ dbgBreakpointConditionType ConditionType, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Language, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Data, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int DataCount, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ String Address, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ int HitCount, 
    /** @attribute InAttribute() */ /** @attribute OptionalAttribute() */ dbgHitCountType HitCountType
)
JScript
function Add (
    Function : String, 
    File : String, 
    Line : int, 
    Column : int, 
    Condition : String, 
    ConditionType : dbgBreakpointConditionType, 
    Language : String, 
    Data : String, 
    DataCount : int, 
    Address : String, 
    HitCount : int, 
    HitCountType : dbgHitCountType
) : Breakpoints

Parameters

Function

Optional. A function breakpoint. The name of the function on which the breakpoint is set.

File

Optional. A file breakpoint. The name and optional path of the file in which the breakpoint is set.

Line

Optional. A file breakpoint. The source-code line number, measured from the start of the function, at which the breakpoint is set. If this value is 1, the breakpoint is set at the start of the function.

Column

Optional. A file breakpoint. The character at which the breakpoint is set. In most cases, you can leave this value set to 1, which sets the breakpoint at the start of the line.

Condition

Optional. The breakpoint Condition. Use with ConditionType.

ConditionType

Optional. The condition type. A dbgBreakpointConditionType value. Use with Condition.

Language

Optional. The programming language in which the function is written.

Data

Optional. A data breakpoint. If the breakpoint is set on a variable, you can specify the name of the variable. You can use the context operator to specify a variable outside the current scope.

DataCount

Optional. A data breakpoint. If the breakpoint is set on a variable, and if the variable is an array or dereferenced pointer, this value specifies the number of elements to watch.

Address

Optional. An address breakpoint. The memory address where the breakpoint is set, in decimal or hexadecimal format.

HitCount

Optional. The Hit Count property for the breakpoint. If you specify no hit count, program execution breaks each time the breakpoint is hit. If you specify a hit count, program execution breaks only on the specified number of hits.

HitCountType

Optional. The hit count type. A dbgHitCountType value.

Return Value

A Breakpoints collection.

Creates and enables a new breakpoint and returns a Breakpoints collection.

All parameters for this method are optional; however you can specify only one of four location types, as described below.

To set a breakpoint in this location type

Use parameter(s)

Within a function.

Function

Within a file. Can optionally specify the line and column location within the file.

File, Line, and Column

Within data. Can optionally be set for variables and the number of variables to watch.

Data and DataCount

At a specific address.

Address

To any of these location types, you can optionally supply Condition and ConditionType to break only when a specified condition is true. You can optionally supply HitCount and HitCountType to break on the specified hit count.

The following example demonstrates how to use the Add method.

To test this method:

  1. Open the target project and run the add-in.

C#
public static void Add(DTE dte)
{
    // Setup debug Output window.
    Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Add Method Test: ");
    owp.Activate();

    // dte is a reference to the DTE object passed to you by the
    // OnConnection method that you implement when you create an add-in.
    EnvDTE.Debugger debugger = (EnvDTE.Debugger)dte.Debugger;
    debugger.Breakpoints.Add("","Target001.cs", 13, 1, "", 
                             EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, 
                             "C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);
    debugger.Breakpoints.Add("","Target001.cs", 15, 1, "", 
                             EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, 
                             "C#","", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone);

    owp.OutputString("\nNumber of Breakpoints: " + debugger.Breakpoints.Count);
    owp.OutputString("\nEdition of the environment: " + 
                     debugger.Breakpoints.DTE.Edition);
    owp.OutputString("\nParent's Current Mode: " + 
                     debugger.Breakpoints.Parent.CurrentMode);
    owp.OutputString("\nFirst breakpoint is on line " + 
                     debugger.Breakpoints.Item(1).FileLine + ".");
    owp.OutputString("\nSecond breakpoint is on line " + 
                     debugger.Breakpoints.Item(2).FileLine + ".");
}
Visual Basic
Shared Sub AddBreakpoint(ByRef dte As EnvDTE.DTE)
    dte.Debugger.StepInto(True)
    dte.Debugger.Breakpoints.Add("", "Target001.cs", 13, 1, "", _
                                 EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, _
                                 "C#", "", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone)
    dte.Debugger.Breakpoints.Add("", "Target001.cs", 15, 1, "", _
                                 EnvDTE.dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, _
                                 "C#", "", 0, "", 0, EnvDTE.dbgHitCountType.dbgHitCountTypeNone)
End Sub
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker