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; }
public ML.TargetObject RuntimeInvoke (MdbEvaluationContext ctx, ML.TargetFunctionType function, ML.TargetStructObject object_argument, params ML.TargetObject[] param_objects) { MethodCall mc = new MethodCall (ctx, function, object_argument, param_objects); ctx.Adapter.AsyncExecute (mc, ctx.Options.EvaluationTimeout); return mc.ReturnValue; }