[compiler-rt] [compiler-rt] Implement `DumpAllRegisters` for arm-linux and aarch64-linux (PR #100398)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 08:03:22 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 59e1c6cd63eb9287df6516f9a5ae564075e9c218 c11da58c80228330f89fe594a60dfcb411c3374f --extensions cpp -- compiler-rt/test/sanitizer_common/TestCases/Linux/dump_registers_aarch64.cpp compiler-rt/test/sanitizer_common/TestCases/Linux/dump_registers_arm.cpp compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index 8879f70004..2ea61b1cb4 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -2247,10 +2247,10 @@ static const char *RegNumToRegName(int reg) {
   return NULL;
 }
 
-#    if SANITIZER_LINUX && (defined(__arm__) || defined(__aarch64__))
+#  if SANITIZER_LINUX && (defined(__arm__) || defined(__aarch64__))
 static uptr GetArmRegister(ucontext_t *ctx, int RegNum) {
   switch (RegNum) {
-#      if defined(__arm__)
+#    if defined(__arm__)
 #      ifdef MAKE_CASE
 #        undef MAKE_CASE
 #      endif
@@ -2278,18 +2278,18 @@ static uptr GetArmRegister(ucontext_t *ctx, int RegNum) {
       return ctx->uc_mcontext.arm_lr;
     case REG_R15:
       return ctx->uc_mcontext.arm_pc;
-#      elif defined(__aarch64__)
+#    elif defined(__aarch64__)
     case 0 ... 30:
       return ctx->uc_mcontext.regs[RegNum];
     case 31:
       return ctx->uc_mcontext.sp;
-#      endif
+#    endif
     default:
       return 0;
   }
   return 0;
 }
-#    endif  // SANITIZER_LINUX && (defined(__arm__) || defined(__aarch64__))
+#  endif  // SANITIZER_LINUX && (defined(__arm__) || defined(__aarch64__))
 
 UNUSED
 static void DumpSingleReg(ucontext_t *ctx, int RegNum) {
@@ -2299,15 +2299,15 @@ static void DumpSingleReg(ucontext_t *ctx, int RegNum) {
          RegName, ctx->uc_mcontext.gregs[RegNum]);
 #    elif defined(__i386__)
   Printf("%s = 0x%08x  ", RegName, ctx->uc_mcontext.gregs[RegNum]);
-#    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
+#  else
   (void)RegName;
-#    endif
+#  endif
 }
 
 void SignalContext::DumpAllRegisters(void *context) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/100398


More information about the llvm-commits mailing list