--- old/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Tue Oct 12 12:06:28 2010 +++ new/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp Tue Oct 12 12:06:27 2010 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -200,6 +200,18 @@ sigcontext* sc = (sigcontext*)context; st->print_cr("Registers:"); + st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT + " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT, + SIG_REGS(sc).u_regs[CON_G1], + SIG_REGS(sc).u_regs[CON_G2], + SIG_REGS(sc).u_regs[CON_G3], + SIG_REGS(sc).u_regs[CON_G4]); + st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT + " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, + SIG_REGS(sc).u_regs[CON_G5], + SIG_REGS(sc).u_regs[CON_G6], + SIG_REGS(sc).u_regs[CON_G7], + SIG_REGS(sc).y); st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT " O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT, SIG_REGS(sc).u_regs[CON_O0], @@ -213,19 +225,33 @@ SIG_REGS(sc).u_regs[CON_O6], SIG_REGS(sc).u_regs[CON_O7]); - st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT - " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT, - SIG_REGS(sc).u_regs[CON_G1], - SIG_REGS(sc).u_regs[CON_G2], - SIG_REGS(sc).u_regs[CON_G3], - SIG_REGS(sc).u_regs[CON_G4]); - st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT - " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, - SIG_REGS(sc).u_regs[CON_G5], - SIG_REGS(sc).u_regs[CON_G6], - SIG_REGS(sc).u_regs[CON_G7], - SIG_REGS(sc).y); + intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); + st->print_cr(" L0=" INTPTR_FORMAT " L1=" INTPTR_FORMAT + " L2=" INTPTR_FORMAT " L3=" INTPTR_FORMAT, + sp[L0->sp_offset_in_saved_window()], + sp[L1->sp_offset_in_saved_window()], + sp[L2->sp_offset_in_saved_window()], + sp[L3->sp_offset_in_saved_window()]); + st->print_cr(" L4=" INTPTR_FORMAT " L5=" INTPTR_FORMAT + " L6=" INTPTR_FORMAT " L7=" INTPTR_FORMAT, + sp[L4->sp_offset_in_saved_window()], + sp[L5->sp_offset_in_saved_window()], + sp[L6->sp_offset_in_saved_window()], + sp[L7->sp_offset_in_saved_window()]); + st->print_cr(" I0=" INTPTR_FORMAT " I1=" INTPTR_FORMAT + " I2=" INTPTR_FORMAT " I3=" INTPTR_FORMAT, + sp[I0->sp_offset_in_saved_window()], + sp[I1->sp_offset_in_saved_window()], + sp[I2->sp_offset_in_saved_window()], + sp[I3->sp_offset_in_saved_window()]); + st->print_cr(" I4=" INTPTR_FORMAT " I5=" INTPTR_FORMAT + " I6=" INTPTR_FORMAT " I7=" INTPTR_FORMAT, + sp[I4->sp_offset_in_saved_window()], + sp[I5->sp_offset_in_saved_window()], + sp[I6->sp_offset_in_saved_window()], + sp[I7->sp_offset_in_saved_window()]); + st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT, SIG_PC(sc), SIG_NPC(sc)); @@ -232,7 +258,6 @@ st->cr(); st->cr(); - intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); st->cr(); @@ -242,9 +267,60 @@ // this at the end, and hope for the best. address pc = os::Linux::ucontext_get_pc(uc); st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); - print_hex_dump(st, pc - 16, pc + 16, sizeof(char)); + print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); } + +void os::print_register_info(outputStream *st, void *context) { + if (context == NULL) return; + + ucontext_t *uc = (ucontext_t*)context; + intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); + + st->print_cr("Register to memory mapping:"); + st->cr(); + + // this is only for the "general purpose" registers + st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON__G1]); + st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON__G2]); + st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON__G3]); + st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON__G4]); + st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON__G5]); + st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON__G6]); + st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON__G7]); + st->cr(); + + st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON__O0]); + st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON__O1]); + st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON__O2]); + st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON__O3]); + st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON__O4]); + st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON__O5]); + st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON__O6]); + st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON__O7]); + st->cr(); + + st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]); + st->print("L1="); print_location(st, sp[L1->sp_offset_in_saved_window()]); + st->print("L2="); print_location(st, sp[L2->sp_offset_in_saved_window()]); + st->print("L3="); print_location(st, sp[L3->sp_offset_in_saved_window()]); + st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]); + st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]); + st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]); + st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]); + st->cr(); + + st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]); + st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]); + st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]); + st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]); + st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]); + st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]); + st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]); + st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]); + st->cr(); +} + address os::Linux::ucontext_get_pc(ucontext_t* uc) { return (address) SIG_PC((sigcontext*)uc);