[RuntimeDyld] Fix a bug in debugging output: all sections should be dumped

before any relocations have been applied, and again after all relocations have
been applied.

Previously each section was dumped before and after relocations targetting it
were applied, but this only shows the impact of relocations that point to other
symbols in the same section.

llvm-svn: 247335
This commit is contained in:
Lang Hames 2015-09-10 20:44:36 +00:00
parent 2e4ca848f4
commit 79fce4711b
1 changed files with 13 additions and 2 deletions

View File

@ -82,6 +82,12 @@ static void dumpSectionMemory(const SectionEntry &S, StringRef State) {
void RuntimeDyldImpl::resolveRelocations() { void RuntimeDyldImpl::resolveRelocations() {
MutexGuard locked(lock); MutexGuard locked(lock);
// Print out the sections prior to relocation.
DEBUG(
for (int i = 0, e = Sections.size(); i != e; ++i)
dumpSectionMemory(Sections[i], "before relocations");
);
// First, resolve relocations associated with external symbols. // First, resolve relocations associated with external symbols.
resolveExternalSymbols(); resolveExternalSymbols();
@ -94,11 +100,16 @@ void RuntimeDyldImpl::resolveRelocations() {
uint64_t Addr = Sections[i].LoadAddress; uint64_t Addr = Sections[i].LoadAddress;
DEBUG(dbgs() << "Resolving relocations Section #" << i << "\t" DEBUG(dbgs() << "Resolving relocations Section #" << i << "\t"
<< format("%p", (uintptr_t)Addr) << "\n"); << format("%p", (uintptr_t)Addr) << "\n");
DEBUG(dumpSectionMemory(Sections[i], "before relocations"));
resolveRelocationList(Relocations[i], Addr); resolveRelocationList(Relocations[i], Addr);
DEBUG(dumpSectionMemory(Sections[i], "after relocations"));
Relocations.erase(i); Relocations.erase(i);
} }
// Print out sections after relocation.
DEBUG(
for (int i = 0, e = Sections.size(); i != e; ++i)
dumpSectionMemory(Sections[i], "after relocations");
);
} }
void RuntimeDyldImpl::mapSectionAddress(const void *LocalAddress, void RuntimeDyldImpl::mapSectionAddress(const void *LocalAddress,