Exemplo n.º 1
0
        static void SetSourceCodeFrame()
        {
            Backtrace bt = DebuggingService.CurrentCallStack;

            if (bt != null)
            {
                for (int n = 0; n < bt.FrameCount; n++)
                {
                    StackFrame sf = bt.GetFrame(n);
                    if (!sf.IsExternalCode && sf.SourceLocation.Line != -1)
                    {
                        bool found = !string.IsNullOrEmpty(sf.SourceLocation.FileName) &&
                                     System.IO.File.Exists(sf.SourceLocation.FileName);
                        if (found)
                        {
                            if (n != DebuggingService.CurrentFrameIndex)
                            {
                                DebuggingService.CurrentFrameIndex = n;
                            }
                            break;
                        }
                        else
                        {
                            LoggingService.LogWarning("Debugger could not find file '{0}'", sf.SourceLocation.FileName);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        static void SetSourceCodeFrame()
        {
            Backtrace bt = DebuggingService.CurrentCallStack;

            if (bt != null)
            {
                for (int n = 0; n < bt.FrameCount; n++)
                {
                    StackFrame sf = bt.GetFrame(n);

                    if (!sf.IsExternalCode &&
                        sf.SourceLocation.Line != -1 &&
                        !string.IsNullOrEmpty(sf.SourceLocation.FileName) &&
                        //Uncomment condition below once logic for ProjectOnlyCode in runtime is fixed
                        (                    /*DebuggingService.CurrentSessionSupportsFeature (DebuggerFeatures.Disassembly) ||*/

                            sf.SourceLocation.SourceLink != null ||
                            File.Exists(sf.SourceLocation.FileName) ||
                            SourceCodeLookup.FindSourceFile(sf.SourceLocation.FileName, sf.SourceLocation.FileHash).IsNotNull))
                    {
                        if (n != DebuggingService.CurrentFrameIndex)
                        {
                            DebuggingService.CurrentFrameIndex = n;
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 3
0
 // Token: 0x06000138 RID: 312 RVA: 0x00005888 File Offset: 0x00003A88
 private Client.ExceptionInfo GetExceptionInfo(Backtrace backTrace, EvaluationOptions options = null, bool isUnhandled = false)
 {
     Client.ExceptionInfo exceptionInfo = null;
     if (backTrace != null && backTrace.FrameCount > 0)
     {
         for (int i = 0; i < backTrace.FrameCount; i++)
         {
             Mono.Debugging.Client.StackFrame frame = backTrace.GetFrame(i);
             if (isUnhandled || !frame.IsExternalCode)
             {
                 try
                 {
                     exceptionInfo = ((options == null) ? frame.GetException() : frame.GetException(options));
                 }
                 catch (AbsentInformationException)
                 {
                     goto IL_4A;
                 }
                 if (exceptionInfo != null)
                 {
                     this.ResolveFullException(exceptionInfo);
                     break;
                 }
             }
             IL_4A :;
         }
     }
     return(exceptionInfo);
 }
Exemplo n.º 4
0
        void Update()
        {
            needsUpdate = false;
            store.Clear();

            if (current_backtrace == null)
            {
                return;
            }

            for (int i = 0; i < current_backtrace.FrameCount; i++)
            {
                string icon;
                if (i == DebuggingService.CurrentFrameIndex)
                {
                    icon = Gtk.Stock.GoForward;
                }
                else
                {
                    icon = null;
                }

                StackFrame fr = current_backtrace.GetFrame(i);

                StringBuilder met  = new StringBuilder(fr.SourceLocation.MethodName);
                ObjectValue[] args = fr.GetParameters();
                if (args.Length != 0 || !fr.SourceLocation.MethodName.StartsWith("["))
                {
                    met.Append(" (");
                    for (int n = 0; n < args.Length; n++)
                    {
                        if (n > 0)
                        {
                            met.Append(", ");
                        }
                        met.Append(args[n].Name).Append("=").Append(args[n].Value);
                    }
                    met.Append(")");
                }

                string file;
                if (!string.IsNullOrEmpty(fr.SourceLocation.FileName))
                {
                    file = fr.SourceLocation.FileName;
                    if (fr.SourceLocation.Line != -1)
                    {
                        file += ":" + fr.SourceLocation.Line;
                    }
                }
                else
                {
                    file = string.Empty;
                }

                store.AppendValues(icon, met.ToString(), file, fr.Language, "0x" + fr.Address.ToString("x"), null,
                                   fr.IsExternalCode? Pango.Style.Italic : Pango.Style.Normal);
            }
        }
Exemplo n.º 5
0
        void Update()
        {
            if (tree.IsRealized)
            {
                tree.ScrollToPoint(0, 0);
            }

            needsUpdate = false;
            store.Clear();

            if (current_backtrace == null)
            {
                return;
            }

            var options = DebuggingService.DebuggerSession.Options.EvaluationOptions;

            for (int i = 0; i < current_backtrace.FrameCount; i++)
            {
                string icon;
                if (i == DebuggingService.CurrentFrameIndex)
                {
                    icon = Gtk.Stock.GoForward;
                }
                else
                {
                    icon = null;
                }

                StackFrame frame = current_backtrace.GetFrame(i);
                if (frame.IsDebuggerHidden)
                {
                    continue;
                }

                var method = EvaluateMethodName(frame, options);

                string file;
                if (!string.IsNullOrEmpty(frame.SourceLocation.FileName))
                {
                    file = frame.SourceLocation.FileName;
                    if (frame.SourceLocation.Line != -1)
                    {
                        file += ":" + frame.SourceLocation.Line;
                    }
                }
                else
                {
                    file = string.Empty;
                }

                var style = frame.IsExternalCode ? Pango.Style.Italic : Pango.Style.Normal;

                store.AppendValues(icon, method, file, frame.Language, "0x" + frame.Address.ToString("x"), null,
                                   style, frame, !options.AllowDisplayStringEvaluation);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// The deepest stack frame with source above the CurrentFrame
 /// </summary>
 public static StackFrame GetCurrentVisibleFrame()
 {
     if (currentBacktrace != null && currentFrame != -1)
     {
         for (int idx = currentFrame; idx < currentBacktrace.FrameCount; idx++)
         {
             var frame = currentBacktrace.GetFrame(currentFrame);
             if (!frame.IsExternalCode)
             {
                 return(frame);
             }
         }
     }
     return(null);
 }
Exemplo n.º 7
0
        // Token: 0x060000FE RID: 254 RVA: 0x00004E40 File Offset: 0x00003040
        public StackFrame[] GetBacktrace()
        {
            ThreadInfo threadInfo = this.GetThreadInfo();
            Backtrace  backtrace  = threadInfo.Backtrace;

            if (backtrace == null)
            {
                return(null);
            }
            StackFrame[] array = new StackFrame[backtrace.FrameCount];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = new StackFrame(this, backtrace.GetFrame(i), this.eventSender);
            }
            return(array);
        }
Exemplo n.º 8
0
        public int EnumFrameInfo(uint dwFieldSpec, uint nRadix, out IEnumDebugFrameInfo2 ppEnum)
        {
            Backtrace trace = _engine.SoftDebugger.ActiveBacktrace; //_monoThread.Backtrace;

            FRAMEINFO[] frames = new FRAMEINFO[trace.FrameCount];

            for (int x = 0; x < trace.FrameCount; x++)
            {
                MonoStackFrame frame = new MonoStackFrame(_engine, this, trace.GetFrame(x));

                frames[x] = frame.GetFrameInfo(dwFieldSpec);
            }

            ppEnum = new MonoFrameInfoEnumerator(frames);

            return(S_OK);
        }
Exemplo n.º 9
0
        // Token: 0x060000FD RID: 253 RVA: 0x00004E04 File Offset: 0x00003004
        public StackFrame GetFrame()
        {
            ThreadInfo threadInfo = this.GetThreadInfo();
            Backtrace  backtrace  = threadInfo.Backtrace;

            if (backtrace == null)
            {
                return(null);
            }
            var frame = backtrace.GetFrame(0);

            if (frame == null)
            {
                return(null);
            }
            return(new StackFrame(this, frame, this.eventSender));
        }
Exemplo n.º 10
0
        static void SetSourceCodeFrame()
        {
            Backtrace bt = DebuggingService.CurrentCallStack;

            if (bt != null)
            {
                for (int n = 0; n < bt.FrameCount; n++)
                {
                    StackFrame sf = bt.GetFrame(n);
                    if (!sf.IsExternalCode && !string.IsNullOrEmpty(sf.SourceLocation.Filename) && System.IO.File.Exists(sf.SourceLocation.Filename) && sf.SourceLocation.Line != -1)
                    {
                        if (n != DebuggingService.CurrentFrameIndex)
                        {
                            DebuggingService.CurrentFrameIndex = n;
                        }
                        break;
                    }
                }
            }
        }