25 // this is source code windbg based SA debugger agent to debug |
25 // this is source code windbg based SA debugger agent to debug |
26 // Dr. Watson dump files and process snapshots. |
26 // Dr. Watson dump files and process snapshots. |
27 |
27 |
28 #include "sun_jvm_hotspot_debugger_windbg_WindbgDebuggerLocal.h" |
28 #include "sun_jvm_hotspot_debugger_windbg_WindbgDebuggerLocal.h" |
29 |
29 |
30 #ifdef _M_IA64 |
30 #ifdef _M_IX86 |
31 #include "sun_jvm_hotspot_debugger_ia64_IA64ThreadContext.h" |
|
32 #define NPRGREG sun_jvm_hotspot_debugger_ia64_IA64ThreadContext_NPRGREG |
|
33 #elif _M_IX86 |
|
34 #include "sun_jvm_hotspot_debugger_x86_X86ThreadContext.h" |
31 #include "sun_jvm_hotspot_debugger_x86_X86ThreadContext.h" |
35 #define NPRGREG sun_jvm_hotspot_debugger_x86_X86ThreadContext_NPRGREG |
32 #define NPRGREG sun_jvm_hotspot_debugger_x86_X86ThreadContext_NPRGREG |
36 #elif _M_AMD64 |
33 #elif _M_AMD64 |
37 #include "sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext.h" |
34 #include "sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext.h" |
38 #define NPRGREG sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_NPRGREG |
35 #define NPRGREG sun_jvm_hotspot_debugger_amd64_AMD64ThreadContext_NPRGREG |
489 // copy register values from the CONTEXT struct |
486 // copy register values from the CONTEXT struct |
490 CONTEXT context; |
487 CONTEXT context; |
491 memset(&context, 0, sizeof(CONTEXT)); |
488 memset(&context, 0, sizeof(CONTEXT)); |
492 |
489 |
493 #undef REG_INDEX |
490 #undef REG_INDEX |
494 #ifdef _M_IA64 |
491 #ifdef _M_IX86 |
495 #define REG_INDEX(x) sun_jvm_hotspot_debugger_ia64_IA64ThreadContext_##x |
|
496 |
|
497 context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG; |
|
498 ptrIDebugAdvanced->GetThreadContext(&context, sizeof(CONTEXT)); |
|
499 |
|
500 ptrRegs[REG_INDEX(GR0)] = 0; // always 0 |
|
501 ptrRegs[REG_INDEX(GR1)] = context.IntGp; // r1 |
|
502 ptrRegs[REG_INDEX(GR2)] = context.IntT0; // r2-r3 |
|
503 ptrRegs[REG_INDEX(GR3)] = context.IntT1; |
|
504 ptrRegs[REG_INDEX(GR4)] = context.IntS0; // r4-r7 |
|
505 ptrRegs[REG_INDEX(GR5)] = context.IntS1; |
|
506 ptrRegs[REG_INDEX(GR6)] = context.IntS2; |
|
507 ptrRegs[REG_INDEX(GR7)] = context.IntS3; |
|
508 ptrRegs[REG_INDEX(GR8)] = context.IntV0; // r8 |
|
509 ptrRegs[REG_INDEX(GR9)] = context.IntT2; // r9-r11 |
|
510 ptrRegs[REG_INDEX(GR10)] = context.IntT3; |
|
511 ptrRegs[REG_INDEX(GR11)] = context.IntT4; |
|
512 ptrRegs[REG_INDEX(GR12)] = context.IntSp; // r12 stack pointer |
|
513 ptrRegs[REG_INDEX(GR13)] = context.IntTeb; // r13 teb |
|
514 ptrRegs[REG_INDEX(GR14)] = context.IntT5; // r14-r31 |
|
515 ptrRegs[REG_INDEX(GR15)] = context.IntT6; |
|
516 ptrRegs[REG_INDEX(GR16)] = context.IntT7; |
|
517 ptrRegs[REG_INDEX(GR17)] = context.IntT8; |
|
518 ptrRegs[REG_INDEX(GR18)] = context.IntT9; |
|
519 ptrRegs[REG_INDEX(GR19)] = context.IntT10; |
|
520 ptrRegs[REG_INDEX(GR20)] = context.IntT11; |
|
521 ptrRegs[REG_INDEX(GR21)] = context.IntT12; |
|
522 ptrRegs[REG_INDEX(GR22)] = context.IntT13; |
|
523 ptrRegs[REG_INDEX(GR23)] = context.IntT14; |
|
524 ptrRegs[REG_INDEX(GR24)] = context.IntT15; |
|
525 ptrRegs[REG_INDEX(GR25)] = context.IntT16; |
|
526 ptrRegs[REG_INDEX(GR26)] = context.IntT17; |
|
527 ptrRegs[REG_INDEX(GR27)] = context.IntT18; |
|
528 ptrRegs[REG_INDEX(GR28)] = context.IntT19; |
|
529 ptrRegs[REG_INDEX(GR29)] = context.IntT20; |
|
530 ptrRegs[REG_INDEX(GR30)] = context.IntT21; |
|
531 ptrRegs[REG_INDEX(GR31)] = context.IntT22; |
|
532 |
|
533 ptrRegs[REG_INDEX(INT_NATS)] = context.IntNats; |
|
534 ptrRegs[REG_INDEX(PREDS)] = context.Preds; |
|
535 |
|
536 ptrRegs[REG_INDEX(BR_RP)] = context.BrRp; |
|
537 ptrRegs[REG_INDEX(BR1)] = context.BrS0; // b1-b5 |
|
538 ptrRegs[REG_INDEX(BR2)] = context.BrS1; |
|
539 ptrRegs[REG_INDEX(BR3)] = context.BrS2; |
|
540 ptrRegs[REG_INDEX(BR4)] = context.BrS3; |
|
541 ptrRegs[REG_INDEX(BR5)] = context.BrS4; |
|
542 ptrRegs[REG_INDEX(BR6)] = context.BrT0; // b6-b7 |
|
543 ptrRegs[REG_INDEX(BR7)] = context.BrT1; |
|
544 |
|
545 ptrRegs[REG_INDEX(AP_UNAT)] = context.ApUNAT; |
|
546 ptrRegs[REG_INDEX(AP_LC)] = context.ApLC; |
|
547 ptrRegs[REG_INDEX(AP_EC)] = context.ApEC; |
|
548 ptrRegs[REG_INDEX(AP_CCV)] = context.ApCCV; |
|
549 ptrRegs[REG_INDEX(AP_DCR)] = context.ApDCR; |
|
550 |
|
551 ptrRegs[REG_INDEX(RS_PFS)] = context.RsPFS; |
|
552 ptrRegs[REG_INDEX(RS_BSP)] = context.RsBSP; |
|
553 ptrRegs[REG_INDEX(RS_BSPSTORE)] = context.RsBSPSTORE; |
|
554 ptrRegs[REG_INDEX(RS_RSC)] = context.RsRSC; |
|
555 ptrRegs[REG_INDEX(RS_RNAT)] = context.RsRNAT; |
|
556 |
|
557 ptrRegs[REG_INDEX(ST_IPSR)] = context.StIPSR; |
|
558 ptrRegs[REG_INDEX(ST_IIP)] = context.StIIP; |
|
559 ptrRegs[REG_INDEX(ST_IFS)] = context.StIFS; |
|
560 |
|
561 ptrRegs[REG_INDEX(DB_I0)] = context.DbI0; |
|
562 ptrRegs[REG_INDEX(DB_I1)] = context.DbI1; |
|
563 ptrRegs[REG_INDEX(DB_I2)] = context.DbI2; |
|
564 ptrRegs[REG_INDEX(DB_I3)] = context.DbI3; |
|
565 ptrRegs[REG_INDEX(DB_I4)] = context.DbI4; |
|
566 ptrRegs[REG_INDEX(DB_I5)] = context.DbI5; |
|
567 ptrRegs[REG_INDEX(DB_I6)] = context.DbI6; |
|
568 ptrRegs[REG_INDEX(DB_I7)] = context.DbI7; |
|
569 |
|
570 ptrRegs[REG_INDEX(DB_D0)] = context.DbD0; |
|
571 ptrRegs[REG_INDEX(DB_D1)] = context.DbD1; |
|
572 ptrRegs[REG_INDEX(DB_D2)] = context.DbD2; |
|
573 ptrRegs[REG_INDEX(DB_D3)] = context.DbD3; |
|
574 ptrRegs[REG_INDEX(DB_D4)] = context.DbD4; |
|
575 ptrRegs[REG_INDEX(DB_D5)] = context.DbD5; |
|
576 ptrRegs[REG_INDEX(DB_D6)] = context.DbD6; |
|
577 ptrRegs[REG_INDEX(DB_D7)] = context.DbD7; |
|
578 |
|
579 #elif _M_IX86 |
|
580 #define REG_INDEX(x) sun_jvm_hotspot_debugger_x86_X86ThreadContext_##x |
492 #define REG_INDEX(x) sun_jvm_hotspot_debugger_x86_X86ThreadContext_##x |
581 |
493 |
582 context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS; |
494 context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS; |
583 ptrIDebugAdvanced->GetThreadContext(&context, sizeof(CONTEXT)); |
495 ptrIDebugAdvanced->GetThreadContext(&context, sizeof(CONTEXT)); |
584 |
496 |