[PATCH] Make it easier to use DwarfContext with MCJIT

Eric Christopher echristo at gmail.com
Thu May 21 11:44:39 PDT 2015


Added some comments, looks like bits overlap with the other patch. Some more inline comments as well. I'll take another look after you get this stuff.

-eric


REPOSITORY
  rL LLVM

================
Comment at: include/llvm/DebugInfo/DIContext.h:147-156
@@ +146,12 @@
+
+  virtual uint64_t getSectionLoadAddress(StringRef Name) const = 0;
+
+  // If available in a convenient form the LoadedObjectInfo can provide
+  // the contents of the section. This is especially useful for cases
+  // where the loaded object resides in memory (as opposed to being remote)
+  virtual bool getLoadedSectionContents(StringRef Name, StringRef &Data) const {
+    return false;
+  }
+
+  virtual LoadedObjectInfo *clone() const = 0;
+};
----------------
Needs doxygen docs for the functions.

================
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:557-562
@@ -555,1 +556,8 @@
+
+    if (L && L->getLoadedSectionContents(name,data))
+    {
+      AlreadyRelocated = true;
+    } else {
+      Section.getContents(data);
+    }
 
----------------
Style.

================
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:679-704
@@ -661,1 +678,28 @@
+            Sym->getAddress(SymAddr);
+        } else {
+          if (Sym != Obj.symbol_end()) {
+            Sym->getAddress(SymAddr);
+            Sym->getSection(RSec);
+            if (RSec != Obj.section_end()) {
+              StringRef SecName;
+              RSec->getName(SecName);
+              SectionLoadAddress = L->getSectionLoadAddress(SecName);
+              if (SectionLoadAddress != 0) {
+                uint64_t SecAddr = RSec->getAddress();
+                SymAddr += SectionLoadAddress - SecAddr;
+              }
+            }
+          } else {
+            RSec = Reloc.getSection();
+            if (RSec != Obj.section_end()) {
+              SymAddr = RSec->getAddress();
+              StringRef SecName;
+              RSec->getName(SecName);
+              SectionLoadAddress = L->getSectionLoadAddress(SecName);
+              if (SectionLoadAddress != 0) {
+                SymAddr = SectionLoadAddress;
+              }
+            }
+          }
+        }
 
----------------
Can you comment this out? It looks a little odd and it's hard to get straight.

http://reviews.llvm.org/D6961

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list