diff options
author | Nilanjana Basu <nilanjana.basu87@gmail.com> | 2019-07-17 23:43:58 +0000 |
---|---|---|
committer | Nilanjana Basu <nilanjana.basu87@gmail.com> | 2019-07-17 23:43:58 +0000 |
commit | 4e227702197ece69f9545d3c4903c8268a438459 (patch) | |
tree | c6c44f58bb1396300cdf904e7ceef8461dc236f5 /llvm/lib | |
parent | 749f556bbd146f1bf066a994e7a9a9fdc65ab6a1 (diff) | |
download | bcm5719-llvm-4e227702197ece69f9545d3c4903c8268a438459.tar.gz bcm5719-llvm-4e227702197ece69f9545d3c4903c8268a438459.zip |
Changes to display code view debug info type records in hex format
llvm-svn: 366390
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/MC/MCAsmStreamer.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 17 |
4 files changed, 19 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index bd0ace9e1bb..932959c311f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -103,7 +103,7 @@ public: void EmitBytes(StringRef Data) { OS->EmitBytes(Data); } void EmitIntValue(uint64_t Value, unsigned Size) { - OS->EmitIntValue(Value, Size); + OS->EmitIntValueInHex(Value, Size); } void EmitBinaryData(StringRef Data) { OS->EmitBinaryData(Data); } diff --git a/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp b/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp index 8e8eba4d53e..47928c2eef6 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp @@ -306,7 +306,7 @@ Error TypeRecordMapping::visitKnownRecord(CVType &CVR, VFTableRecord &Record) { for (auto Name : Record.MethodNames) NamesLen += Name.size() + 1; } - error(IO.mapInteger(NamesLen, "")); + error(IO.mapInteger(NamesLen)); error(IO.mapVectorTail( Record.MethodNames, [](CodeViewRecordIO &IO, StringRef &S) { diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index 7e8f02e3a1a..7a2b0b8a122 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -188,6 +188,7 @@ public: void EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc = SMLoc()) override; void EmitIntValue(uint64_t Value, unsigned Size) override; + void EmitIntValueInHex(uint64_t Value, unsigned Size) override; void EmitULEB128Value(const MCExpr *Value) override; @@ -923,6 +924,10 @@ void MCAsmStreamer::EmitIntValue(uint64_t Value, unsigned Size) { EmitValue(MCConstantExpr::create(Value, getContext()), Size); } +void MCAsmStreamer::EmitIntValueInHex(uint64_t Value, unsigned Size) { + EmitValue(MCConstantExpr::create(Value, getContext(), true), Size); +} + void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, SMLoc Loc) { assert(Size <= 8 && "Invalid size"); diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index b3384599635..ab53ed42778 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -8,6 +8,7 @@ #include "llvm/MC/MCExpr.h" #include "llvm/ADT/Statistic.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/Config/llvm-config.h" #include "llvm/MC/MCAsmBackend.h" @@ -42,10 +43,15 @@ void MCExpr::print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens) const { switch (getKind()) { case MCExpr::Target: return cast<MCTargetExpr>(this)->printImpl(OS, MAI); - case MCExpr::Constant: - OS << cast<MCConstantExpr>(*this).getValue(); + case MCExpr::Constant: { + auto Value = cast<MCConstantExpr>(*this).getValue(); + auto PrintInHex = cast<MCConstantExpr>(*this).useHexFormat(); + if (PrintInHex) + OS << "0x" << Twine::utohexstr(Value); + else + OS << Value; return; - + } case MCExpr::SymbolRef: { const MCSymbolRefExpr &SRE = cast<MCSymbolRefExpr>(*this); const MCSymbol &Sym = SRE.getSymbol(); @@ -160,8 +166,9 @@ const MCUnaryExpr *MCUnaryExpr::create(Opcode Opc, const MCExpr *Expr, return new (Ctx) MCUnaryExpr(Opc, Expr, Loc); } -const MCConstantExpr *MCConstantExpr::create(int64_t Value, MCContext &Ctx) { - return new (Ctx) MCConstantExpr(Value); +const MCConstantExpr *MCConstantExpr::create(int64_t Value, MCContext &Ctx, + bool PrintInHex) { + return new (Ctx) MCConstantExpr(Value, PrintInHex); } /* *** */ |