本文整理汇总了C#中DkmThread.GetTopStackWalkFrame方法的典型用法代码示例。如果您正苦于以下问题:C# DkmThread.GetTopStackWalkFrame方法的具体用法?C# DkmThread.GetTopStackWalkFrame怎么用?C# DkmThread.GetTopStackWalkFrame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DkmThread
的用法示例。
在下文中一共展示了DkmThread.GetTopStackWalkFrame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnFunctionEntered
void IFunctionTracer.OnEntryBreakpointHit(DkmRuntimeBreakpoint bp, DkmThread thread, bool hasException) {
// The function was just entered. Install the exit breakpoint on the calling thread at the
// return address, and notify any listeners.
DkmStackWalkFrame frame = thread.GetTopStackWalkFrame(bp.RuntimeInstance);
bool suppressExitBreakpoint = false;
if (OnFunctionEntered != null)
OnFunctionEntered(frame, frameAnalyzer, out suppressExitBreakpoint);
if (!suppressExitBreakpoint) {
ulong ret = frame.VscxGetReturnAddress();
DkmInstructionAddress retAddr = thread.Process.CreateNativeInstructionAddress(ret);
DkmRuntimeInstructionBreakpoint exitBp = DkmRuntimeInstructionBreakpoint.Create(
Guids.Source.FunctionTraceExit, thread, retAddr, false, null);
// Capture the value of every argument now, since when the exit breakpoint gets hit, the
// target function will have already returned and its frame will be cleaned up.
exitBp.SetDataItem(DkmDataCreationDisposition.CreateAlways,
new FunctionTraceEntryDataItem {
EntryArgumentValues = frameAnalyzer.GetAllArgumentValues(frame)
});
exitBp.SetDataItem(DkmDataCreationDisposition.CreateAlways,
new FunctionTraceDataItem { Tracer = this });
exitBp.Enable();
}
}
示例2: CachedFrameAnalyzer
void IFunctionTracer.OnExitBreakpointHit(DkmRuntimeBreakpoint bp, DkmThread thread, bool hasException) {
FunctionTraceEntryDataItem traceDataItem = bp.GetDataItem<FunctionTraceEntryDataItem>();
if (OnFunctionExited != null) {
DkmStackWalkFrame frame = thread.GetTopStackWalkFrame(bp.RuntimeInstance);
StackFrameAnalyzer exitAnalyzer = null;
if (traceDataItem != null) {
DkmSystemInformationFlags systemInformationFlags =
frame.ModuleInstance.Process.SystemInformation.Flags;
bool isTarget64Bit = systemInformationFlags.HasFlag(DkmSystemInformationFlags.Is64Bit);
int pointerSize = (isTarget64Bit) ? 8 : 4;
exitAnalyzer = new CachedFrameAnalyzer(
frameAnalyzer.Parameters,
traceDataItem.EntryArgumentValues,
pointerSize);
}
OnFunctionExited(frame, exitAnalyzer);
}
// Since this was a one-shot breakpoint, it is unconditionally closed.
bp.Close();
}