From: Igor Kudrin Date: Tue, 2 Jul 2019 09:57:28 +0000 (+0000) Subject: [DWARF] Simplify dumping of a .debug_addr section. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e661ac63ede7675f7ebc70b652b84e03e9767f1;p=llvm [DWARF] Simplify dumping of a .debug_addr section. This patch removes the part which tried to interpret addresses in that section as offsets and simplifies the remaining code. Differential Revision: https://reviews.llvm.org/D64020 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364896 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp b/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp index 6ab2a2675cc..58626539bba 100644 --- a/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp +++ b/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp @@ -147,28 +147,13 @@ void DWARFDebugAddrTable::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const { HeaderData.Length, HeaderData.Version, HeaderData.AddrSize, HeaderData.SegSize); - static const char *Fmt32 = "0x%8.8" PRIx64; - static const char *Fmt64 = "0x%16.16" PRIx64; - std::string AddrFmt = "\n"; - std::string AddrFmtVerbose = " => "; - if (HeaderData.AddrSize == 4) { - AddrFmt.append(Fmt32); - AddrFmtVerbose.append(Fmt32); - } - else { - AddrFmt.append(Fmt64); - AddrFmtVerbose.append(Fmt64); - } - if (Addrs.size() > 0) { - OS << "Addrs: ["; - for (uint64_t Addr : Addrs) { - OS << format(AddrFmt.c_str(), Addr); - if (DumpOpts.Verbose) - OS << format(AddrFmtVerbose.c_str(), - Addr + HeaderOffset + sizeof(HeaderData)); - } - OS << "\n]\n"; + const char *AddrFmt = (HeaderData.AddrSize == 4) ? "0x%8.8" PRIx64 "\n" + : "0x%16.16" PRIx64 "\n"; + OS << "Addrs: [\n"; + for (uint64_t Addr : Addrs) + OS << format(AddrFmt, Addr); + OS << "]\n"; } }