public static SubsectionData Read(long lfaBase, DirectoryEntryHeader hdr, BinaryReader r)
        {
            SubsectionData sd = null;

            switch (hdr.Type)
            {
            case SubsectionType.sstModule:
                sd = new sstModule();
                break;

            case SubsectionType.sstSrcModule:
                sd = new sstSrcModule();
                break;

            case SubsectionType.sstLibraries:
                sd = new sstLibraries();
                break;

            case SubsectionType.sstGlobalSym:
                sd = new sstGlobalSym();
                break;

            case SubsectionType.sstGlobalTypes:
                sd = new sstGlobalTypes();
                break;

            case SubsectionType.sstSegName:
                sd = new sstSegName();
                break;

            case SubsectionType.sstFileIndex:
                sd = new sstFileIndex();
                break;
            }

            if (sd != null)
            {
                sd.Header             = hdr;
                r.BaseStream.Position = lfaBase + hdr.ContentOffset;
                sd.Read(r);
            }

            return(sd);
        }
        public static SubsectionData Read(long lfaBase, DirectoryEntryHeader hdr, BinaryReader r)
        {
            SubsectionData sd = null;

            switch (hdr.Type)
            {
                case SubsectionType.sstModule:
                    sd = new sstModule();
                    break;
                case SubsectionType.sstSrcModule:
                    sd = new sstSrcModule();
                    break;
                case SubsectionType.sstLibraries:
                    sd = new sstLibraries();
                    break;
                case SubsectionType.sstGlobalSym:
                    sd = new sstGlobalSym();
                    break;
                case SubsectionType.sstGlobalTypes:
                    sd = new sstGlobalTypes();
                    break;
                case SubsectionType.sstSegName:
                    sd = new sstSegName();
                    break;
                case SubsectionType.sstFileIndex:
                    sd = new sstFileIndex();
                    break;
            }

            if (sd != null)
            {
                sd.Header = hdr;
                r.BaseStream.Position = lfaBase + hdr.ContentOffset;
                sd.Read(r);
            }

            return sd;
        }
Example #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();
                        }
                    }
        }