summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1691fa2)
raw | patch | inline | side by side (parent: 1691fa2)
author | Alexey Bataev <a.bataev@hotmail.com> | |
Mon, 15 Dec 2014 04:45:43 +0000 (04:45 +0000) | ||
committer | Alexey Bataev <a.bataev@hotmail.com> | |
Mon, 15 Dec 2014 04:45:43 +0000 (04:45 +0000) |
The line mapping information for dynamic code is reported incorrectly. It causes VTune to map LLVM generated code to source lines incorrectly. This patch fix this issue.
Patch by Denis Pravdin.
Differential Revision: http://reviews.llvm.org/D6603
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224229 91177308-0d34-0410-b5e6-96231b3b80d8
Patch by Denis Pravdin.
Differential Revision: http://reviews.llvm.org/D6603
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224229 91177308-0d34-0410-b5e6-96231b3b80d8
lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp | patch | blob | history | |
tools/llvm-jitlistener/llvm-jitlistener.cpp | patch | blob | history |
diff --git a/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp b/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
index c35e5244ecd4403990bb9ec986bbfa8d70c81d53..63a1b9ce8b546f9dadf301437c9340403ae24058 100644 (file)
FunctionMessage.line_number_size = 0;
FunctionMessage.line_number_table = 0;
} else {
+ // Source line information for the address range is provided as
+ // a code offset for the start of the corresponding sub-range and
+ // a source line. JIT API treats offsets in LineNumberInfo structures
+ // as the end of the corresponding code region. The start of the code
+ // is taken from the previous element. Need to shift the elements.
+
+ LineNumberInfo last = LineInfo.back();
+ last.Offset = FunctionMessage.method_size;
+ LineInfo.push_back(last);
+ for (size_t i = LineInfo.size() - 2; i > 0; --i)
+ LineInfo[i].LineNumber = LineInfo[i - 1].LineNumber;
+
SourceFileName = Lines.front().second.FileName;
FunctionMessage.source_file_name = const_cast<char *>(SourceFileName.c_str());
FunctionMessage.line_number_size = LineInfo.size();
diff --git a/tools/llvm-jitlistener/llvm-jitlistener.cpp b/tools/llvm-jitlistener/llvm-jitlistener.cpp
index 0f85a85e19c623288fc8d71fcb3118e9b5698374..486d30ee748f8322bb7899d7b2e69da70a65043b 100644 (file)
TheJIT.reset(EngineBuilder(std::move(TheModule))
.setEngineKind(EngineKind::JIT)
.setErrorStr(&Error)
- .setMCJITMemoryManager(MemMgr)
+ .setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager>(MemMgr))
.create());
if (Error.empty() == false)
errs() << Error;