예제 #1
0
        static void Main(string[] args)
        {
            ElfReader   elf;
            DwarfReader dwarf;

            DwarfReader.LineResult lineRes;
            MappedFileCursor       sectionCursor;
            MappedFileCursor       unitCursor;

            ElfReader.SectionInfo section;
            uint pos;
            uint size;
            bool fDumpOnly = false;

            Debug.WriteLine(args[0]);
            if (args.Length > 1 && args[1] == "/d")
            {
                fDumpOnly = true;
            }
            elf           = new ElfReader(args[0]);
            dwarf         = new DwarfReader(elf);
            section       = dwarf.OpenDebugLines();
            sectionCursor = section.Cursor;

            while (!sectionCursor.AtEnd)
            {
                size = dwarf.GetLineInfoSize(sectionCursor);
                if (size == 0)
                {
                    continue;                           // skip unit, cursor already advanced
                }
                unitCursor          = new MappedFileCursor(sectionCursor, size);
                pos                 = unitCursor.Next;
                sectionCursor.Next += size;
                lineRes             = dwarf.GetLineInfo(unitCursor);
                if (fDumpOnly)
                {
                    DumpLines(lineRes);
                    continue;
                }

                lineRes.lines = dwarf.FilterLines(lineRes.lines);
                //DumpLines(lineRes);
                unitCursor.Next = pos;
                dwarf.GenLineInfo(unitCursor, lineRes.lines);
            }
            elf.Close();
        }
예제 #2
0
 public DwarfReader(ElfReader elf)
 {
     m_elf = elf;
 }