Share via


Debugger2.CurrentStackFrame Property

Gets or sets the current stack frame.

Namespace:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Syntax

'Declaration
Property CurrentStackFrame As StackFrame
StackFrame CurrentStackFrame { get; set; }
property StackFrame^ CurrentStackFrame {
    StackFrame^ get ();
    void set (StackFrame^ value);
}
abstract CurrentStackFrame : StackFrame with get, set
function get CurrentStackFrame () : StackFrame 
function set CurrentStackFrame (value : StackFrame)

Property Value

Type: EnvDTE.StackFrame
A StackFrame object.

Remarks

See Memory Management: Frame Allocation for more information about the stack frame.

Examples

The following example demonstrates how to use the CurrentStackFrame property.

To test this property:

  1. Set a breakpoint in the target application. Run the add-in.

    The current stack frame is empty.

  2. Set a breakpoint in the target application. Run the target application in the debug mode. When the program stops at the breakpoint, run the add-in.

    The current stack frame contains the method name and the return type.

public static void CurrentStackFrame(EnvDTE80.DTE2 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("Current StackFrame 
    Test");
    owp.Activate();

    owp.OutputString("Current Stack Frame Info: ");
    EnvDTE80.Debugger2 debugger = (EnvDTE80.Debugger2)dte.Debugger;
    EnvDTE.StackFrame sf = debugger.CurrentStackFrame;
    if (sf == null)
        owp.OutputString("No program is being debugged, Stack Frame is 
        empty.");
    else
        owp.OutputString("Function " + sf.FunctionName +
                         " returns type " + sf.ReturnType);
}
Sub ShowCurrentProcess()
    ' This function displays the current debugger
    ' mode in the output window.
    Dim ow As OutputWindow
    ow = DTE2.Windows.Item(Constants.vsWindowKindOutput).Object

    Dim proc As EnvDTE.Process2
    proc = DTE2.Debugger.CurrentProcess

    If (proc Is Nothing) Then
        ow.ActivePane.OutputString("No process is being debugged")
    Else
        ow.ActivePane.OutputString("" + Str(proc.ProcessID) + ": " + _
        proc.Name + vbCrLf)
    End If
End Sub

.NET Framework Security

See Also

Reference

Debugger2 Interface

EnvDTE80 Namespace