Skip to content

Commit 053bbb6

Browse files
authored
[compiler-rt] DumpAllRegisters fix for other unimplemented oses (#101134)
1 parent 155b7a1 commit 053bbb6

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,29 +2357,33 @@ static uptr GetArmRegister(ucontext_t *ctx, int RegNum) {
23572357
UNUSED
23582358
static void DumpSingleReg(ucontext_t *ctx, int RegNum) {
23592359
const char *RegName = RegNumToRegName(RegNum);
2360-
# if defined(__x86_64__)
2360+
# if SANITIZER_LINUX && SANITIZER_GLIBC || SANITIZER_NETBSD
2361+
# if defined(__x86_64__)
23612362
Printf("%s%s = 0x%016llx ", internal_strlen(RegName) == 2 ? " " : "",
23622363
RegName,
2363-
# if SANITIZER_LINUX
2364+
# if SANITIZER_LINUX
23642365
ctx->uc_mcontext.gregs[RegNum]
2365-
# elif SANITIZER_NETBSD
2366+
# elif SANITIZER_NETBSD
23662367
ctx->uc_mcontext.__gregs[RegNum]
2367-
# endif
2368+
# endif
23682369
);
2369-
# elif defined(__i386__)
2370+
# elif defined(__i386__)
23702371
Printf("%s = 0x%08x ", RegName,
2371-
# if SANITIZER_LINUX
2372+
# if SANITIZER_LINUX
23722373
ctx->uc_mcontext.gregs[RegNum]
2373-
# elif SANITIZER_NETBSD
2374+
# elif SANITIZER_NETBSD
23742375
ctx->uc_mcontext.__gregs[RegNum]
2375-
# endif
2376+
# endif
23762377
);
2377-
# elif defined(__arm__)
2378+
# elif defined(__arm__)
23782379
Printf("%s%s = 0x%08zx ", internal_strlen(RegName) == 2 ? " " : "", RegName,
23792380
GetArmRegister(ctx, RegNum));
2380-
# elif defined(__aarch64__)
2381+
# elif defined(__aarch64__)
23812382
Printf("%s%s = 0x%016zx ", internal_strlen(RegName) == 2 ? " " : "", RegName,
23822383
GetArmRegister(ctx, RegNum));
2384+
# else
2385+
(void)RegName;
2386+
# endif
23832387
# else
23842388
(void)RegName;
23852389
# endif
@@ -2496,6 +2500,8 @@ void SignalContext::DumpAllRegisters(void *context) {
24962500
# else
24972501
(void)ucontext;
24982502
# endif
2503+
# else
2504+
(void)ucontext;
24992505
# endif
25002506
// FIXME: Implement this for other OSes and architectures.
25012507
}

0 commit comments

Comments
 (0)