[PATCH] D64020: [DWARF] Simplify dumping of a .debug_addr section.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 10:35:05 PDT 2019


ikudrin created this revision.
ikudrin added reviewers: dblaikie, vleschuk, aprantl, wolfgangp, JDevlieghere.
Herald added a project: LLVM.

This patch removes the part which tried to interpret addresses in that section as offsets and simplifies the remaining code.


Repository:
  rL LLVM

https://reviews.llvm.org/D64020

Files:
  lib/DebugInfo/DWARF/DWARFDebugAddr.cpp


Index: lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
+++ lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
@@ -147,28 +147,13 @@
                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";
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64020.207371.patch
Type: text/x-patch
Size: 1262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/723fe9ae/attachment.bin>


More information about the llvm-commits mailing list