[llvm] 7026a0c - [llvm][Support] Fix backtrace output by removing '#'. NFC

Michael Liao via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 12:59:06 PDT 2023


Author: Michael Liao
Date: 2023-08-17T15:58:12-04:00
New Revision: 7026a0cacaa0b56e3758539c67b19ffa204fcd27

URL: https://github.com/llvm/llvm-project/commit/7026a0cacaa0b56e3758539c67b19ffa204fcd27
DIFF: https://github.com/llvm/llvm-project/commit/7026a0cacaa0b56e3758539c67b19ffa204fcd27.diff

LOG: [llvm][Support] Fix backtrace output by removing '#'. NFC

- '#' has the string "0x" prepended for non-zero values. That results in
  inconsistent behavior between zero and non-zero values.

Added: 
    

Modified: 
    llvm/lib/Support/Unix/Signals.inc
    llvm/unittests/Support/SignalsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Unix/Signals.inc b/llvm/lib/Support/Unix/Signals.inc
index 529cc92a28490b..8d27c9cfeccda1 100644
--- a/llvm/lib/Support/Unix/Signals.inc
+++ b/llvm/lib/Support/Unix/Signals.inc
@@ -539,7 +539,7 @@ public:
       uintptr_t StartAddress = Info->dlpi_addr + Phdr->p_vaddr;
       uintptr_t ModuleRelativeAddress = Phdr->p_vaddr;
       std::array<char, 4> ModeStr = modeStrFromFlags(Phdr->p_flags);
-      OS << format("{{{mmap:%#016x:%#x:load:%d:%s:%#016x}}}\n", StartAddress,
+      OS << format("{{{mmap:%016x:%x:load:%d:%s:%016x}}}\n", StartAddress,
                    Phdr->p_memsz, ModuleCount, &ModeStr[0],
                    ModuleRelativeAddress);
     }

diff  --git a/llvm/unittests/Support/SignalsTest.cpp b/llvm/unittests/Support/SignalsTest.cpp
index 3641e00f60ef9c..4eec376b3ceb53 100644
--- a/llvm/unittests/Support/SignalsTest.cpp
+++ b/llvm/unittests/Support/SignalsTest.cpp
@@ -46,7 +46,7 @@ TEST(SignalsTest, PrintsSymbolizerMarkup) {
   EXPECT_THAT(
       Res,
       MatchesRegex(".*" TAG_BEGIN
-                   "mmap:0x[0-9a-f]+:0x[0-9a-f]+:load:0:rx:[0-9a-f]+" TAG_END
+                   "mmap:[0-9a-f]+:[0-9a-f]+:load:0:rx:[0-9a-f]+" TAG_END
                    ".*"));
   // Backtrace line
   EXPECT_THAT(Res, MatchesRegex(".*" TAG_BEGIN "bt:0:[0-9a-f]+"


        


More information about the llvm-commits mailing list