diff options
author | Martin Nowack <martin@se.inf.tu-dresden.de> | 2013-11-13 23:43:19 +0100 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2013-12-19 15:45:03 +0000 |
commit | a329a133d66a86249a3b1ce8025a88f4c0b197c4 (patch) | |
tree | 54ae11e4465bf1e08a62d60218c9ab0ff6dac469 | |
parent | 2c04a50f501d861da765ee8d3a0d3531dcbd52af (diff) | |
download | klee-a329a133d66a86249a3b1ce8025a88f4c0b197c4.tar.gz |
Simplify acquisition of debug informtion for instruction info with newer LLVM versions
With newer LLVM versions (starting with LLVM 2.7) debug information are directly associated as meta data with each instruction. Therefore, debug information can be acquired directly from each instruction.
-rw-r--r-- | lib/Module/InstructionInfoTable.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/Module/InstructionInfoTable.cpp b/lib/Module/InstructionInfoTable.cpp index 301db1ff..4285c6b0 100644 --- a/lib/Module/InstructionInfoTable.cpp +++ b/lib/Module/InstructionInfoTable.cpp @@ -111,6 +111,26 @@ InstructionInfoTable::InstructionInfoTable(Module *m) const std::string *initialFile = &dummyString; unsigned initialLine = 0; +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 3) + for (inst_iterator it = inst_begin(fnIt), ie = inst_end(fnIt); it != ie; + ++it) { + const std::string *initialFile = &dummyString; + unsigned initialLine = 0; + Instruction *instr = &*it; + unsigned assemblyLine = 0; + + std::map<const Instruction*, unsigned>::const_iterator ltit = + lineTable.find(instr); + if (ltit!=lineTable.end()) + assemblyLine = ltit->second; + getInstructionDebugInfo(instr, initialFile, initialLine); + infos.insert(std::make_pair(instr, + InstructionInfo(id++, + *initialFile, + initialLine, + assemblyLine))); + } +#else // It may be better to look for the closest stoppoint to the entry // following the CFG, but it is not clear that it ever matters in // practice. @@ -118,7 +138,7 @@ InstructionInfoTable::InstructionInfoTable(Module *m) it != ie; ++it) if (getInstructionDebugInfo(&*it, initialFile, initialLine)) break; - + typedef std::map<BasicBlock*, std::pair<const std::string*,unsigned> > sourceinfo_ty; sourceinfo_ty sourceInfo; @@ -167,6 +187,7 @@ InstructionInfoTable::InstructionInfoTable(Module *m) } } while (!worklist.empty()); } +#endif } } |