Skip to content

Commit

Permalink
8293851: hs_err should print more stack in hex dump
Browse files Browse the repository at this point in the history
Reviewed-by: adinn, stefank
  • Loading branch information
shipilev committed Sep 19, 2022
1 parent 04d7b7d commit cbd0688
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 34 deletions.
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp
Expand Up @@ -455,9 +455,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *sp = (intptr_t *)os::Aix::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
print_hex_dump(st, (address)sp, (address)(sp + 128), sizeof(intptr_t));
address sp = (address)os::Aix::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp
Expand Up @@ -469,9 +469,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *sp = (intptr_t *)os::Bsd::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" INTPTR_FORMAT ")", (intptr_t)sp);
print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t));
address sp = (address)os::Bsd::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/bsd_x86/os_bsd_x86.cpp
Expand Up @@ -853,9 +853,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *sp = (intptr_t *)os::Bsd::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" INTPTR_FORMAT ")", (intptr_t)sp);
print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t));
address sp = (address)os::Bsd::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
Expand Up @@ -341,9 +341,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t));
address sp = (address)os::Linux::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp
Expand Up @@ -475,9 +475,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" INTPTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t));
address sp = (address)os::Linux::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
Expand Up @@ -469,9 +469,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 128), sizeof(intptr_t));
address sp = (address)os::Linux::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp
Expand Up @@ -350,9 +350,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *frame_sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(frame_sp));
print_hex_dump(st, (address)frame_sp, (address)(frame_sp + 64), sizeof(intptr_t));
address sp = (address)os::Linux::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp
Expand Up @@ -441,9 +441,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 128), sizeof(intptr_t));
address sp = (address)os::Linux::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
Expand Up @@ -579,9 +579,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const ucontext_t* uc = (const ucontext_t*)context;

intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
print_hex_dump(st, (address)sp, (address)(sp + 8), sizeof(intptr_t));
address sp = (address)os::Linux::ucontext_get_sp(uc);
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.cpp
Expand Up @@ -212,9 +212,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const CONTEXT* uc = (const CONTEXT*)context;

intptr_t *sp = (intptr_t *)uc->Sp;
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
address sp = (address)uc->Sp;
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 2 additions & 3 deletions src/hotspot/os_cpu/windows_x86/os_windows_x86.cpp
Expand Up @@ -449,9 +449,8 @@ void os::print_tos_pc(outputStream *st, const void *context) {

const CONTEXT* uc = (const CONTEXT*)context;

intptr_t *sp = (intptr_t *)uc->REG_SP;
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
address sp = (address)uc->REG_SP;
print_tos(st, sp);
st->cr();

// Note: it may be unsafe to inspect memory near pc. For example, pc may
Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/share/runtime/os.cpp
Expand Up @@ -935,6 +935,11 @@ void os::print_dhm(outputStream* st, const char* startStr, long sec) {
st->print_cr("%s %ld days %ld:%02ld hours", startStr, days, hours, minutes);
}

void os::print_tos(outputStream* st, address sp) {
st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
print_hex_dump(st, sp, sp + 512, sizeof(intptr_t));
}

void os::print_instructions(outputStream* st, address pc, int unitsize) {
st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc));
print_hex_dump(st, pc - 256, pc + 256, unitsize);
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/runtime/os.hpp
Expand Up @@ -758,12 +758,13 @@ class os: AllStatic {
static void print_environment_variables(outputStream* st, const char** env_list);
static void print_context(outputStream* st, const void* context);
static void print_tos_pc(outputStream* st, const void* context);
static void print_tos(outputStream* st, address sp);
static void print_instructions(outputStream* st, address pc, int unitsize);
static void print_register_info(outputStream* st, const void* context);
static bool signal_sent_by_kill(const void* siginfo);
static void print_siginfo(outputStream* st, const void* siginfo);
static void print_signal_handlers(outputStream* st, char* buf, size_t buflen);
static void print_date_and_time(outputStream* st, char* buf, size_t buflen);
static void print_instructions(outputStream* st, address pc, int unitsize);

static void print_user_info(outputStream* st);
static void print_active_locale(outputStream* st);
Expand Down

1 comment on commit cbd0688

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.