runtime: handle linux/arm64 signal register
Set sigpc and implement dumpregs for linux/arm64. Without this change, cmd/vet tool test will fail randomly. Updates golang/go#20931 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/220543
This commit is contained in:
parent
799270b430
commit
3f469f585e
|
@ -1,4 +1,4 @@
|
||||||
5fc21bb0d91d916940c21e6d4a3e10ad3f45343d
|
7a62a49e62c090118fa003d9265c5f5e2090c4f9
|
||||||
|
|
||||||
The first line of this file holds the git revision number of the last
|
The first line of this file holds the git revision number of the last
|
||||||
merge done from the gofrontend repository.
|
merge done from the gofrontend repository.
|
||||||
|
|
|
@ -205,28 +205,18 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused)))
|
||||||
// Use unportable code to pull it from context, and if that fails
|
// Use unportable code to pull it from context, and if that fails
|
||||||
// try a stack backtrace across the signal handler.
|
// try a stack backtrace across the signal handler.
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#if defined(__x86_64__) && defined(__linux__)
|
||||||
#ifdef __linux__
|
|
||||||
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[REG_RIP];
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[REG_RIP];
|
||||||
#endif
|
#elif defined(__i386__) && defined(__linux__)
|
||||||
#endif
|
|
||||||
#ifdef __i386__
|
|
||||||
#ifdef __linux__
|
|
||||||
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[REG_EIP];
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[REG_EIP];
|
||||||
#endif
|
#elif defined(__alpha__) && defined(__linux__)
|
||||||
#endif
|
|
||||||
#ifdef __alpha__
|
|
||||||
#ifdef __linux__
|
|
||||||
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
|
||||||
#endif
|
#elif defined(__PPC__) && defined(__linux__)
|
||||||
#endif
|
|
||||||
#ifdef __PPC__
|
|
||||||
#ifdef __linux__
|
|
||||||
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.regs->nip;
|
||||||
#endif
|
#elif defined(__PPC__) && defined(_AIX)
|
||||||
#ifdef _AIX
|
|
||||||
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.jmp_context.iar;
|
||||||
#endif
|
#elif defined(__aarch64__) && defined(__linux__)
|
||||||
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.pc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ret.sigpc == 0) {
|
if (ret.sigpc == 0) {
|
||||||
|
@ -250,8 +240,7 @@ void dumpregs(siginfo_t *, void *)
|
||||||
void
|
void
|
||||||
dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((unused)))
|
dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((unused)))
|
||||||
{
|
{
|
||||||
#ifdef __x86_64__
|
#if defined(__x86_64__) && defined(__linux__)
|
||||||
#ifdef __linux__
|
|
||||||
{
|
{
|
||||||
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
||||||
|
|
||||||
|
@ -277,11 +266,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
|
||||||
runtime_printf("fs %X\n", (m->gregs[REG_CSGSFS] >> 16) & 0xffff);
|
runtime_printf("fs %X\n", (m->gregs[REG_CSGSFS] >> 16) & 0xffff);
|
||||||
runtime_printf("gs %X\n", (m->gregs[REG_CSGSFS] >> 32) & 0xffff);
|
runtime_printf("gs %X\n", (m->gregs[REG_CSGSFS] >> 32) & 0xffff);
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(__i386__) && defined(__linux__)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __i386__
|
|
||||||
#ifdef __linux__
|
|
||||||
{
|
{
|
||||||
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
||||||
|
|
||||||
|
@ -299,11 +284,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
|
||||||
runtime_printf("fs %x\n", m->gregs[REG_FS]);
|
runtime_printf("fs %x\n", m->gregs[REG_FS]);
|
||||||
runtime_printf("gs %x\n", m->gregs[REG_GS]);
|
runtime_printf("gs %x\n", m->gregs[REG_GS]);
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(__alpha__) && defined(__linux__)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __alpha__
|
|
||||||
#ifdef __linux__
|
|
||||||
{
|
{
|
||||||
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
||||||
|
|
||||||
|
@ -340,11 +321,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
|
||||||
runtime_printf("sp %X\n", m->sc_regs[30]);
|
runtime_printf("sp %X\n", m->sc_regs[30]);
|
||||||
runtime_printf("pc %X\n", m->sc_pc);
|
runtime_printf("pc %X\n", m->sc_pc);
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(__PPC__) && defined(__LITTLE_ENDIAN__) && defined(__linux__)
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__PPC__) && defined(__LITTLE_ENDIAN__)
|
|
||||||
#ifdef __linux__
|
|
||||||
{
|
{
|
||||||
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
||||||
int i;
|
int i;
|
||||||
|
@ -358,11 +335,7 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
|
||||||
runtime_printf("ctr %X\n", m->regs->ctr);
|
runtime_printf("ctr %X\n", m->regs->ctr);
|
||||||
runtime_printf("xer %X\n", m->regs->xer);
|
runtime_printf("xer %X\n", m->regs->xer);
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(__PPC__) && defined(_AIX)
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __PPC__
|
|
||||||
#ifdef _AIX
|
|
||||||
{
|
{
|
||||||
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
||||||
int i;
|
int i;
|
||||||
|
@ -376,6 +349,16 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
|
||||||
runtime_printf("ctr %p\n", m->jmp_context.ctr);
|
runtime_printf("ctr %p\n", m->jmp_context.ctr);
|
||||||
runtime_printf("xer %x\n", m->jmp_context.xer);
|
runtime_printf("xer %x\n", m->jmp_context.xer);
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(__aarch64__) && defined(__linux__)
|
||||||
|
{
|
||||||
|
mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 31; i++)
|
||||||
|
runtime_printf("x%d %X\n", i, m->regs[i]);
|
||||||
|
runtime_printf("sp %X\n", m->sp);
|
||||||
|
runtime_printf("pc %X\n", m->pc);
|
||||||
|
runtime_printf("pstate %X\n", m->pstate);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue