[JITLink] Display host -> target address mapping in debugging output.

This can be helpful for sanity checking JITLink memory manager behavior.
This commit is contained in:
Lang Hames 2020-06-19 09:59:23 -07:00
parent 7e825abd57
commit bf783a6aa8
1 changed files with 3 additions and 2 deletions

View 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";
}
});