[PATCH] D54424: [DWARF] Do not use PRIx32 for printing uint64_t values

Simon Atanasyan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 12 05:49:55 PST 2018


atanasyan created this revision.
atanasyan added reviewers: dblaikie, echristo.
Herald added subscribers: JDevlieghere, arichardson, aprantl, sdardis.

The `DWARFDebugAddrTable::dump` routine prints 32/64-bits addresses. These values are stored in a vector of `uint64_t` independently of their original sizes. But `format` function gets format string with PRIx32 suffix in case of 32-bit address size. At least on MIPS 32-bit targets that leads to incorrect output.

This patch changes formats strings and always use PRIx64 to print `uint64_t` values.


Repository:
  rL LLVM

https://reviews.llvm.org/D54424

Files:
  lib/DebugInfo/DWARF/DWARFDebugAddr.cpp


Index: lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
+++ lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
@@ -148,7 +148,7 @@
                HeaderData.Length, HeaderData.Version, HeaderData.AddrSize,
                HeaderData.SegSize);
 
-  static const char *Fmt32 = "0x%8.8" PRIx32;
+  static const char *Fmt32 = "0x%8.8" PRIx64;
   static const char *Fmt64 = "0x%16.16" PRIx64;
   std::string AddrFmt = "\n";
   std::string AddrFmtVerbose = " => ";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54424.173661.patch
Type: text/x-patch
Size: 549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181112/a5767b63/attachment.bin>


More information about the llvm-commits mailing list