[JITLink] Display host -> target address mapping in debugging output.
authorLang Hames <lhames@gmail.com>
Fri, 19 Jun 2020 16:59:23 +0000 (09:59 -0700)
committerLang Hames <lhames@gmail.com>
Fri, 19 Jun 2020 17:05:02 +0000 (10:05 -0700)
This can be helpful for sanity checking JITLink memory manager behavior.

llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp

index ec6681c..1d76a49 100644 (file)
@@ -267,11 +267,12 @@ Error JITLinkerBase::allocateSegments(const SegmentLayoutMap &Layout) {
     return AllocOrErr.takeError();
 
   LLVM_DEBUG({
-    dbgs() << "JIT linker got working memory:\n";
+    dbgs() << "JIT linker got memory (working -> target):\n";
     for (auto &KV : Layout) {
       auto Prot = static_cast<sys::Memory::ProtectionFlags>(KV.first);
       dbgs() << "  " << Prot << ": "
-             << (const void *)Alloc->getWorkingMemory(Prot).data() << "\n";
+             << (const void *)Alloc->getWorkingMemory(Prot).data() << " -> "
+             << formatv("{0:x16}", Alloc->getTargetMemory(Prot)) << "\n";
     }
   });