Mercurial > hg > graal-jvmci-8
comparison src/os_cpu/linux_x86/vm/os_linux_x86.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 | 2d26b0046e0d 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. |
716 void os::print_context(outputStream *st, void *context) { | 716 void os::print_context(outputStream *st, void *context) { |
717 if (context == NULL) return; | 717 if (context == NULL) return; |
718 | 718 |
719 ucontext_t *uc = (ucontext_t*)context; | 719 ucontext_t *uc = (ucontext_t*)context; |
720 st->print_cr("Registers:"); | 720 st->print_cr("Registers:"); |
721 | |
722 // this is horrendously verbose but the layout of the registers in the | |
723 // context does not match how we defined our abstract Register set, so | |
724 // we can't just iterate through the gregs area | |
725 | |
726 #ifdef AMD64 | 721 #ifdef AMD64 |
727 st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]); | 722 st->print( "RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]); |
728 st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]); | 723 st->print(", RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]); |
729 st->print(", RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]); | 724 st->print(", RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]); |
730 st->print(", RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]); | 725 st->print(", RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]); |
743 st->print(", R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]); | 738 st->print(", R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]); |
744 st->print(", R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]); | 739 st->print(", R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]); |
745 st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]); | 740 st->print(", R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]); |
746 st->cr(); | 741 st->cr(); |
747 st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]); | 742 st->print( "RIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RIP]); |
748 st->print(", EFL=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); | 743 st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); |
749 st->print(", CSGSFS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CSGSFS]); | 744 st->print(", CSGSFS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_CSGSFS]); |
750 st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]); | 745 st->print(", ERR=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ERR]); |
751 st->cr(); | 746 st->cr(); |
752 st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]); | 747 st->print(" TRAPNO=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_TRAPNO]); |
753 | |
754 st->cr(); | |
755 st->cr(); | |
756 | |
757 st->print_cr("Register to memory mapping:"); | |
758 st->cr(); | |
759 | |
760 // this is only for the "general purpose" registers | |
761 | |
762 st->print_cr("RAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RAX]); | |
763 print_location(st, uc->uc_mcontext.gregs[REG_RAX]); | |
764 st->cr(); | |
765 st->print_cr("RBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBX]); | |
766 print_location(st, uc->uc_mcontext.gregs[REG_RBX]); | |
767 st->cr(); | |
768 st->print_cr("RCX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RCX]); | |
769 print_location(st, uc->uc_mcontext.gregs[REG_RCX]); | |
770 st->cr(); | |
771 st->print_cr("RDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDX]); | |
772 print_location(st, uc->uc_mcontext.gregs[REG_RDX]); | |
773 st->cr(); | |
774 st->print_cr("RSP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSP]); | |
775 print_location(st, uc->uc_mcontext.gregs[REG_RSP]); | |
776 st->cr(); | |
777 st->print_cr("RBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RBP]); | |
778 print_location(st, uc->uc_mcontext.gregs[REG_RBP]); | |
779 st->cr(); | |
780 st->print_cr("RSI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RSI]); | |
781 print_location(st, uc->uc_mcontext.gregs[REG_RSI]); | |
782 st->cr(); | |
783 st->print_cr("RDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_RDI]); | |
784 print_location(st, uc->uc_mcontext.gregs[REG_RDI]); | |
785 st->cr(); | |
786 st->print_cr("R8 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R8]); | |
787 print_location(st, uc->uc_mcontext.gregs[REG_R8]); | |
788 st->cr(); | |
789 st->print_cr("R9 =" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R9]); | |
790 print_location(st, uc->uc_mcontext.gregs[REG_R9]); | |
791 st->cr(); | |
792 st->print_cr("R10=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R10]); | |
793 print_location(st, uc->uc_mcontext.gregs[REG_R10]); | |
794 st->cr(); | |
795 st->print_cr("R11=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R11]); | |
796 print_location(st, uc->uc_mcontext.gregs[REG_R11]); | |
797 st->cr(); | |
798 st->print_cr("R12=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R12]); | |
799 print_location(st, uc->uc_mcontext.gregs[REG_R12]); | |
800 st->cr(); | |
801 st->print_cr("R13=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R13]); | |
802 print_location(st, uc->uc_mcontext.gregs[REG_R13]); | |
803 st->cr(); | |
804 st->print_cr("R14=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R14]); | |
805 print_location(st, uc->uc_mcontext.gregs[REG_R14]); | |
806 st->cr(); | |
807 st->print_cr("R15=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_R15]); | |
808 print_location(st, uc->uc_mcontext.gregs[REG_R15]); | |
809 | |
810 #else | 748 #else |
811 st->print( "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]); | 749 st->print( "EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]); |
812 st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]); | 750 st->print(", EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]); |
813 st->print(", ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ECX]); | 751 st->print(", ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ECX]); |
814 st->print(", EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDX]); | 752 st->print(", EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDX]); |
817 st->print(", EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBP]); | 755 st->print(", EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBP]); |
818 st->print(", ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESI]); | 756 st->print(", ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESI]); |
819 st->print(", EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDI]); | 757 st->print(", EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDI]); |
820 st->cr(); | 758 st->cr(); |
821 st->print( "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EIP]); | 759 st->print( "EIP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EIP]); |
760 st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); | |
822 st->print(", CR2=" INTPTR_FORMAT, uc->uc_mcontext.cr2); | 761 st->print(", CR2=" INTPTR_FORMAT, uc->uc_mcontext.cr2); |
823 st->print(", EFLAGS=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EFL]); | |
824 | |
825 st->cr(); | |
826 st->cr(); | |
827 | |
828 st->print_cr("Register to memory mapping:"); | |
829 st->cr(); | |
830 | |
831 // this is only for the "general purpose" registers | |
832 | |
833 st->print_cr("EAX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EAX]); | |
834 print_location(st, uc->uc_mcontext.gregs[REG_EAX]); | |
835 st->cr(); | |
836 st->print_cr("EBX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBX]); | |
837 print_location(st, uc->uc_mcontext.gregs[REG_EBX]); | |
838 st->cr(); | |
839 st->print_cr("ECX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ECX]); | |
840 print_location(st, uc->uc_mcontext.gregs[REG_ECX]); | |
841 st->cr(); | |
842 st->print_cr("EDX=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDX]); | |
843 print_location(st, uc->uc_mcontext.gregs[REG_EDX]); | |
844 st->cr(); | |
845 st->print_cr("ESP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESP]); | |
846 print_location(st, uc->uc_mcontext.gregs[REG_ESP]); | |
847 st->cr(); | |
848 st->print_cr("EBP=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EBP]); | |
849 print_location(st, uc->uc_mcontext.gregs[REG_EBP]); | |
850 st->cr(); | |
851 st->print_cr("ESI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_ESI]); | |
852 print_location(st, uc->uc_mcontext.gregs[REG_ESI]); | |
853 st->cr(); | |
854 st->print_cr("EDI=" INTPTR_FORMAT, uc->uc_mcontext.gregs[REG_EDI]); | |
855 print_location(st, uc->uc_mcontext.gregs[REG_EDI]); | |
856 | |
857 #endif // AMD64 | 762 #endif // AMD64 |
858 st->cr(); | 763 st->cr(); |
859 st->cr(); | 764 st->cr(); |
860 | 765 |
861 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); | 766 intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc); |
866 // Note: it may be unsafe to inspect memory near pc. For example, pc may | 771 // Note: it may be unsafe to inspect memory near pc. For example, pc may |
867 // point to garbage if entry point in an nmethod is corrupted. Leave | 772 // point to garbage if entry point in an nmethod is corrupted. Leave |
868 // this at the end, and hope for the best. | 773 // this at the end, and hope for the best. |
869 address pc = os::Linux::ucontext_get_pc(uc); | 774 address pc = os::Linux::ucontext_get_pc(uc); |
870 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); | 775 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); |
871 print_hex_dump(st, pc - 16, pc + 16, sizeof(char)); | 776 print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); |
777 } | |
778 | |
779 void os::print_register_info(outputStream *st, void *context) { | |
780 if (context == NULL) return; | |
781 | |
782 ucontext_t *uc = (ucontext_t*)context; | |
783 | |
784 st->print_cr("Register to memory mapping:"); | |
785 st->cr(); | |
786 | |
787 // this is horrendously verbose but the layout of the registers in the | |
788 // context does not match how we defined our abstract Register set, so | |
789 // we can't just iterate through the gregs area | |
790 | |
791 // this is only for the "general purpose" registers | |
792 | |
793 #ifdef AMD64 | |
794 st->print("RAX="); print_location(st, uc->uc_mcontext.gregs[REG_RAX]); | |
795 st->print("RBX="); print_location(st, uc->uc_mcontext.gregs[REG_RBX]); | |
796 st->print("RCX="); print_location(st, uc->uc_mcontext.gregs[REG_RCX]); | |
797 st->print("RDX="); print_location(st, uc->uc_mcontext.gregs[REG_RDX]); | |
798 st->print("RSP="); print_location(st, uc->uc_mcontext.gregs[REG_RSP]); | |
799 st->print("RBP="); print_location(st, uc->uc_mcontext.gregs[REG_RBP]); | |
800 st->print("RSI="); print_location(st, uc->uc_mcontext.gregs[REG_RSI]); | |
801 st->print("RDI="); print_location(st, uc->uc_mcontext.gregs[REG_RDI]); | |
802 st->print("R8 ="); print_location(st, uc->uc_mcontext.gregs[REG_R8]); | |
803 st->print("R9 ="); print_location(st, uc->uc_mcontext.gregs[REG_R9]); | |
804 st->print("R10="); print_location(st, uc->uc_mcontext.gregs[REG_R10]); | |
805 st->print("R11="); print_location(st, uc->uc_mcontext.gregs[REG_R11]); | |
806 st->print("R12="); print_location(st, uc->uc_mcontext.gregs[REG_R12]); | |
807 st->print("R13="); print_location(st, uc->uc_mcontext.gregs[REG_R13]); | |
808 st->print("R14="); print_location(st, uc->uc_mcontext.gregs[REG_R14]); | |
809 st->print("R15="); print_location(st, uc->uc_mcontext.gregs[REG_R15]); | |
810 #else | |
811 st->print("EAX="); print_location(st, uc->uc_mcontext.gregs[REG_EAX]); | |
812 st->print("EBX="); print_location(st, uc->uc_mcontext.gregs[REG_EBX]); | |
813 st->print("ECX="); print_location(st, uc->uc_mcontext.gregs[REG_ECX]); | |
814 st->print("EDX="); print_location(st, uc->uc_mcontext.gregs[REG_EDX]); | |
815 st->print("ESP="); print_location(st, uc->uc_mcontext.gregs[REG_ESP]); | |
816 st->print("EBP="); print_location(st, uc->uc_mcontext.gregs[REG_EBP]); | |
817 st->print("ESI="); print_location(st, uc->uc_mcontext.gregs[REG_ESI]); | |
818 st->print("EDI="); print_location(st, uc->uc_mcontext.gregs[REG_EDI]); | |
819 #endif // AMD64 | |
820 | |
821 st->cr(); | |
872 } | 822 } |
873 | 823 |
874 void os::setup_fpu() { | 824 void os::setup_fpu() { |
875 #ifndef AMD64 | 825 #ifndef AMD64 |
876 address fpu_cntrl = StubRoutines::addr_fpu_cntrl_wrd_std(); | 826 address fpu_cntrl = StubRoutines::addr_fpu_cntrl_wrd_std(); |