From: Christoph Egger Date: Tue, 3 Mar 2015 13:10:31 +0000 (+0100) Subject: Fix Loading of symbolless files X-Git-Tag: v0.1~86 X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=db08681ab30cdc2a322663b836d215cacedea71a;p=frida%2Ffrida.git Fix Loading of symbolless files The last commit unconditionally enabled disassembling from the start of the text section. On a sample binary (/bin/true) this resulted in a BasicBlock with a size of several TiB which won't terminate properly. --- diff --git a/src/core/InformationManager.hxx b/src/core/InformationManager.hxx index 03cb3b8..5681842 100644 --- a/src/core/InformationManager.hxx +++ b/src/core/InformationManager.hxx @@ -50,6 +50,7 @@ public: Function* getFunction(uint64_t address); BasicBlock* getBasicBlock(uint64_t address); + bool hasFunctions() const {return functions.size() != 0;} /* Protocoll: * diff --git a/src/disassembler/llvm/LLVMDisassembler.cxx b/src/disassembler/llvm/LLVMDisassembler.cxx index 773a518..aeca994 100644 --- a/src/disassembler/llvm/LLVMDisassembler.cxx +++ b/src/disassembler/llvm/LLVMDisassembler.cxx @@ -335,10 +335,12 @@ void LLVMDisassembler::disassemble() { disassembleFunctionAt(_entryAddress, s.str()); } - uint64_t text_entry; - text_section.getAddress(text_entry); - LOG4CXX_INFO(logger, "No Symbols found, starting at the beginning of the text segment"); - disassembleFunctionAt(text_entry); + if (!manager->hasFunctions()) { + uint64_t text_entry; + text_section.getAddress(text_entry); + LOG4CXX_INFO(logger, "No Symbols found, starting at the beginning of the text segment"); + disassembleFunctionAt(text_entry); + } } template