370 } 371 } 372 373 void os::print_context(outputStream *st, void *context) { 374 if (context == NULL) return; 375 376 CONTEXT* uc = (CONTEXT*)context; 377 378 st->print_cr("Registers:"); 379 #ifdef AMD64 380 st->print( "RAX=" INTPTR_FORMAT, uc->Rax); 381 st->print(", RBX=" INTPTR_FORMAT, uc->Rbx); 382 st->print(", RCX=" INTPTR_FORMAT, uc->Rcx); 383 st->print(", RDX=" INTPTR_FORMAT, uc->Rdx); 384 st->cr(); 385 st->print( "RSP=" INTPTR_FORMAT, uc->Rsp); 386 st->print(", RBP=" INTPTR_FORMAT, uc->Rbp); 387 st->print(", RSI=" INTPTR_FORMAT, uc->Rsi); 388 st->print(", RDI=" INTPTR_FORMAT, uc->Rdi); 389 st->cr(); 390 st->print( "R8=" INTPTR_FORMAT, uc->R8); 391 st->print(", R9=" INTPTR_FORMAT, uc->R9); 392 st->print(", R10=" INTPTR_FORMAT, uc->R10); 393 st->print(", R11=" INTPTR_FORMAT, uc->R11); 394 st->cr(); 395 st->print( "R12=" INTPTR_FORMAT, uc->R12); 396 st->print(", R13=" INTPTR_FORMAT, uc->R13); 397 st->print(", R14=" INTPTR_FORMAT, uc->R14); 398 st->print(", R15=" INTPTR_FORMAT, uc->R15); 399 st->cr(); 400 st->print( "RIP=" INTPTR_FORMAT, uc->Rip); 401 st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags); 402 403 st->cr(); 404 st->cr(); 405 406 st->print_cr("Register to memory mapping:"); 407 st->cr(); 408 409 // this is only for the "general purpose" registers 410 411 st->print_cr("RAX=" INTPTR_FORMAT, uc->Rax); 412 print_location(st, uc->Rax); 413 st->cr(); 414 st->print_cr("RBX=" INTPTR_FORMAT, uc->Rbx); 415 print_location(st, uc->Rbx); 416 st->cr(); 417 st->print_cr("RCX=" INTPTR_FORMAT, uc->Rcx); 418 print_location(st, uc->Rcx); 419 st->cr(); 420 st->print_cr("RDX=" INTPTR_FORMAT, uc->Rdx); 421 print_location(st, uc->Rdx); 422 st->cr(); 423 st->print_cr("RSP=" INTPTR_FORMAT, uc->Rsp); 424 print_location(st, uc->Rsp); 425 st->cr(); 426 st->print_cr("RBP=" INTPTR_FORMAT, uc->Rbp); 427 print_location(st, uc->Rbp); 428 st->cr(); 429 st->print_cr("RSI=" INTPTR_FORMAT, uc->Rsi); 430 print_location(st, uc->Rsi); 431 st->cr(); 432 st->print_cr("RDI=" INTPTR_FORMAT, uc->Rdi); 433 print_location(st, uc->Rdi); 434 st->cr(); 435 st->print_cr("R8 =" INTPTR_FORMAT, uc->R8); 436 print_location(st, uc->R8); 437 st->cr(); 438 st->print_cr("R9 =" INTPTR_FORMAT, uc->R9); 439 print_location(st, uc->R9); 440 st->cr(); 441 st->print_cr("R10=" INTPTR_FORMAT, uc->R10); 442 print_location(st, uc->R10); 443 st->cr(); 444 st->print_cr("R11=" INTPTR_FORMAT, uc->R11); 445 print_location(st, uc->R11); 446 st->cr(); 447 st->print_cr("R12=" INTPTR_FORMAT, uc->R12); 448 print_location(st, uc->R12); 449 st->cr(); 450 st->print_cr("R13=" INTPTR_FORMAT, uc->R13); 451 print_location(st, uc->R13); 452 st->cr(); 453 st->print_cr("R14=" INTPTR_FORMAT, uc->R14); 454 print_location(st, uc->R14); 455 st->cr(); 456 st->print_cr("R15=" INTPTR_FORMAT, uc->R15); 457 print_location(st, uc->R15); 458 #else 459 st->print( "EAX=" INTPTR_FORMAT, uc->Eax); 460 st->print(", EBX=" INTPTR_FORMAT, uc->Ebx); 461 st->print(", ECX=" INTPTR_FORMAT, uc->Ecx); 462 st->print(", EDX=" INTPTR_FORMAT, uc->Edx); 463 st->cr(); 464 st->print( "ESP=" INTPTR_FORMAT, uc->Esp); 465 st->print(", EBP=" INTPTR_FORMAT, uc->Ebp); 466 st->print(", ESI=" INTPTR_FORMAT, uc->Esi); 467 st->print(", EDI=" INTPTR_FORMAT, uc->Edi); 468 st->cr(); 469 st->print( "EIP=" INTPTR_FORMAT, uc->Eip); 470 st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags); 471 472 st->cr(); 473 st->cr(); 474 475 st->print_cr("Register to memory mapping:"); 476 st->cr(); 477 478 // this is only for the "general purpose" registers 479 480 st->print_cr("EAX=" INTPTR_FORMAT, uc->Eax); 481 print_location(st, uc->Eax); 482 st->cr(); 483 st->print_cr("EBX=" INTPTR_FORMAT, uc->Ebx); 484 print_location(st, uc->Ebx); 485 st->cr(); 486 st->print_cr("ECX=" INTPTR_FORMAT, uc->Ecx); 487 print_location(st, uc->Ecx); 488 st->cr(); 489 st->print_cr("EDX=" INTPTR_FORMAT, uc->Edx); 490 print_location(st, uc->Edx); 491 st->cr(); 492 st->print_cr("ESP=" INTPTR_FORMAT, uc->Esp); 493 print_location(st, uc->Esp); 494 st->cr(); 495 st->print_cr("EBP=" INTPTR_FORMAT, uc->Ebp); 496 print_location(st, uc->Ebp); 497 st->cr(); 498 st->print_cr("ESI=" INTPTR_FORMAT, uc->Esi); 499 print_location(st, uc->Esi); 500 st->cr(); 501 st->print_cr("EDI=" INTPTR_FORMAT, uc->Edi); 502 print_location(st, uc->Edi); 503 #endif // AMD64 504 st->cr(); 505 st->cr(); 506 507 intptr_t *sp = (intptr_t *)uc->REG_SP; 508 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); 509 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); 510 st->cr(); 511 512 // Note: it may be unsafe to inspect memory near pc. For example, pc may 513 // point to garbage if entry point in an nmethod is corrupted. Leave 514 // this at the end, and hope for the best. 515 address pc = (address)uc->REG_PC; 516 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); 517 print_hex_dump(st, pc - 16, pc + 16, sizeof(char)); 518 st->cr(); 519 } 520 521 extern "C" int SafeFetch32 (int * adr, int Err) { 522 int rv = Err ; 523 _try { 524 rv = *((volatile int *) adr) ; 525 } __except(EXCEPTION_EXECUTE_HANDLER) { 526 } 527 return rv ; 528 } 529 530 extern "C" intptr_t SafeFetchN (intptr_t * adr, intptr_t Err) { 531 intptr_t rv = Err ; 532 _try { 533 rv = *((volatile intptr_t *) adr) ; 534 } __except(EXCEPTION_EXECUTE_HANDLER) { 535 } 536 return rv ; 537 } 538 539 extern "C" int SpinPause () { | 370 } 371 } 372 373 void os::print_context(outputStream *st, void *context) { 374 if (context == NULL) return; 375 376 CONTEXT* uc = (CONTEXT*)context; 377 378 st->print_cr("Registers:"); 379 #ifdef AMD64 380 st->print( "RAX=" INTPTR_FORMAT, uc->Rax); 381 st->print(", RBX=" INTPTR_FORMAT, uc->Rbx); 382 st->print(", RCX=" INTPTR_FORMAT, uc->Rcx); 383 st->print(", RDX=" INTPTR_FORMAT, uc->Rdx); 384 st->cr(); 385 st->print( "RSP=" INTPTR_FORMAT, uc->Rsp); 386 st->print(", RBP=" INTPTR_FORMAT, uc->Rbp); 387 st->print(", RSI=" INTPTR_FORMAT, uc->Rsi); 388 st->print(", RDI=" INTPTR_FORMAT, uc->Rdi); 389 st->cr(); 390 st->print( "R8 =" INTPTR_FORMAT, uc->R8); 391 st->print(", R9 =" INTPTR_FORMAT, uc->R9); 392 st->print(", R10=" INTPTR_FORMAT, uc->R10); 393 st->print(", R11=" INTPTR_FORMAT, uc->R11); 394 st->cr(); 395 st->print( "R12=" INTPTR_FORMAT, uc->R12); 396 st->print(", R13=" INTPTR_FORMAT, uc->R13); 397 st->print(", R14=" INTPTR_FORMAT, uc->R14); 398 st->print(", R15=" INTPTR_FORMAT, uc->R15); 399 st->cr(); 400 st->print( "RIP=" INTPTR_FORMAT, uc->Rip); 401 st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags); 402 #else 403 st->print( "EAX=" INTPTR_FORMAT, uc->Eax); 404 st->print(", EBX=" INTPTR_FORMAT, uc->Ebx); 405 st->print(", ECX=" INTPTR_FORMAT, uc->Ecx); 406 st->print(", EDX=" INTPTR_FORMAT, uc->Edx); 407 st->cr(); 408 st->print( "ESP=" INTPTR_FORMAT, uc->Esp); 409 st->print(", EBP=" INTPTR_FORMAT, uc->Ebp); 410 st->print(", ESI=" INTPTR_FORMAT, uc->Esi); 411 st->print(", EDI=" INTPTR_FORMAT, uc->Edi); 412 st->cr(); 413 st->print( "EIP=" INTPTR_FORMAT, uc->Eip); 414 st->print(", EFLAGS=" INTPTR_FORMAT, uc->EFlags); 415 #endif // AMD64 416 st->cr(); 417 st->cr(); 418 419 intptr_t *sp = (intptr_t *)uc->REG_SP; 420 st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp); 421 print_hex_dump(st, (address)sp, (address)(sp + 32), sizeof(intptr_t)); 422 st->cr(); 423 424 // Note: it may be unsafe to inspect memory near pc. For example, pc may 425 // point to garbage if entry point in an nmethod is corrupted. Leave 426 // this at the end, and hope for the best. 427 address pc = (address)uc->REG_PC; 428 st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc); 429 print_hex_dump(st, pc - 32, pc + 32, sizeof(char)); 430 st->cr(); 431 } 432 433 434 void os::print_register_info(outputStream *st, void *context) { 435 if (context == NULL) return; 436 437 CONTEXT* uc = (CONTEXT*)context; 438 439 st->print_cr("Register to memory mapping:"); 440 st->cr(); 441 442 // this is only for the "general purpose" registers 443 444 #ifdef AMD64 445 st->print("RAX="); print_location(st, uc->Rax); 446 st->print("RBX="); print_location(st, uc->Rbx); 447 st->print("RCX="); print_location(st, uc->Rcx); 448 st->print("RDX="); print_location(st, uc->Rdx); 449 st->print("RSP="); print_location(st, uc->Rsp); 450 st->print("RBP="); print_location(st, uc->Rbp); 451 st->print("RSI="); print_location(st, uc->Rsi); 452 st->print("RDI="); print_location(st, uc->Rdi); 453 st->print("R8 ="); print_location(st, uc->R8); 454 st->print("R9 ="); print_location(st, uc->R9); 455 st->print("R10="); print_location(st, uc->R10); 456 st->print("R11="); print_location(st, uc->R11); 457 st->print("R12="); print_location(st, uc->R12); 458 st->print("R13="); print_location(st, uc->R13); 459 st->print("R14="); print_location(st, uc->R14); 460 st->print("R15="); print_location(st, uc->R15); 461 #else 462 st->print("EAX="); print_location(st, uc->Eax); 463 st->print("EBX="); print_location(st, uc->Ebx); 464 st->print("ECX="); print_location(st, uc->Ecx); 465 st->print("EDX="); print_location(st, uc->Edx); 466 st->print("ESP="); print_location(st, uc->Esp); 467 st->print("EBP="); print_location(st, uc->Ebp); 468 st->print("ESI="); print_location(st, uc->Esi); 469 st->print("EDI="); print_location(st, uc->Edi); 470 #endif 471 472 st->cr(); 473 } 474 475 extern "C" int SafeFetch32 (int * adr, int Err) { 476 int rv = Err ; 477 _try { 478 rv = *((volatile int *) adr) ; 479 } __except(EXCEPTION_EXECUTE_HANDLER) { 480 } 481 return rv ; 482 } 483 484 extern "C" intptr_t SafeFetchN (intptr_t * adr, intptr_t Err) { 485 intptr_t rv = Err ; 486 _try { 487 rv = *((volatile intptr_t *) adr) ; 488 } __except(EXCEPTION_EXECUTE_HANDLER) { 489 } 490 return rv ; 491 } 492 493 extern "C" int SpinPause () { |