1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[ORC] Fix hex printing of uint64_t values.

A plain "%x" format string will drop the high 32-bits. Use the PRIx64 macro
instead.

llvm-svn: 345696
This commit is contained in:
Lang Hames 2018-10-31 05:16:14 +00:00
parent 4b5a78ebda
commit 503d3817ed
3 changed files with 32 additions and 28 deletions

View File

@ -118,30 +118,33 @@ public:
Unmapped.back().RemoteCodeAddr =
Client.reserveMem(Id, CodeSize, CodeAlign);
LLVM_DEBUG(dbgs() << " code: "
<< format("0x%016x", Unmapped.back().RemoteCodeAddr)
<< " (" << CodeSize << " bytes, alignment "
<< CodeAlign << ")\n");
LLVM_DEBUG(
dbgs() << " code: "
<< format("0x%016" PRIx64, Unmapped.back().RemoteCodeAddr)
<< " (" << CodeSize << " bytes, alignment " << CodeAlign
<< ")\n");
}
if (RODataSize != 0) {
Unmapped.back().RemoteRODataAddr =
Client.reserveMem(Id, RODataSize, RODataAlign);
LLVM_DEBUG(dbgs() << " ro-data: "
<< format("0x%016x", Unmapped.back().RemoteRODataAddr)
<< " (" << RODataSize << " bytes, alignment "
<< RODataAlign << ")\n");
LLVM_DEBUG(
dbgs() << " ro-data: "
<< format("0x%016" PRIx64, Unmapped.back().RemoteRODataAddr)
<< " (" << RODataSize << " bytes, alignment " << RODataAlign
<< ")\n");
}
if (RWDataSize != 0) {
Unmapped.back().RemoteRWDataAddr =
Client.reserveMem(Id, RWDataSize, RWDataAlign);
LLVM_DEBUG(dbgs() << " rw-data: "
<< format("0x%016x", Unmapped.back().RemoteRWDataAddr)
<< " (" << RWDataSize << " bytes, alignment "
<< RWDataAlign << ")\n");
LLVM_DEBUG(
dbgs() << " rw-data: "
<< format("0x%016" PRIx64, Unmapped.back().RemoteRWDataAddr)
<< " (" << RWDataSize << " bytes, alignment " << RWDataAlign
<< ")\n");
}
}
@ -269,9 +272,9 @@ public:
for (auto &Alloc : Allocs) {
NextAddr = alignTo(NextAddr, Alloc.getAlign());
Dyld.mapSectionAddress(Alloc.getLocalAddress(), NextAddr);
LLVM_DEBUG(dbgs() << " "
<< static_cast<void *>(Alloc.getLocalAddress())
<< " -> " << format("0x%016x", NextAddr) << "\n");
LLVM_DEBUG(
dbgs() << " " << static_cast<void *>(Alloc.getLocalAddress())
<< " -> " << format("0x%016" PRIx64, NextAddr) << "\n");
Alloc.setRemoteAddress(NextAddr);
// Only advance NextAddr if it was non-null to begin with,
@ -293,7 +296,7 @@ public:
LLVM_DEBUG(dbgs() << " copying section: "
<< static_cast<void *>(Alloc.getLocalAddress())
<< " -> "
<< format("0x%016x", Alloc.getRemoteAddress())
<< format("0x%016" PRIx64, Alloc.getRemoteAddress())
<< " (" << Alloc.getSize() << " bytes)\n";);
if (Client.writeMem(Alloc.getRemoteAddress(), Alloc.getLocalAddress(),
@ -306,7 +309,8 @@ public:
<< (Permissions & sys::Memory::MF_WRITE ? 'W' : '-')
<< (Permissions & sys::Memory::MF_EXEC ? 'X' : '-')
<< " permissions on block: "
<< format("0x%016x", RemoteSegmentAddr) << "\n");
<< format("0x%016" PRIx64, RemoteSegmentAddr)
<< "\n");
if (Client.setProtections(Id, RemoteSegmentAddr, Permissions))
return true;
}
@ -510,8 +514,8 @@ public:
/// Call the int(void) function at the given address in the target and return
/// its result.
Expected<int> callIntVoid(JITTargetAddress Addr) {
LLVM_DEBUG(dbgs() << "Calling int(*)(void) " << format("0x%016x", Addr)
<< "\n");
LLVM_DEBUG(dbgs() << "Calling int(*)(void) "
<< format("0x%016" PRIx64, Addr) << "\n");
return callB<exec::CallIntVoid>(Addr);
}
@ -520,15 +524,15 @@ public:
Expected<int> callMain(JITTargetAddress Addr,
const std::vector<std::string> &Args) {
LLVM_DEBUG(dbgs() << "Calling int(*)(int, char*[]) "
<< format("0x%016x", Addr) << "\n");
<< format("0x%016" PRIx64, Addr) << "\n");
return callB<exec::CallMain>(Addr, Args);
}
/// Call the void() function at the given address in the target and wait for
/// it to finish.
Error callVoidVoid(JITTargetAddress Addr) {
LLVM_DEBUG(dbgs() << "Calling void(*)(void) " << format("0x%016x", Addr)
<< "\n");
LLVM_DEBUG(dbgs() << "Calling void(*)(void) "
<< format("0x%016" PRIx64, Addr) << "\n");
return callB<exec::CallVoidVoid>(Addr);
}

View File

@ -170,7 +170,8 @@ raw_ostream &operator<<(raw_ostream &OS, const JITSymbolFlags &Flags) {
}
raw_ostream &operator<<(raw_ostream &OS, const JITEvaluatedSymbol &Sym) {
return OS << format("0x%016x", Sym.getAddress()) << " " << Sym.getFlags();
return OS << format("0x%016" PRIx64, Sym.getAddress()) << " "
<< Sym.getFlags();
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap::value_type &KV) {
@ -1392,9 +1393,8 @@ JITDylib::lookupImpl(std::shared_ptr<AsynchronousSymbolQuery> &Q,
void JITDylib::dump(raw_ostream &OS) {
ES.runSessionLocked([&, this]() {
OS << "JITDylib \"" << JITDylibName
<< "\" (ES: " << format("0x%016x", reinterpret_cast<uintptr_t>(&ES))
<< "):\n"
OS << "JITDylib \"" << JITDylibName << "\" (ES: "
<< format("0x%016" PRIx64, reinterpret_cast<uintptr_t>(&ES)) << "):\n"
<< "Search order: [";
for (auto &KV : SearchOrder)
OS << " (\"" << KV.first->getName() << "\", "
@ -1405,7 +1405,7 @@ void JITDylib::dump(raw_ostream &OS) {
for (auto &KV : Symbols) {
OS << " \"" << *KV.first << "\": ";
if (auto Addr = KV.second.getAddress())
OS << format("0x%016x", Addr) << ", " << KV.second.getFlags();
OS << format("0x%016" PRIx64, Addr) << ", " << KV.second.getFlags();
else
OS << "<not resolved>";
if (KV.second.getFlags().isLazy() ||

View File

@ -92,7 +92,7 @@ JITTargetAddress JITCompileCallbackManager::executeCompileCallback(
{
raw_string_ostream ErrMsgStream(ErrMsg);
ErrMsgStream << "No compile callback for trampoline at "
<< format("0x%016x", TrampolineAddr);
<< format("0x%016" PRIx64, TrampolineAddr);
}
ES.reportError(
make_error<StringError>(std::move(ErrMsg), inconvertibleErrorCode()));