当前位置: 首页>>代码示例>>C#>>正文


C# DkmThread.GetTopStackWalkFrame方法代码示例

本文整理汇总了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();
      }
    }
开发者ID:mbbill,项目名称:vs-chromium,代码行数:26,代码来源:FunctionTracer.cs

示例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();
    }
开发者ID:mbbill,项目名称:vs-chromium,代码行数:22,代码来源:FunctionTracer.cs


注:本文中的DkmThread.GetTopStackWalkFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。