From cc7580dd344851907ef3003b838da0aa41f6aaf2 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Thu, 18 Dec 2014 12:21:33 +0100 Subject: [PATCH] Only disassemble the text segment --- src/disassembler/llvm/LLVMDisassembler.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/disassembler/llvm/LLVMDisassembler.cxx b/src/disassembler/llvm/LLVMDisassembler.cxx index 3642c5e..6b3402e 100644 --- a/src/disassembler/llvm/LLVMDisassembler.cxx +++ b/src/disassembler/llvm/LLVMDisassembler.cxx @@ -129,6 +129,16 @@ LLVMDisassembler::~LLVMDisassembler() { } Function* LLVMDisassembler::disassembleFunctionAt(uint64_t address, const std::string& name) { + SectionRef text_section = sections[".text"]; + uint64_t base_address, size; + text_section.getAddress(base_address); + text_section.getSize(size); + + if (address < base_address || + address >= base_address + size) { + return NULL; + } + if (functions.find(address) != functions.end()) { return functions[address]; } -- 2.39.5