[llvm] r360383 - [JITLink] Improve/fix some JITLink debugging output.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 15:03:58 PDT 2019
Author: lhames
Date: Thu May 9 15:03:57 2019
New Revision: 360383
URL: http://llvm.org/viewvc/llvm-project?rev=360383&view=rev
Log:
[JITLink] Improve/fix some JITLink debugging output.
Adds full edge details (rather than just edge targets) when out-of-range errors
are generated. Also fixes a bug where debugging output accessed an invalidated
DenseMap iterator by moving the debugging output above the invalidation point.
Modified:
llvm/trunk/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.cpp
llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
Modified: llvm/trunk/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.cpp?rev=360383&r1=360382&r2=360383&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.cpp Thu May 9 15:03:57 2019
@@ -338,21 +338,21 @@ Error MachOAtomGraphBuilder::addNonCusto
auto AltEntryStartItr = AltEntryStarts.find(&*AltEntryPred);
if (AltEntryStartItr != AltEntryStarts.end()) {
// If the predecessor was an alt-entry atom then re-use its value.
- AltEntryStarts[DA] = AltEntryStartItr->second;
LLVM_DEBUG({
dbgs() << " " << *DA << " -> " << *AltEntryStartItr->second
<< " (based on existing entry for " << *AltEntryPred << ")\n";
});
+ AltEntryStarts[DA] = AltEntryStartItr->second;
} else {
// If the predecessor does not have an entry then add an entry for this
// atom (i.e. the alt_entry atom) and a self-reference entry for the
/// predecessory atom that is the start of this chain.
- AltEntryStarts[&*AltEntryPred] = &*AltEntryPred;
- AltEntryStarts[DA] = &*AltEntryPred;
LLVM_DEBUG({
dbgs() << " " << *AltEntryPred << " -> " << *AltEntryPred << "\n"
<< " " << *DA << " -> " << *AltEntryPred << "\n";
});
+ AltEntryStarts[&*AltEntryPred] = &*AltEntryPred;
+ AltEntryStarts[DA] = &*AltEntryPred;
}
}
Modified: llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp?rev=360383&r1=360382&r2=360383&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp Thu May 9 15:03:57 2019
@@ -448,11 +448,13 @@ private:
return MachOAtomGraphBuilder_x86_64(**MachOObj).buildGraph();
}
- static Error targetOutOfRangeError(const Edge &E) {
+ static Error targetOutOfRangeError(const Atom &A, const Edge &E) {
std::string ErrMsg;
{
raw_string_ostream ErrStream(ErrMsg);
- ErrStream << "Target \"" << E.getTarget() << "\" out of range";
+ ErrStream << "Relocation target out of range: ";
+ printEdge(ErrStream, A, E, getMachOX86RelocationKindName(E.getKind()));
+ ErrStream << "\n";
}
return make_error<JITLinkError>(std::move(ErrMsg));
}
@@ -471,7 +473,7 @@ private:
E.getTarget().getAddress() - (FixupAddress + 4) + E.getAddend();
if (Value < std::numeric_limits<int32_t>::min() ||
Value > std::numeric_limits<int32_t>::max())
- return targetOutOfRangeError(E);
+ return targetOutOfRangeError(A, E);
*(little32_t *)FixupPtr = Value;
break;
}
@@ -489,7 +491,7 @@ private:
E.getTarget().getAddress() - (FixupAddress + Delta) + E.getAddend();
if (Value < std::numeric_limits<int32_t>::min() ||
Value > std::numeric_limits<int32_t>::max())
- return targetOutOfRangeError(E);
+ return targetOutOfRangeError(A, E);
*(little32_t *)FixupPtr = Value;
break;
}
@@ -501,7 +503,7 @@ private:
E.getTarget().getAddress() - (FixupAddress + Delta) + E.getAddend();
if (Value < std::numeric_limits<int32_t>::min() ||
Value > std::numeric_limits<int32_t>::max())
- return targetOutOfRangeError(E);
+ return targetOutOfRangeError(A, E);
*(little32_t *)FixupPtr = Value;
break;
}
@@ -518,7 +520,7 @@ private:
if (E.getKind() == Delta32 || E.getKind() == NegDelta32) {
if (Value < std::numeric_limits<int32_t>::min() ||
Value > std::numeric_limits<int32_t>::max())
- return targetOutOfRangeError(E);
+ return targetOutOfRangeError(A, E);
*(little32_t *)FixupPtr = Value;
} else
*(little64_t *)FixupPtr = Value;
More information about the llvm-commits
mailing list