/// <summary> /// Initializes a new instance of the <see cref="StackFrame" /> class. /// </summary> /// <param name="stackTrace">The stack trace.</param> /// <param name="frameContext">The frame context.</param> internal StackFrame(StackTrace stackTrace, ThreadContext frameContext) { StackTrace = stackTrace; FrameContext = frameContext; sourceFileNameAndLine = SimpleCache.Create(ReadSourceFileNameAndLine); functionNameAndDisplacement = SimpleCache.Create(ReadFunctionNameAndDisplacement); locals = SimpleCache.Create(GetLocals); arguments = SimpleCache.Create(GetArguments); clrStackFrame = SimpleCache.Create(() => Thread.ClrThread?.StackTrace.Where(f => f.InstructionPointer == InstructionOffset).FirstOrDefault()); userTypeConvertedLocals = SimpleCache.Create(() => { VariableCollection collection = Variable.CastVariableCollectionToUserType(locals.Value); GlobalCache.UserTypeCastedVariableCollections.Add(userTypeConvertedLocals); return collection; }); userTypeConvertedArguments = SimpleCache.Create(() => { VariableCollection collection = Variable.CastVariableCollectionToUserType(arguments.Value); GlobalCache.UserTypeCastedVariableCollections.Add(userTypeConvertedArguments); return collection; }); module = SimpleCache.Create(() => { var m = Process.GetModuleByInnerAddress(InstructionOffset); if (m == null && ClrStackFrame != null) m = Process.ClrModuleCache[ClrStackFrame.Module]; return m; }); }
/// <summary> /// Initializes a new instance of the <see cref="StackFrame" /> class. /// </summary> /// <param name="stackTrace">The stack trace.</param> /// <param name="frameContext">The frame context.</param> internal StackFrame(StackTrace stackTrace, ThreadContext frameContext) { StackTrace = stackTrace; FrameContext = frameContext; sourceFileNameAndLine = SimpleCache.Create(ReadSourceFileNameAndLine); functionNameAndDisplacement = SimpleCache.Create(ReadFunctionNameAndDisplacement); locals = SimpleCache.Create(GetLocals); arguments = SimpleCache.Create(GetArguments); clrStackFrame = SimpleCache.Create(() => Thread.ClrThread?.GetClrStackFrame(InstructionOffset)); userTypeConvertedLocals = Context.UserTypeMetadataCaches.CreateSimpleCache(() => Variable.CastVariableCollectionToUserType(locals.Value)); userTypeConvertedArguments = Context.UserTypeMetadataCaches.CreateSimpleCache(() => Variable.CastVariableCollectionToUserType(arguments.Value)); module = SimpleCache.Create(() => { var m = Process.GetModuleByInnerAddress(InstructionOffset); if (m == null && ClrStackFrame != null) { m = Process.ClrModuleCache[ClrStackFrame.Module]; } return(m); }); }
/// <summary> /// Converts from managed object to native structure. /// </summary> /// <param name="value">The value.</param> /// <param name="pointer">The pointer.</param> private static void StructureToPtr(ThreadContext value, IntPtr pointer) { throw new NotImplementedException(); }