Share via


Thread.Location 속성

디버깅하기 위해 프로세스를 중지했을 때 스레드에서 코드를 실행하고 있던 주소를 가져옵니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
ReadOnly Property Location As String
string Location { get; }
property String^ Location {
    String^ get ();
}
abstract Location : string with get
function get Location () : String

속성 값

형식: String
디버깅하기 위해 프로세스를 중지했을 때 스레드에서 코드를 실행하고 있던 주소를 나타내는 문자열 값입니다.

설명

디버깅 중인 코드에 기호가 연결되어 있으면 Location에서 함수 이름을 반환하고 디버깅 중인 코드에 기호가 연결되어 있지 않으면 Location에서 숫자 주소를 반환합니다.

예제

다음 예제에서는 Location 속성을 사용하는 방법을 보여 줍니다.

이 속성을 테스트하려면

  1. 작업자 스레드 콜백 메서드에 중단점을 설정합니다.

  2. 디버그 모드에서 대상 응용 프로그램을 실행합니다.

  3. 응용 프로그램이 중단점에서 멈추면 추가 기능을 실행합니다.

public static void TestThreadProperties(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("Thread Test");
    owp.Activate();

    EnvDTE.Threads threads = dte.Debugger.CurrentProgram.Threads;
    owp.OutputString("\nNumber of items in the Thread collection: " + 
                     threads.Item(1).Collection.Count + "\n");
    foreach(EnvDTE.Thread thread in threads)
    {
        owp.OutputString("\nThread: " + thread.ID + "  Name: " + thread.Name);
        owp.OutputString("\n  Edition of the environment : " + thread.DTE.Edition);
        owp.OutputString("\n  Is alive                   : " + thread.IsAlive);
        owp.OutputString("\n  Is frozen                  : " + thread.IsFrozen);
        owp.OutputString("\n  Location                   : " + thread.Location);
        owp.OutputString("\n  Parent's current mode      : " + thread.Parent.CurrentMode);
        owp.OutputString("\n  Priority                   : " + thread.Priority);
        owp.OutputString("\n  Program name               : " + thread.Program.Name);
        owp.OutputString("\n  Number of stack frames     : " + thread.StackFrames.Count);
        owp.OutputString("\n  Suspended number of times  : " + thread.SuspendCount);
    }
}
Shared Sub ThreadProperties(ByRef dte As EnvDTE.DTE)
    Dim str As String
    Dim threads As EnvDTE.Threads = dte.Debugger.CurrentProgram.Threads
    str = "Number of items in the Thread collection: " + _
          threads.Item(1).Collection.Count.ToString()
    For Each thread As EnvDTE.Thread In threads
        str += vbCrLf + vbCrLf + "  Thread: " + thread.ID.ToString()
        str += vbCrLf + "    Edition of the environment: " + thread.DTE.Edition
        str += vbCrLf + "    Is alive: " + thread.IsAlive.ToString()
        str += vbCrLf + "    Is frozen: " + thread.IsFrozen.ToString()
        str += vbCrLf + "    Location: " + thread.Location
        str += vbCrLf + "    Parent's current mode: " + _
               thread.Parent.CurrentMode.ToString()
        str += vbCrLf + "    Priority: " + thread.Priority
        str += vbCrLf + "    Program name: " + thread.Program.Name
        str += vbCrLf + "    Number of stack frames: " + _
               thread.StackFrames.Count.ToString()
        str += vbCrLf + "    Suspended number of times: " + _
               thread.SuspendCount.ToString()
    Next
    MessageBox.Show(str, "Thread Test - Properties")
End Sub

.NET Framework 보안

참고 항목

참조

Thread 인터페이스

EnvDTE 네임스페이스