[compiler-rt] 053bbb6 - [compiler-rt] DumpAllRegisters fix for other unimplemented oses (#101134)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 00:27:54 PDT 2024


Author: David CARLIER
Date: 2024-07-30T08:27:51+01:00
New Revision: 053bbb6a71abf15dd086a292aa92fccfc54e1f56

URL: https://github.com/llvm/llvm-project/commit/053bbb6a71abf15dd086a292aa92fccfc54e1f56
DIFF: https://github.com/llvm/llvm-project/commit/053bbb6a71abf15dd086a292aa92fccfc54e1f56.diff

LOG: [compiler-rt] DumpAllRegisters fix for other unimplemented oses (#101134)

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index b768b8e2b52d4..ec93e0a4a67ca 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -2357,29 +2357,33 @@ static uptr GetArmRegister(ucontext_t *ctx, int RegNum) {
 UNUSED
 static void DumpSingleReg(ucontext_t *ctx, int RegNum) {
   const char *RegName = RegNumToRegName(RegNum);
-#  if defined(__x86_64__)
+#  if SANITIZER_LINUX && SANITIZER_GLIBC || SANITIZER_NETBSD
+#    if defined(__x86_64__)
   Printf("%s%s = 0x%016llx  ", internal_strlen(RegName) == 2 ? " " : "",
          RegName,
-#    if SANITIZER_LINUX
+#      if SANITIZER_LINUX
          ctx->uc_mcontext.gregs[RegNum]
-#    elif SANITIZER_NETBSD
+#      elif SANITIZER_NETBSD
          ctx->uc_mcontext.__gregs[RegNum]
-#    endif
+#      endif
   );
-#  elif defined(__i386__)
+#    elif defined(__i386__)
   Printf("%s = 0x%08x  ", RegName,
-#    if SANITIZER_LINUX
+#      if SANITIZER_LINUX
          ctx->uc_mcontext.gregs[RegNum]
-#    elif SANITIZER_NETBSD
+#      elif SANITIZER_NETBSD
          ctx->uc_mcontext.__gregs[RegNum]
-#    endif
+#      endif
   );
-#  elif defined(__arm__)
+#    elif defined(__arm__)
   Printf("%s%s = 0x%08zx  ", internal_strlen(RegName) == 2 ? " " : "", RegName,
          GetArmRegister(ctx, RegNum));
-#  elif defined(__aarch64__)
+#    elif defined(__aarch64__)
   Printf("%s%s = 0x%016zx  ", internal_strlen(RegName) == 2 ? " " : "", RegName,
          GetArmRegister(ctx, RegNum));
+#    else
+  (void)RegName;
+#    endif
 #  else
   (void)RegName;
 #  endif
@@ -2496,6 +2500,8 @@ void SignalContext::DumpAllRegisters(void *context) {
 #    else
   (void)ucontext;
 #    endif
+#  else
+  (void)ucontext;
 #  endif
   // FIXME: Implement this for other OSes and architectures.
 }


        


More information about the llvm-commits mailing list