Skip to content

[compiler-rt]: DumpAllRegs on NetBSD arm64. #102826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2312,11 +2312,11 @@ static const char *RegNumToRegName(int reg) {
return NULL;
}

# if SANITIZER_LINUX && SANITIZER_GLIBC && \
# if ((SANITIZER_LINUX && SANITIZER_GLIBC) || SANITIZER_NETBSD) && \
(defined(__arm__) || defined(__aarch64__))
static uptr GetArmRegister(ucontext_t *ctx, int RegNum) {
switch (RegNum) {
# if defined(__arm__)
# if defined(__arm__) && !SANITIZER_NETBSD
# ifdef MAKE_CASE
# undef MAKE_CASE
# endif
Expand Down Expand Up @@ -2345,10 +2345,15 @@ static uptr GetArmRegister(ucontext_t *ctx, int RegNum) {
case REG_R15:
return ctx->uc_mcontext.arm_pc;
# elif defined(__aarch64__)
# if SANITIZER_LINUX
case 0 ... 30:
return ctx->uc_mcontext.regs[RegNum];
case 31:
return ctx->uc_mcontext.sp;
# elif SANITIZER_NETBSD
case 0 ... 31:
return ctx->uc_mcontext.__gregs[RegNum];
# endif
# endif
default:
return 0;
Expand Down Expand Up @@ -2456,7 +2461,7 @@ void SignalContext::DumpAllRegisters(void *context) {
DumpSingleReg(ucontext, REG_R14);
DumpSingleReg(ucontext, REG_R15);
Printf("\n");
# elif defined(__aarch64__) && !SANITIZER_NETBSD
# elif defined(__aarch64__)
Report("Register values:\n");
for (int i = 0; i <= 31; ++i) {
DumpSingleReg(ucontext, i);
Expand Down
Loading