comparison src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @ 1907:1e9a9d2e6509

6970683: improvements to hs_err output Reviewed-by: kvn, jrose, dholmes, coleenp
author never
date Thu, 21 Oct 2010 11:55:10 -0700
parents 126ea7725993
children f95d63e2154a
comparison
equal deleted inserted replaced
1906:f8aaf8522a6b 1907:1e9a9d2e6509
1 /* 1 /*
2 * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
538 538
539 if (pc == NULL && uc != NULL) { 539 if (pc == NULL && uc != NULL) {
540 pc = (address) uc->uc_mcontext.gregs[REG_PC]; 540 pc = (address) uc->uc_mcontext.gregs[REG_PC];
541 } 541 }
542 542
543 // Sometimes the register windows are not properly flushed.
544 if(uc->uc_mcontext.gwins != NULL) {
545 ::handle_unflushed_register_windows(uc->uc_mcontext.gwins);
546 }
547
543 // unmask current signal 548 // unmask current signal
544 sigset_t newset; 549 sigset_t newset;
545 sigemptyset(&newset); 550 sigemptyset(&newset);
546 sigaddset(&newset, sig); 551 sigaddset(&newset, sig);
547 sigprocmask(SIG_UNBLOCK, &newset, NULL); 552 sigprocmask(SIG_UNBLOCK, &newset, NULL);
556 if (context == NULL) return; 561 if (context == NULL) return;
557 562
558 ucontext_t *uc = (ucontext_t*)context; 563 ucontext_t *uc = (ucontext_t*)context;
559 st->print_cr("Registers:"); 564 st->print_cr("Registers:");
560 565
566 st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT
567 " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT,
568 uc->uc_mcontext.gregs[REG_G1],
569 uc->uc_mcontext.gregs[REG_G2],
570 uc->uc_mcontext.gregs[REG_G3],
571 uc->uc_mcontext.gregs[REG_G4]);
572 st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT
573 " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT,
574 uc->uc_mcontext.gregs[REG_G5],
575 uc->uc_mcontext.gregs[REG_G6],
576 uc->uc_mcontext.gregs[REG_G7],
577 uc->uc_mcontext.gregs[REG_Y]);
561 st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT 578 st->print_cr(" O0=" INTPTR_FORMAT " O1=" INTPTR_FORMAT
562 " O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT, 579 " O2=" INTPTR_FORMAT " O3=" INTPTR_FORMAT,
563 uc->uc_mcontext.gregs[REG_O0], 580 uc->uc_mcontext.gregs[REG_O0],
564 uc->uc_mcontext.gregs[REG_O1], 581 uc->uc_mcontext.gregs[REG_O1],
565 uc->uc_mcontext.gregs[REG_O2], 582 uc->uc_mcontext.gregs[REG_O2],
569 uc->uc_mcontext.gregs[REG_O4], 586 uc->uc_mcontext.gregs[REG_O4],
570 uc->uc_mcontext.gregs[REG_O5], 587 uc->uc_mcontext.gregs[REG_O5],
571 uc->uc_mcontext.gregs[REG_O6], 588 uc->uc_mcontext.gregs[REG_O6],
572 uc->uc_mcontext.gregs[REG_O7]); 589 uc->uc_mcontext.gregs[REG_O7]);
573 590
574 st->print_cr(" G1=" INTPTR_FORMAT " G2=" INTPTR_FORMAT 591
575 " G3=" INTPTR_FORMAT " G4=" INTPTR_FORMAT, 592 intptr_t *sp = (intptr_t *)os::Solaris::ucontext_get_sp(uc);
576 uc->uc_mcontext.gregs[REG_G1], 593 st->print_cr(" L0=" INTPTR_FORMAT " L1=" INTPTR_FORMAT
577 uc->uc_mcontext.gregs[REG_G2], 594 " L2=" INTPTR_FORMAT " L3=" INTPTR_FORMAT,
578 uc->uc_mcontext.gregs[REG_G3], 595 sp[L0->sp_offset_in_saved_window()],
579 uc->uc_mcontext.gregs[REG_G4]); 596 sp[L1->sp_offset_in_saved_window()],
580 st->print_cr(" G5=" INTPTR_FORMAT " G6=" INTPTR_FORMAT 597 sp[L2->sp_offset_in_saved_window()],
581 " G7=" INTPTR_FORMAT " Y=" INTPTR_FORMAT, 598 sp[L3->sp_offset_in_saved_window()]);
582 uc->uc_mcontext.gregs[REG_G5], 599 st->print_cr(" L4=" INTPTR_FORMAT " L5=" INTPTR_FORMAT
583 uc->uc_mcontext.gregs[REG_G6], 600 " L6=" INTPTR_FORMAT " L7=" INTPTR_FORMAT,
584 uc->uc_mcontext.gregs[REG_G7], 601 sp[L4->sp_offset_in_saved_window()],
585 uc->uc_mcontext.gregs[REG_Y]); 602 sp[L5->sp_offset_in_saved_window()],
603 sp[L6->sp_offset_in_saved_window()],
604 sp[L7->sp_offset_in_saved_window()]);
605 st->print_cr(" I0=" INTPTR_FORMAT " I1=" INTPTR_FORMAT
606 " I2=" INTPTR_FORMAT " I3=" INTPTR_FORMAT,
607 sp[I0->sp_offset_in_saved_window()],
608 sp[I1->sp_offset_in_saved_window()],
609 sp[I2->sp_offset_in_saved_window()],
610 sp[I3->sp_offset_in_saved_window()]);
611 st->print_cr(" I4=" INTPTR_FORMAT " I5=" INTPTR_FORMAT
612 " I6=" INTPTR_FORMAT " I7=" INTPTR_FORMAT,
613 sp[I4->sp_offset_in_saved_window()],
614 sp[I5->sp_offset_in_saved_window()],
615 sp[I6->sp_offset_in_saved_window()],
616 sp[I7->sp_offset_in_saved_window()]);
586 617
587 st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT, 618 st->print_cr(" PC=" INTPTR_FORMAT " nPC=" INTPTR_FORMAT,
588 uc->uc_mcontext.gregs[REG_PC], 619 uc->uc_mcontext.gregs[REG_PC],
589 uc->uc_mcontext.gregs[REG_nPC]); 620 uc->uc_mcontext.gregs[REG_nPC]);
590
591 st->cr(); 621 st->cr();
592 st->cr(); 622 st->cr();
593 623
594 st->print_cr("Register to memory mapping:");
595 st->cr();
596
597 // this is only for the "general purpose" registers
598
599 st->print_cr("O0=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O0]);
600 print_location(st, uc->uc_mcontext.gregs[REG_O0]);
601 st->cr();
602 st->print_cr("O1=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O1]);
603 print_location(st, uc->uc_mcontext.gregs[REG_O1]);
604 st->cr();
605 st->print_cr("O2=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O2]);
606 print_location(st, uc->uc_mcontext.gregs[REG_O2]);
607 st->cr();
608 st->print_cr("O3=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O3]);
609 print_location(st, uc->uc_mcontext.gregs[REG_O3]);
610 st->cr();
611 st->print_cr("O4=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O4]);
612 print_location(st, uc->uc_mcontext.gregs[REG_O4]);
613 st->cr();
614 st->print_cr("O5=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O5]);
615 print_location(st, uc->uc_mcontext.gregs[REG_O5]);
616 st->cr();
617 st->print_cr("O6=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O6]);
618 print_location(st, uc->uc_mcontext.gregs[REG_O6]);
619 st->cr();
620 st->print_cr("O7=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_O7]);
621 print_location(st, uc->uc_mcontext.gregs[REG_O7]);
622 st->cr();
623
624 st->print_cr("G1=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G1]);
625 print_location(st, uc->uc_mcontext.gregs[REG_G1]);
626 st->cr();
627 st->print_cr("G2=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G2]);
628 print_location(st, uc->uc_mcontext.gregs[REG_G2]);
629 st->cr();
630 st->print_cr("G3=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G3]);
631 print_location(st, uc->uc_mcontext.gregs[REG_G3]);
632 st->cr();
633 st->print_cr("G4=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G4]);
634 print_location(st, uc->uc_mcontext.gregs[REG_G4]);
635 st->cr();
636 st->print_cr("G5=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G5]);
637 print_location(st, uc->uc_mcontext.gregs[REG_G5]);
638 st->cr();
639 st->print_cr("G6=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G6]);
640 print_location(st, uc->uc_mcontext.gregs[REG_G6]);
641 st->cr();
642 st->print_cr("G7=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_G7]);
643 print_location(st, uc->uc_mcontext.gregs[REG_G7]);
644
645 st->cr();
646 st->cr();
647
648 intptr_t *sp = (intptr_t *)os::Solaris::ucontext_get_sp(uc);
649 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); 624 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
650 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); 625 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t));
651 st->cr(); 626 st->cr();
652 627
653 // Note: it may be unsafe to inspect memory near pc. For example, pc may 628 // Note: it may be unsafe to inspect memory near pc. For example, pc may
654 // point to garbage if entry point in an nmethod is corrupted. Leave 629 // point to garbage if entry point in an nmethod is corrupted. Leave
655 // this at the end, and hope for the best. 630 // this at the end, and hope for the best.
656 ExtendedPC epc = os::Solaris::ucontext_get_ExtendedPC(uc); 631 ExtendedPC epc = os::Solaris::ucontext_get_ExtendedPC(uc);
657 address pc = epc.pc(); 632 address pc = epc.pc();
658 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); 633 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
659 print_hex_dump(st, pc - 16, pc + 16, sizeof(char)); 634 print_hex_dump(st, pc - 32, pc + 32, sizeof(char));
635 }
636
637 void os::print_register_info(outputStream *st, void *context) {
638 if (context == NULL) return;
639
640 ucontext_t *uc = (ucontext_t*)context;
641 intptr_t *sp = (intptr_t *)os::Solaris::ucontext_get_sp(uc);
642
643 st->print_cr("Register to memory mapping:");
644 st->cr();
645
646 // this is only for the "general purpose" registers
647 st->print("G1="); print_location(st, uc->uc_mcontext.gregs[REG_G1]);
648 st->print("G2="); print_location(st, uc->uc_mcontext.gregs[REG_G2]);
649 st->print("G3="); print_location(st, uc->uc_mcontext.gregs[REG_G3]);
650 st->print("G4="); print_location(st, uc->uc_mcontext.gregs[REG_G4]);
651 st->print("G5="); print_location(st, uc->uc_mcontext.gregs[REG_G5]);
652 st->print("G6="); print_location(st, uc->uc_mcontext.gregs[REG_G6]);
653 st->print("G7="); print_location(st, uc->uc_mcontext.gregs[REG_G7]);
654 st->cr();
655
656 st->print("O0="); print_location(st, uc->uc_mcontext.gregs[REG_O0]);
657 st->print("O1="); print_location(st, uc->uc_mcontext.gregs[REG_O1]);
658 st->print("O2="); print_location(st, uc->uc_mcontext.gregs[REG_O2]);
659 st->print("O3="); print_location(st, uc->uc_mcontext.gregs[REG_O3]);
660 st->print("O4="); print_location(st, uc->uc_mcontext.gregs[REG_O4]);
661 st->print("O5="); print_location(st, uc->uc_mcontext.gregs[REG_O5]);
662 st->print("O6="); print_location(st, uc->uc_mcontext.gregs[REG_O6]);
663 st->print("O7="); print_location(st, uc->uc_mcontext.gregs[REG_O7]);
664 st->cr();
665
666 st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]);
667 st->print("L1="); print_location(st, sp[L1->sp_offset_in_saved_window()]);
668 st->print("L2="); print_location(st, sp[L2->sp_offset_in_saved_window()]);
669 st->print("L3="); print_location(st, sp[L3->sp_offset_in_saved_window()]);
670 st->print("L4="); print_location(st, sp[L4->sp_offset_in_saved_window()]);
671 st->print("L5="); print_location(st, sp[L5->sp_offset_in_saved_window()]);
672 st->print("L6="); print_location(st, sp[L6->sp_offset_in_saved_window()]);
673 st->print("L7="); print_location(st, sp[L7->sp_offset_in_saved_window()]);
674 st->cr();
675
676 st->print("I0="); print_location(st, sp[I0->sp_offset_in_saved_window()]);
677 st->print("I1="); print_location(st, sp[I1->sp_offset_in_saved_window()]);
678 st->print("I2="); print_location(st, sp[I2->sp_offset_in_saved_window()]);
679 st->print("I3="); print_location(st, sp[I3->sp_offset_in_saved_window()]);
680 st->print("I4="); print_location(st, sp[I4->sp_offset_in_saved_window()]);
681 st->print("I5="); print_location(st, sp[I5->sp_offset_in_saved_window()]);
682 st->print("I6="); print_location(st, sp[I6->sp_offset_in_saved_window()]);
683 st->print("I7="); print_location(st, sp[I7->sp_offset_in_saved_window()]);
684 st->cr();
660 } 685 }
661 686
662 void os::Solaris::init_thread_fpu_state(void) { 687 void os::Solaris::init_thread_fpu_state(void) {
663 // Nothing needed on Sparc. 688 // Nothing needed on Sparc.
664 } 689 }