共用方式為


StackFrame.GetNativeOffset 方法

定義

為正在執行的方法取得從原生 (Native) Just-In-Time (JIT) 編譯程式碼起始的位移。 由 DebuggableAttribute 類別控制產生這個偵錯資訊。

public:
 virtual int GetNativeOffset();
public virtual int GetNativeOffset ();
abstract member GetNativeOffset : unit -> int
override this.GetNativeOffset : unit -> int
Public Overridable Function GetNativeOffset () As Integer

傳回

從 JIT 編譯程式碼起始的位移,用於正在執行的方法。

範例

下列範例示範 GetNativeOffset 方法的用法。 此程式代碼範例是提供給 類別之較大範例的 StackFrame 一部分。

// Display the stack frame properties.
StackFrame^ sf = st->GetFrame( i );
Console::WriteLine( " File: {0}", sf->GetFileName() );
Console::WriteLine( " Line Number: {0}", sf->GetFileLineNumber().ToString() );

// Note that the column number defaults to zero
// when not initialized.
Console::WriteLine( " Column Number: {0}", sf->GetFileColumnNumber().ToString() );
Console::WriteLine( " Intermediate Language Offset: {0}", sf->GetILOffset().ToString() );
Console::WriteLine( " Native Offset: {0}", sf->GetNativeOffset().ToString() );
// Display the stack frame properties.
StackFrame sf = st.GetFrame(i);
Console.WriteLine(" File: {0}", sf.GetFileName());
Console.WriteLine(" Line Number: {0}",
   sf.GetFileLineNumber());
// Note that the column number defaults to zero
// when not initialized.
Console.WriteLine(" Column Number: {0}",
   sf.GetFileColumnNumber());
if (sf.GetILOffset() != StackFrame.OFFSET_UNKNOWN)
{
   Console.WriteLine(" Intermediate Language Offset: {0}",
      sf.GetILOffset());
}
if (sf.GetNativeOffset() != StackFrame.OFFSET_UNKNOWN)
{
   Console.WriteLine(" Native Offset: {0}",
      sf.GetNativeOffset());
}
' Display the stack frame properties.
Dim sf As StackFrame = st.GetFrame(i)
Console.WriteLine(" File: {0}", sf.GetFileName())
Console.WriteLine(" Line Number: {0}", _
   sf.GetFileLineNumber())
' The column number defaults to zero when not initialized.
Console.WriteLine(" Column Number: {0}", _
   sf.GetFileColumnNumber())
If sf.GetILOffset <> StackFrame.OFFSET_UNKNOWN
   Console.WriteLine(" Intermediate Language Offset: {0}", _
       sf.GetILOffset())
End If
If sf.GetNativeOffset <> StackFrame.OFFSET_UNKNOWN
  Console.WriteLine(" Native Offset: {0}", _
      sf.GetNativeOffset())
End If

適用於

另請參閱