示例#1
0
        void LoadSourceFileIntoEditor(string file, sstSrcModule.SourceFileInformation?f = null)
        {
            // Assume all files not be modified since the last time of load. Better performance.
            if (file == lastOpenedFile)
            {
                return;
            }

            if (!File.Exists(file))
            {
                MessageBox.Show(file + " cannot be found!");
                return;
            }

            if (!f.HasValue)
            {
                f = GetFileInfo(dbg.MainProcess.MainModule, file);
            }

            MarkerStrategy.RemoveAll();
            currentFrameMarker         = null;
            editor.Load(lastOpenedFile = file);
            editor.IsReadOnly          = true;

            // Highlight all lines where breakpoints can be set
            var lines = new List <int>();

            if (f.HasValue)
            {
                foreach (var seg in f.Value.Segments)
                {
                    for (int i = 0; i < seg.Lines.Length; i++)
                    {
                        var ln     = seg.Lines[i];
                        var marker = new DebugInfoAvailableMarker(MarkerStrategy, editor.Document, ln, ln);
                        MarkerStrategy.Add(marker);
                        marker.Redraw();
                        marker.Tag = seg.Offsets[i];

                        // And highlight previously set breakpoints
                        var bp = dbg.Breakpoints.ByAddress(dbg.MainProcess.MainModule.ToVirtualAddress((int)seg.Offsets[i]));
                        if (bp != null)
                        {
                            var bpM = new BreakpointMarker(MarkerStrategy, bp, editor.Document, ln, ln);
                            MarkerStrategy.Add(bpM);
                            bpM.Redraw();
                        }
                    }
                }
            }
        }
示例#2
0
        void HighlightCurrentInstruction(DebugThread th)
        {
            if (currentFrameMarker != null)
            {
                currentFrameMarker.Delete();
            }

            ushort line = 0;
            string file = null;

            if (th.OwnerProcess.MainModule.ContainsSymbolData &&
                th.OwnerProcess.MainModule.ModuleMetaInfo.TryDetermineCodeLocation((uint)th.CurrentInstruction.ToInt32(), out file, out line))
            {
                LoadSourceFileIntoEditor(file);

                currentFrameMarker = new CurrentFrameMarker(MarkerStrategy, editor.Document, line);
                MarkerStrategy.Add(currentFrameMarker);
                currentFrameMarker.Redraw();
            }
        }
示例#3
0
        void LoadSourceFileIntoEditor(string file, sstSrcModule.SourceFileInformation? f = null)
        {
            // Assume all files not be modified since the last time of load. Better performance.
            if (file == lastOpenedFile)
                return;

            if (!File.Exists(file))
            {
                MessageBox.Show(file + " cannot be found!");
                return;
            }

            if (!f.HasValue)
                f = GetFileInfo(dbg.MainProcess.MainModule, file);

            MarkerStrategy.RemoveAll();
            currentFrameMarker = null;
            editor.Load(lastOpenedFile = file);
            editor.IsReadOnly = true;

            // Highlight all lines where breakpoints can be set
            var lines = new List<int>();

            if(f.HasValue)
                foreach (var seg in f.Value.Segments)
                    for (int i = 0; i < seg.Lines.Length; i++)
                    {
                        var ln = seg.Lines[i];
                        var marker = new DebugInfoAvailableMarker(MarkerStrategy, editor.Document, ln, ln);
                        MarkerStrategy.Add(marker);
                        marker.Redraw();
                        marker.Tag = seg.Offsets[i];

                        // And highlight previously set breakpoints
                        var bp = dbg.Breakpoints.ByAddress(dbg.MainProcess.MainModule.ToVirtualAddress((int)seg.Offsets[i]));
                        if (bp != null)
                        {
                            var bpM = new BreakpointMarker(MarkerStrategy, bp, editor.Document, ln, ln);
                            MarkerStrategy.Add(bpM);
                            bpM.Redraw();
                        }
                    }
        }
示例#4
0
        void HighlightCurrentInstruction(DebugThread th)
        {
            if (currentFrameMarker != null)
                currentFrameMarker.Delete();

            ushort line = 0;
            string file = null;

            if (th.OwnerProcess.MainModule.ContainsSymbolData &&
                th.OwnerProcess.MainModule.ModuleMetaInfo.TryDetermineCodeLocation((uint)th.CurrentInstruction.ToInt32(), out file, out line))
            {
                LoadSourceFileIntoEditor(file);

                currentFrameMarker = new CurrentFrameMarker(MarkerStrategy, editor.Document, line);
                MarkerStrategy.Add(currentFrameMarker);
                currentFrameMarker.Redraw();
            }
        }