977 if (context == NULL) return; |
977 if (context == NULL) return; |
978 |
978 |
979 const ucontext_t *uc = (const ucontext_t*)context; |
979 const ucontext_t *uc = (const ucontext_t*)context; |
980 st->print_cr("Registers:"); |
980 st->print_cr("Registers:"); |
981 #ifdef AMD64 |
981 #ifdef AMD64 |
982 st->print( "RAX=" INTPTR_FORMAT, uc->context_rax); |
982 st->print( "RAX=" INTPTR_FORMAT, (intptr_t)uc->context_rax); |
983 st->print(", RBX=" INTPTR_FORMAT, uc->context_rbx); |
983 st->print(", RBX=" INTPTR_FORMAT, (intptr_t)uc->context_rbx); |
984 st->print(", RCX=" INTPTR_FORMAT, uc->context_rcx); |
984 st->print(", RCX=" INTPTR_FORMAT, (intptr_t)uc->context_rcx); |
985 st->print(", RDX=" INTPTR_FORMAT, uc->context_rdx); |
985 st->print(", RDX=" INTPTR_FORMAT, (intptr_t)uc->context_rdx); |
986 st->cr(); |
986 st->cr(); |
987 st->print( "RSP=" INTPTR_FORMAT, uc->context_rsp); |
987 st->print( "RSP=" INTPTR_FORMAT, (intptr_t)uc->context_rsp); |
988 st->print(", RBP=" INTPTR_FORMAT, uc->context_rbp); |
988 st->print(", RBP=" INTPTR_FORMAT, (intptr_t)uc->context_rbp); |
989 st->print(", RSI=" INTPTR_FORMAT, uc->context_rsi); |
989 st->print(", RSI=" INTPTR_FORMAT, (intptr_t)uc->context_rsi); |
990 st->print(", RDI=" INTPTR_FORMAT, uc->context_rdi); |
990 st->print(", RDI=" INTPTR_FORMAT, (intptr_t)uc->context_rdi); |
991 st->cr(); |
991 st->cr(); |
992 st->print( "R8 =" INTPTR_FORMAT, uc->context_r8); |
992 st->print( "R8 =" INTPTR_FORMAT, (intptr_t)uc->context_r8); |
993 st->print(", R9 =" INTPTR_FORMAT, uc->context_r9); |
993 st->print(", R9 =" INTPTR_FORMAT, (intptr_t)uc->context_r9); |
994 st->print(", R10=" INTPTR_FORMAT, uc->context_r10); |
994 st->print(", R10=" INTPTR_FORMAT, (intptr_t)uc->context_r10); |
995 st->print(", R11=" INTPTR_FORMAT, uc->context_r11); |
995 st->print(", R11=" INTPTR_FORMAT, (intptr_t)uc->context_r11); |
996 st->cr(); |
996 st->cr(); |
997 st->print( "R12=" INTPTR_FORMAT, uc->context_r12); |
997 st->print( "R12=" INTPTR_FORMAT, (intptr_t)uc->context_r12); |
998 st->print(", R13=" INTPTR_FORMAT, uc->context_r13); |
998 st->print(", R13=" INTPTR_FORMAT, (intptr_t)uc->context_r13); |
999 st->print(", R14=" INTPTR_FORMAT, uc->context_r14); |
999 st->print(", R14=" INTPTR_FORMAT, (intptr_t)uc->context_r14); |
1000 st->print(", R15=" INTPTR_FORMAT, uc->context_r15); |
1000 st->print(", R15=" INTPTR_FORMAT, (intptr_t)uc->context_r15); |
1001 st->cr(); |
1001 st->cr(); |
1002 st->print( "RIP=" INTPTR_FORMAT, uc->context_rip); |
1002 st->print( "RIP=" INTPTR_FORMAT, (intptr_t)uc->context_rip); |
1003 st->print(", EFLAGS=" INTPTR_FORMAT, uc->context_flags); |
1003 st->print(", EFLAGS=" INTPTR_FORMAT, (intptr_t)uc->context_flags); |
1004 st->print(", ERR=" INTPTR_FORMAT, uc->context_err); |
1004 st->print(", ERR=" INTPTR_FORMAT, (intptr_t)uc->context_err); |
1005 st->cr(); |
1005 st->cr(); |
1006 st->print(" TRAPNO=" INTPTR_FORMAT, uc->context_trapno); |
1006 st->print(" TRAPNO=" INTPTR_FORMAT, (intptr_t)uc->context_trapno); |
1007 #else |
1007 #else |
1008 st->print( "EAX=" INTPTR_FORMAT, uc->context_eax); |
1008 st->print( "EAX=" INTPTR_FORMAT, (intptr_t)uc->context_eax); |
1009 st->print(", EBX=" INTPTR_FORMAT, uc->context_ebx); |
1009 st->print(", EBX=" INTPTR_FORMAT, (intptr_t)uc->context_ebx); |
1010 st->print(", ECX=" INTPTR_FORMAT, uc->context_ecx); |
1010 st->print(", ECX=" INTPTR_FORMAT, (intptr_t)uc->context_ecx); |
1011 st->print(", EDX=" INTPTR_FORMAT, uc->context_edx); |
1011 st->print(", EDX=" INTPTR_FORMAT, (intptr_t)uc->context_edx); |
1012 st->cr(); |
1012 st->cr(); |
1013 st->print( "ESP=" INTPTR_FORMAT, uc->context_esp); |
1013 st->print( "ESP=" INTPTR_FORMAT, (intptr_t)uc->context_esp); |
1014 st->print(", EBP=" INTPTR_FORMAT, uc->context_ebp); |
1014 st->print(", EBP=" INTPTR_FORMAT, (intptr_t)uc->context_ebp); |
1015 st->print(", ESI=" INTPTR_FORMAT, uc->context_esi); |
1015 st->print(", ESI=" INTPTR_FORMAT, (intptr_t)uc->context_esi); |
1016 st->print(", EDI=" INTPTR_FORMAT, uc->context_edi); |
1016 st->print(", EDI=" INTPTR_FORMAT, (intptr_t)uc->context_edi); |
1017 st->cr(); |
1017 st->cr(); |
1018 st->print( "EIP=" INTPTR_FORMAT, uc->context_eip); |
1018 st->print( "EIP=" INTPTR_FORMAT, (intptr_t)uc->context_eip); |
1019 st->print(", EFLAGS=" INTPTR_FORMAT, uc->context_eflags); |
1019 st->print(", EFLAGS=" INTPTR_FORMAT, (intptr_t)uc->context_eflags); |
1020 #endif // AMD64 |
1020 #endif // AMD64 |
1021 st->cr(); |
1021 st->cr(); |
1022 st->cr(); |
1022 st->cr(); |
1023 |
1023 |
1024 intptr_t *sp = (intptr_t *)os::Bsd::ucontext_get_sp(uc); |
1024 intptr_t *sp = (intptr_t *)os::Bsd::ucontext_get_sp(uc); |
1025 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); |
1025 st->print_cr("Top of Stack: (sp=" INTPTR_FORMAT ")", (intptr_t)sp); |
1026 print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t)); |
1026 print_hex_dump(st, (address)sp, (address)(sp + 8*sizeof(intptr_t)), sizeof(intptr_t)); |
1027 st->cr(); |
1027 st->cr(); |
1028 |
1028 |
1029 // Note: it may be unsafe to inspect memory near pc. For example, pc may |
1029 // Note: it may be unsafe to inspect memory near pc. For example, pc may |
1030 // point to garbage if entry point in an nmethod is corrupted. Leave |
1030 // point to garbage if entry point in an nmethod is corrupted. Leave |
1031 // this at the end, and hope for the best. |
1031 // this at the end, and hope for the best. |
1032 address pc = os::Bsd::ucontext_get_pc(uc); |
1032 address pc = os::Bsd::ucontext_get_pc(uc); |
1033 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); |
1033 st->print_cr("Instructions: (pc=" INTPTR_FORMAT ")", (intptr_t)pc); |
1034 print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); |
1034 print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); |
1035 } |
1035 } |
1036 |
1036 |
1037 void os::print_register_info(outputStream *st, const void *context) { |
1037 void os::print_register_info(outputStream *st, const void *context) { |
1038 if (context == NULL) return; |
1038 if (context == NULL) return; |