public BacktraceHandle(ProcessHandle process, Backtrace backtrace) { StackFrame[] bt_frames = backtrace.Frames; if (bt_frames != null) { frames = new FrameHandle [bt_frames.Length]; for (int i = 0; i < frames.Length; i++) frames [i] = new FrameHandle (bt_frames [i]); } else frames = new FrameHandle [0]; }
public Backtrace GetBacktrace() { check_servant(); Backtrace bt = servant.CurrentBacktrace; if (bt != null) { return(bt); } return(GetBacktrace(Backtrace.Mode.Default, -1)); }
DL.Backtrace CreateBacktrace(MD.Thread thread, ML.TargetObject exception) { List <MD.StackFrame> frames = new List <MD.StackFrame> (); DateTime t = DateTime.Now; if (!thread.CurrentFrame.Language.IsManaged) { MD.Backtrace bt = thread.GetBacktrace(MD.Backtrace.Mode.Native, max_frames); if (bt != null) { Console.WriteLine("GetBacktrace native time: {0} ms n:{1}", (DateTime.Now - t).TotalMilliseconds, bt.Count); frames.AddRange(bt.Frames); } } else { t = DateTime.Now; MD.Backtrace backtrace = thread.GetBacktrace(MD.Backtrace.Mode.Managed, max_frames); if (backtrace != null) { Console.WriteLine("GetBacktrace managed time: {0} ms n:{1}", (DateTime.Now - t).TotalMilliseconds, backtrace.Count); frames.AddRange(backtrace.Frames); } } if (frames.Count > 0) { BacktraceWrapper wrapper = new BacktraceWrapper(frames.ToArray(), exception); return(new DL.Backtrace(wrapper)); } else if (thread.CurrentBacktrace != null) { BacktraceWrapper wrapper = new BacktraceWrapper(thread.CurrentBacktrace.Frames, exception); return(new DL.Backtrace(wrapper)); } return(null); }
protected override bool DoResolveBase(ScriptingContext context) { if (!base.DoResolveBase (context)) return false; if (!CurrentThread.IsStopped) throw new TargetException (TargetError.NotStopped); backtrace = CurrentThread.GetBacktrace (); if (index == -1) frame = backtrace.CurrentFrame; else { if (index >= backtrace.Count) throw new ScriptingException ("No such frame: {0}", index); frame = backtrace [index]; } context.CurrentFrame = frame; return true; }
// <summary> // The current stack frame. May only be used when the engine is stopped // (State == TargetState.STOPPED). The backtrace is generated on // demand, when this function is called. However, the single stepping // engine will compute this only once each time a stepping operation is // completed. This means that if you call this function several times // without doing any stepping operations in the meantime, you'll always // get the same backtrace. // </summary> public Backtrace GetBacktrace(Backtrace.Mode mode, int max_frames) { check_servant (); return servant.GetBacktrace (mode, max_frames); }