void ValidateStack() { if (stackVersion != session.StackVersion && thread != null) { frames = thread.GetFrames(); } }
public SoftDebuggerBacktrace (SoftDebuggerSession session, MDB.ThreadMirror thread): base (session.Adaptor) { this.session = session; this.thread = thread; stackVersion = session.StackVersion; if (thread != null) this.frames = thread.GetFrames (); else this.frames = new MDB.StackFrame[0]; }
public SoftDebuggerBacktrace(SoftDebuggerSession session, MDB.ThreadMirror thread) : base(session.Adaptor) { this.session = session; this.thread = thread; stackVersion = session.StackVersion; if (thread != null) { this.frames = thread.GetFrames(); } else { this.frames = new MDB.StackFrame[0]; } }
string EvaluateExpression (ThreadMirror thread, string exp) { try { MDB.StackFrame[] frames = thread.GetFrames (); if (frames.Length == 0) return string.Empty; EvaluationOptions ops = Options.EvaluationOptions; ops.AllowTargetInvoke = true; SoftEvaluationContext ctx = new SoftEvaluationContext (this, frames[0], ops); ValueReference val = ctx.Evaluator.Evaluate (ctx, exp); return val.CreateObjectValue (false).Value; } catch (Exception ex) { OnDebuggerOutput (true, ex.ToString ()); return string.Empty; } }
private void DoWalkStackFrames(ThreadMirror thread, Trace parent) { Mono.Debugger.Soft.StackFrame[] frames = thread.GetFrames(); for (int i = frames.Length - 1; i >= 0; --i) // go backwards so that the frames at the top of the stack appear first { var frame = frames[i]; string name; if (string.IsNullOrEmpty(frame.FileName)) name = string.Format("method {0}.{1}", frame.Method.DeclaringType.FullName, frame.Method.Name); else name = string.Format("method {0}.{1} [{2}:{3}]", frame.Method.DeclaringType.FullName, frame.Method.Name, frame.FileName, frame.LineNumber); Log.WriteLine(TraceLevel.Info, "TraceRoots", name); Log.Indent(); var child = new Trace(name, string.Empty, frame); DoWalkStackFrame(frame, child); if (child.Children.Count > 0) parent.Children.Add(child); Log.Unindent(); } }