Debugger2.CurrentProgram 属性

设置或返回活动程序。

命名空间:  EnvDTE80
程序集:  EnvDTE80(在 EnvDTE80.dll 中)

语法

声明
Property CurrentProgram As Program
    Get
    Set
Program CurrentProgram { get; set; }
property Program^ CurrentProgram {
    Program^ get ();
    void set (Program^ value);
}
abstract CurrentProgram : Program with get, set
function get CurrentProgram () : Program
function set CurrentProgram (value : Program)

属性值

类型:EnvDTE.Program
一个 Program 对象。

实现

Debugger.CurrentProgram

备注

活动程序即定义调试器所显示的数据的程序。 尽管调试器支持同时调试多个进程,但在任意给定时刻只能有一个进程处于活动状态。 有关更多信息,请参见 调试多个进程

示例

Sub DumpStacks()
    ' This macro dumps the stack for each thread 
    ' running in the current program to the 
    ' Command window.  The output format is identical 
    ' to that of the call-stack window except the current
    ' line is not printed.
    Dim d As EnvDTE80.Debugger2
    d = DTE2.Debugger
    Dim ow As CommandWindow
    ow = DTE2.Windows.Item(Constants.vsWindowKindCommandWindow).Object

    If d.CurrentProgram Is Nothing Then
        ow.OutputString("No program is currently being debugged." + _
        vbCrLf)
    Else
        Dim MyThread As Thread
        ow.OutputString("Current Program: " + d.CurrentProgram.Name + _
        vbCrLf)

        For Each MyThread In d.CurrentProgram.Threads
            ow.OutputString("" + vbTab + "Thread _
            (" + Str(MyThread.ID) + " ) " + MyThread.Name + vbCrLf)

            Dim MyFrame As EnvDTE.StackFrame
            For Each MyFrame In MyThread.StackFrames
                Dim strModule As String
                Dim pos As Integer = InStrRev(MyFrame.Module, "\")
                If pos > 0 Then
                    strModule = Right(MyFrame.Module, _
                    Len(MyFrame.Module) - pos)
                Else
                    strModule = MyFrame.Module
                End If

                Dim strFName As String = MyFrame.FunctionName
                'Create the argument list.
                Dim strArgs As String
                Dim MyArg As Expression
                Dim i = 0
                For Each MyArg In MyFrame.Arguments
                    If i > 0 Then
                        strArgs = strArgs + ", "
                    End If
                    strArgs = strArgs + MyArg.Type + " " + _
                    MyArg.Name + "=" + MyArg.Value
                    i = i + 1
                Next
                'Output the frame information.
                ow.OutputString("" + vbTab + vbTab + strModule + ": _
                " + strFName + "(" + strArgs + ")" + vbCrLf)
            Next
        Next
    End If
End Sub

.NET Framework 安全性

请参见

参考

Debugger2 接口

CurrentProgram 重载

EnvDTE80 命名空间