Skip to content

[compiler-rt] DumpAllRegisters fix for other unimplemented oses #101134

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
Jul 30, 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
26 changes: 16 additions & 10 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2324,29 +2324,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
Expand Down Expand Up @@ -2463,6 +2467,8 @@ void SignalContext::DumpAllRegisters(void *context) {
# else
(void)ucontext;
# endif
# else
(void)ucontext;
# endif
// FIXME: Implement this for other OSes and architectures.
}
Expand Down
Loading