Only disassemble the text segment
authorChristoph Egger <siccegge@faui49man12.informatik.uni-erlangen.de>
Thu, 18 Dec 2014 11:21:33 +0000 (12:21 +0100)
committerChristoph Egger <siccegge@faui49man12.informatik.uni-erlangen.de>
Thu, 18 Dec 2014 11:21:33 +0000 (12:21 +0100)
src/disassembler/llvm/LLVMDisassembler.cxx

index 3642c5ed74b7492665d385b540bb0444234461e5..6b3402eb0b2414d56c4b415f7467e3c29d7e33cd 100644 (file)
@@ -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];
     }