public DisassembledFileBase ParseFile(string fileName, ILogger logger)
        {
            using (var elfFileParser = new ELF_Reader(fileName))
            {
                var decompiledFile = new ELF_CompiledFile(elfFileParser);

                var dataSection = new DataSegmentAccessor(decompiledFile.DataBytes, decompiledFile.DataSegmentStartingAddress, decompiledFile.DataSegmentSize);

                var textSegmentParser = new TextSegmentParser();
                IEnumerable <DisassembledInstruction> rawTextSegment = textSegmentParser.ParseTextSegment(decompiledFile.RawInstructions);
                var textSection = new TextSegmentAccessor(rawTextSegment, decompiledFile.TextSegmentStartingAddress);

                //TODO: fix when we have better sectioning logic.
                var dummyExtern = new List <byte>();

                return(new DisassembledElfFile(dataSection, textSection, dummyExtern, decompiledFile.SymbolTable));
            }
        }
示例#2
0
        public DisassembledFileBase ParseFile(string fileName, ILogger logger)
        {
            JefFile jefFile = JefFile.ParseFile(fileName);

            var textParser = new TextSegmentParser();
            IEnumerable <DisassembledInstruction> instructions = textParser.ParseTextSegment(jefFile.TextElements);

            int dataSegSize = 0;

            foreach (MetadataElement elem in jefFile.DataMetadata)
            {
                dataSegSize += elem.Size;
            }

            var dataSegment = new DataSegmentAccessor(jefFile.DataElements, jefFile.BaseDataAddress, dataSegSize);

            var textSegment = new TextSegmentAccessor(instructions, jefFile.BaseTextAddress);

            return(new DisassembledJefFile(dataSegment, textSegment, jefFile.ExternElements,
                                           jefFile.SymbolTable, jefFile.DataMetadata, jefFile.DebugData));
        }