[PATCH] D59490: [DebugInfo] IntelJitEventListener follow up for "add SectionedAddress to DebugInfo interfaces"

Brock Wyma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 07:41:45 PDT 2019


bwyma created this revision.
bwyma added reviewers: avl, dblaikie.

Following change [https://reviews.llvm.org/rL354972] the Intel JIT Listener would not report line table information because the section index didn't match.

There was a similar issue with the PerfJitEventListener here: [https://reviews.llvm.org/D59189]

This patch performs the section index lookup when building the object address used to query the line table information.


https://reviews.llvm.org/D59490

Files:
  lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp


Index: lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
===================================================================
--- lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
+++ lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
@@ -141,6 +141,15 @@
     uint64_t Addr = *AddrOrErr;
     uint64_t Size = P.second;
 
+    auto SecOrErr = Sym.getSection();
+    if (!SecOrErr) {
+      // TODO: Actually report errors helpfully.
+      consumeError(SecOrErr.takeError());
+      continue;
+    }
+    object::section_iterator Sec = *SecOrErr;
+    uint64_t Index = Sec->getIndex();
+
     // Record this address in a local vector
     Functions.push_back((void*)Addr);
 
@@ -149,7 +158,8 @@
       FunctionDescToIntelJITFormat(*Wrapper, Name->data(), Addr, Size);
     // TODO: it is neccessary to set proper SectionIndex here.
     // object::SectionedAddress::UndefSection works for only absolute addresses.
-    DILineInfoTable Lines = Context->getLineInfoForAddressRange({Addr, object::SectionedAddress::UndefSection}, Size);
+    DILineInfoTable Lines =
+      Context->getLineInfoForAddressRange({Addr, Index}, Size);
     DILineInfoTable::iterator Begin = Lines.begin();
     DILineInfoTable::iterator End = Lines.end();
     for (DILineInfoTable::iterator It = Begin; It != End; ++It) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59490.191081.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190318/ea3748d4/attachment.bin>


More information about the llvm-commits mailing list