8342607: Enhance register printing on x86_64 platforms
Co-authored-by: Richard Reingruber <rrich@openjdk.org> Reviewed-by: rrich, stuefe, mbaesken
This commit is contained in:
parent
d8430efb5e
commit
d8b3685d36
@ -544,6 +544,21 @@ void os::print_context(outputStream *st, const void *context) {
|
||||
st->print(", ERR=" INTPTR_FORMAT, (intptr_t)uc->uc_mcontext.gregs[REG_ERR]);
|
||||
st->cr();
|
||||
st->print(" TRAPNO=" INTPTR_FORMAT, (intptr_t)uc->uc_mcontext.gregs[REG_TRAPNO]);
|
||||
// Add XMM registers + MXCSR. Note that C2 uses XMM to spill GPR values including pointers.
|
||||
st->cr();
|
||||
st->cr();
|
||||
// Sanity check: fpregs should point into the context.
|
||||
if ((address)uc->uc_mcontext.fpregs < (address)uc ||
|
||||
pointer_delta(uc->uc_mcontext.fpregs, uc, 1) >= sizeof(ucontext_t)) {
|
||||
st->print_cr("bad uc->uc_mcontext.fpregs: " INTPTR_FORMAT " (uc: " INTPTR_FORMAT ")",
|
||||
p2i(uc->uc_mcontext.fpregs), p2i(uc));
|
||||
} else {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
const int64_t* xmm_val_addr = (int64_t*)&(uc->uc_mcontext.fpregs->_xmm[i]);
|
||||
st->print_cr("XMM[%d]=" INTPTR_FORMAT " " INTPTR_FORMAT, i, xmm_val_addr[1], xmm_val_addr[0]);
|
||||
}
|
||||
st->print(" MXCSR=" UINT32_FORMAT_X_0, uc->uc_mcontext.fpregs->mxcsr);
|
||||
}
|
||||
#else
|
||||
st->print( "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]);
|
||||
st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]);
|
||||
|
@ -437,6 +437,15 @@ void os::print_context(outputStream *st, const void *context) {
|
||||
st->cr();
|
||||
st->print( "RIP=" INTPTR_FORMAT, uc->Rip);
|
||||
st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags);
|
||||
// Add XMM registers + MXCSR. Note that C2 uses XMM to spill GPR values including pointers.
|
||||
st->cr();
|
||||
st->cr();
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
const uint64_t *xmm = ((const uint64_t*)&(uc->Xmm0)) + 2 * i;
|
||||
st->print_cr("XMM[%d]=" INTPTR_FORMAT " " INTPTR_FORMAT,
|
||||
i, xmm[1], xmm[0]);
|
||||
}
|
||||
st->print(" MXCSR=" UINT32_FORMAT_X_0, uc->MxCsr);
|
||||
#else
|
||||
st->print( "EAX=" INTPTR_FORMAT, uc->Eax);
|
||||
st->print(", EBX=" INTPTR_FORMAT, uc->Ebx);
|
||||
|
@ -725,10 +725,22 @@ void disarm_assert_poison() {
|
||||
|
||||
static void store_context(const void* context) {
|
||||
memcpy(&g_stored_assertion_context, context, sizeof(ucontext_t));
|
||||
#if defined(LINUX) && defined(PPC64)
|
||||
#if defined(LINUX)
|
||||
// on Linux ppc64, ucontext_t contains pointers into itself which have to be patched up
|
||||
// after copying the context (see comment in sys/ucontext.h):
|
||||
#if defined(PPC64)
|
||||
*((void**) &g_stored_assertion_context.uc_mcontext.regs) = &(g_stored_assertion_context.uc_mcontext.gp_regs);
|
||||
#elif defined(AMD64)
|
||||
// In the copied version, fpregs should point to the copied contents.
|
||||
// Sanity check: fpregs should point into the context.
|
||||
if ((address)((const ucontext_t*)context)->uc_mcontext.fpregs > (address)context) {
|
||||
size_t fpregs_offset = pointer_delta(((const ucontext_t*)context)->uc_mcontext.fpregs, context, 1);
|
||||
if (fpregs_offset < sizeof(ucontext_t)) {
|
||||
// Preserve the offset.
|
||||
*((void**) &g_stored_assertion_context.uc_mcontext.fpregs) = (void*)((address)(void*)&g_stored_assertion_context + fpregs_offset);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user