forked from OSchip/llvm-project
[JITLink] Improve formatting for Edge, Block and Symbol debugging output.
This commit is contained in:
parent
44664a5448
commit
783ba64a89
|
@ -93,6 +93,7 @@ const char *getScopeName(Scope S) {
|
|||
raw_ostream &operator<<(raw_ostream &OS, const Block &B) {
|
||||
return OS << formatv("{0:x16}", B.getAddress()) << " -- "
|
||||
<< formatv("{0:x16}", B.getAddress() + B.getSize()) << ": "
|
||||
<< "size = " << formatv("{0:x}", B.getSize()) << ", "
|
||||
<< (B.isZeroFill() ? "zero-fill" : "content")
|
||||
<< ", align = " << B.getAlignment()
|
||||
<< ", align-ofs = " << B.getAlignmentOffset()
|
||||
|
@ -126,10 +127,10 @@ raw_ostream &operator<<(raw_ostream &OS, const Symbol &Sym) {
|
|||
break;
|
||||
}
|
||||
OS << (Sym.isLive() ? '+' : '-')
|
||||
<< ", size = " << formatv("{0:x8}", Sym.getSize())
|
||||
<< ", size = " << formatv("{0:x}", Sym.getSize())
|
||||
<< ", addr = " << formatv("{0:x16}", Sym.getAddress()) << " ("
|
||||
<< formatv("{0:x16}", Sym.getAddressable().getAddress()) << " + "
|
||||
<< formatv("{0:x8}", Sym.getOffset());
|
||||
<< formatv("{0:x}", Sym.getOffset());
|
||||
if (Sym.isDefined())
|
||||
OS << " " << Sym.getBlock().getSection().getName();
|
||||
OS << ")>";
|
||||
|
@ -139,8 +140,33 @@ raw_ostream &operator<<(raw_ostream &OS, const Symbol &Sym) {
|
|||
void printEdge(raw_ostream &OS, const Block &B, const Edge &E,
|
||||
StringRef EdgeKindName) {
|
||||
OS << "edge@" << formatv("{0:x16}", B.getAddress() + E.getOffset()) << ": "
|
||||
<< formatv("{0:x16}", B.getAddress()) << " + " << E.getOffset() << " -- "
|
||||
<< EdgeKindName << " -> " << E.getTarget() << " + " << E.getAddend();
|
||||
<< formatv("{0:x16}", B.getAddress()) << " + "
|
||||
<< formatv("{0:x}", E.getOffset()) << " -- " << EdgeKindName << " -> ";
|
||||
|
||||
auto &TargetSym = E.getTarget();
|
||||
if (TargetSym.hasName())
|
||||
OS << TargetSym.getName();
|
||||
else {
|
||||
auto &TargetBlock = TargetSym.getBlock();
|
||||
auto &TargetSec = TargetBlock.getSection();
|
||||
JITTargetAddress SecAddress = ~JITTargetAddress(0);
|
||||
for (auto *B : TargetSec.blocks())
|
||||
if (B->getAddress() < SecAddress)
|
||||
SecAddress = B->getAddress();
|
||||
|
||||
JITTargetAddress SecDelta = TargetSym.getAddress() - SecAddress;
|
||||
OS << formatv("{0:x16}", TargetSym.getAddress()) << " (section "
|
||||
<< TargetSec.getName();
|
||||
if (SecDelta)
|
||||
OS << " + " << formatv("{0:x}", SecDelta);
|
||||
OS << " / block " << formatv("{0:x16}", TargetBlock.getAddress());
|
||||
if (TargetSym.getOffset())
|
||||
OS << " + " << formatv("{0:x}", TargetSym.getOffset());
|
||||
OS << ")";
|
||||
}
|
||||
|
||||
if (E.getAddend() != 0)
|
||||
OS << " + " << E.getAddend();
|
||||
}
|
||||
|
||||
Section::~Section() {
|
||||
|
|
Loading…
Reference in New Issue