Changeset 107227 in vbox for trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp
- Timestamp:
- Dec 4, 2024 3:20:14 PM (6 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp
r106383 r107227 76 76 { 77 77 m_State.u32Magic = RTDBGUNWINDSTATE_MAGIC; 78 #if defined(VBOX_VMM_TARGET_ARMV8)78 #ifdef VBOX_VMM_TARGET_ARMV8 79 79 m_State.enmArch = RTLDRARCH_ARM64; 80 #elif defined(VBOX_VMM_TARGET_X86) 81 m_State.enmArch = RTLDRARCH_AMD64; 80 82 #else 81 m_State.enmArch = RTLDRARCH_AMD64; 83 # error "port me" 82 84 #endif 83 85 m_State.pfnReadStack = dbgfR3StackReadCallback; … … 86 88 if (pInitialCtx) 87 89 { 88 #if defined(VBOX_VMM_TARGET_ARMV8)90 #ifdef VBOX_VMM_TARGET_ARMV8 89 91 AssertCompile(RT_ELEMENTS(m_State.u.armv8.auGprs) == RT_ELEMENTS(pInitialCtx->aGRegs)); 90 92 … … 95 97 for (uint32_t i = 0; i < RT_ELEMENTS(m_State.u.armv8.auGprs); i++) 96 98 m_State.u.armv8.auGprs[i] = pInitialCtx->aGRegs[i].x; 97 #else 99 100 #elif defined(VBOX_VMM_TARGET_X86) 98 101 m_State.u.x86.auRegs[X86_GREG_xAX] = pInitialCtx->rax; 99 102 m_State.u.x86.auRegs[X86_GREG_xCX] = pInitialCtx->rcx; … … 174 177 static DECLCALLBACK(int) dbgfR3StackReadCallback(PRTDBGUNWINDSTATE pThis, RTUINTPTR uSp, size_t cbToRead, void *pvDst) 175 178 { 176 #if defined(VBOX_VMM_TARGET_ARMV8)179 #ifdef VBOX_VMM_TARGET_ARMV8 177 180 Assert(pThis->enmArch == RTLDRARCH_ARM64); 178 #el se181 #elif defined(VBOX_VMM_TARGET_X86) 179 182 Assert( pThis->enmArch == RTLDRARCH_AMD64 180 183 || pThis->enmArch == RTLDRARCH_X86_32); 184 #else 185 # error "port me" 181 186 #endif 182 187 … … 188 193 else 189 194 { 190 #if defined(VBOX_VMM_TARGET_ARMV8) 191 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp); 192 #else 195 #ifdef VBOX_VMM_TARGET_X86 193 196 if ( pThis->enmArch == RTLDRARCH_X86_32 194 197 || pThis->enmArch == RTLDRARCH_X86_16) … … 201 204 else 202 205 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp); 206 #else 207 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &SrcAddr, uSp); 203 208 #endif 204 209 } … … 221 226 static bool dbgfR3UnwindCtxSetPcAndSp(PDBGFUNWINDCTX pUnwindCtx, PCDBGFADDRESS pAddrPC, PCDBGFADDRESS pAddrStack) 222 227 { 223 #if defined(VBOX_VMM_TARGET_ARMV8)228 #ifdef VBOX_VMM_TARGET_ARMV8 224 229 Assert(pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64); 225 230 … … 228 233 Assert(!DBGFADDRESS_IS_FAR(pAddrStack)); 229 234 pUnwindCtx->m_State.u.armv8.uSpEl1 = pAddrStack->FlatPtr; /** @todo EL0 stack pointer. */ 230 #else 235 236 #elif defined(VBOX_VMM_TARGET_X86) 231 237 Assert( pUnwindCtx->m_State.enmArch == RTLDRARCH_AMD64 232 238 || pUnwindCtx->m_State.enmArch == RTLDRARCH_X86_32); … … 246 252 pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_SS] = pAddrStack->Sel; 247 253 } 254 255 #else 256 # error "port me" 248 257 #endif 249 258 … … 502 511 503 512 504 #if defined(VBOX_VMM_TARGET_ARMV8)505 513 /** 506 514 * Internal worker routine. … … 510 518 * 4 return address 511 519 * 0 old fp; current fp points here 520 * 521 * On x86 the typical stack frame layout is like this: 522 * .. .. 523 * 16 parameter 2 524 * 12 parameter 1 525 * 8 parameter 0 526 * 4 return address 527 * 0 old ebp; current ebp points here 512 528 */ 513 529 DECL_NO_INLINE(static, int) dbgfR3StackWalk(PDBGFUNWINDCTX pUnwindCtx, PDBGFSTACKFRAME pFrame, bool fFirst) … … 552 568 * Figure the return address size and use the old PC to guess stack item size. 553 569 */ 570 #ifdef VBOX_VMM_TARGET_ARMV8 554 571 unsigned const cbRetAddr = 8; 555 572 unsigned const cbStackItem = 8; /** @todo AARCH32. */ 556 573 PVMCPUCC const pVCpu = pUnwindCtx->m_pUVM->pVM->apCpusR3[pUnwindCtx->m_idCpu]; 557 574 558 /* 559 * Read the raw frame data. 560 * We double cbRetAddr in case we have a far return. 561 */ 562 union 563 { 564 uint64_t *pu64; 565 uint32_t *pu32; 566 uint8_t *pb; 567 void *pv; 568 } u, uRet, uArgs, uBp; 569 size_t cbRead = cbRetAddr * 2 + cbStackItem + sizeof(pFrame->Args); 570 u.pv = alloca(cbRead); 571 uBp = u; 572 uRet.pb = u.pb + cbStackItem; 573 uArgs.pb = u.pb + cbStackItem + cbRetAddr; 574 575 Assert(DBGFADDRESS_IS_VALID(&pFrame->AddrFrame)); 576 int rc = dbgfR3StackRead(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, u.pv, &pFrame->AddrFrame, cbRead, &cbRead); 577 if ( RT_FAILURE(rc) 578 || cbRead < cbRetAddr + cbStackItem) 579 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_LAST; 580 581 /* 582 * Return Frame address. 583 * 584 * If we used unwind info to get here, the unwind register context will be 585 * positioned after the return instruction has been executed. We start by 586 * picking up the rBP register here for return frame and will try improve 587 * on it further down by using unwind info. 588 */ 589 pFrame->AddrReturnFrame = pFrame->AddrFrame; 590 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 591 { 592 AssertFailed(); /** @todo */ 593 } 594 else 595 { 596 switch (cbStackItem) 597 { 598 case 4: pFrame->AddrReturnFrame.off = *uBp.pu32; break; 599 case 8: pFrame->AddrReturnFrame.off = CPUMGetGCPtrPacStripped(pVCpu, *uBp.pu64); break; 600 default: AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_1); 601 } 602 603 pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off; 604 } 605 606 /* 607 * Return Stack Address. 608 */ 609 pFrame->AddrReturnStack = pFrame->AddrReturnFrame; 610 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 611 { 612 AssertFailed(); 613 } 614 else 615 { 616 pFrame->AddrReturnStack.off += cbStackItem + cbRetAddr; 617 pFrame->AddrReturnStack.FlatPtr += cbStackItem + cbRetAddr; 618 } 619 620 /* 621 * Return PC. 622 */ 623 pFrame->AddrReturnPC = pFrame->AddrPC; 624 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 625 { 626 AssertFailed(); 627 } 628 else 629 { 630 switch (pFrame->enmReturnType) 631 { 632 case RTDBGRETURNTYPE_NEAR64: 633 if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC)) 634 { 635 pFrame->AddrReturnPC.FlatPtr += CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64) - pFrame->AddrReturnPC.off; 636 pFrame->AddrReturnPC.off = CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64); 637 } 638 else 639 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64)); 640 break; 641 default: 642 AssertMsgFailed(("enmReturnType=%d\n", pFrame->enmReturnType)); 643 return VERR_INVALID_PARAMETER; 644 } 645 } 646 647 648 pFrame->pSymReturnPC = DBGFR3AsSymbolByAddrA(pUnwindCtx->m_pUVM, pUnwindCtx->m_hAs, &pFrame->AddrReturnPC, 649 RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL | RTDBGSYMADDR_FLAGS_SKIP_ABS_IN_DEFERRED, 650 NULL /*poffDisp*/, NULL /*phMod*/); 651 pFrame->pLineReturnPC = DBGFR3AsLineByAddrA(pUnwindCtx->m_pUVM, pUnwindCtx->m_hAs, &pFrame->AddrReturnPC, 652 NULL /*poffDisp*/, NULL /*phMod*/); 653 654 /* 655 * Frame bitness flag. 656 */ 657 /** @todo use previous return type for this? */ 658 pFrame->fFlags &= ~(DBGFSTACKFRAME_FLAGS_32BIT | DBGFSTACKFRAME_FLAGS_64BIT); 659 switch (cbStackItem) 660 { 661 case 4: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_32BIT; break; 662 case 8: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_64BIT; break; 663 default: AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_2); 664 } 665 666 /* 667 * The arguments. 668 */ 669 memcpy(&pFrame->Args, uArgs.pv, sizeof(pFrame->Args)); 670 671 /* 672 * Collect register changes. 673 * Then call the OS layer to assist us (e.g. NT trap frames). 674 */ 675 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 676 { 677 AssertFailed(); 678 } 679 680 /* 681 * Try use unwind information to locate the return frame pointer (for the 682 * next loop iteration). 683 */ 684 Assert(!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET)); 685 pFrame->enmReturnFrameReturnType = RTDBGRETURNTYPE_INVALID; 686 if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_LAST)) 687 { 688 /* Set PC and SP if we didn't unwind our way here (context will then point 689 and the return PC and SP already). */ 690 if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)) 691 { 692 dbgfR3UnwindCtxSetPcAndSp(pUnwindCtx, &pFrame->AddrReturnPC, &pFrame->AddrReturnStack); 693 pUnwindCtx->m_State.u.armv8.auGprs[ARMV8_A64_REG_BP] = pFrame->AddrReturnFrame.off; 694 } 695 if (pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64) 696 pUnwindCtx->m_State.u.armv8.Loaded.fAll = 0; 697 else 698 AssertFailed(); 699 if (dbgfR3UnwindCtxDoOneFrame(pUnwindCtx)) 700 { 701 Assert(!pUnwindCtx->m_fIsHostRing0); 702 703 DBGFADDRESS AddrReturnFrame = pFrame->AddrReturnFrame; 704 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &AddrReturnFrame, pUnwindCtx->m_State.u.armv8.FrameAddr); 705 pFrame->AddrReturnFrame = AddrReturnFrame; 706 707 pFrame->enmReturnFrameReturnType = pUnwindCtx->m_State.enmRetType; 708 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET; 709 } 710 } 711 712 return VINF_SUCCESS; 713 } 714 #else 715 /** 716 * Internal worker routine. 717 * 718 * On x86 the typical stack frame layout is like this: 719 * .. .. 720 * 16 parameter 2 721 * 12 parameter 1 722 * 8 parameter 0 723 * 4 return address 724 * 0 old ebp; current ebp points here 725 */ 726 DECL_NO_INLINE(static, int) dbgfR3StackWalk(PDBGFUNWINDCTX pUnwindCtx, PDBGFSTACKFRAME pFrame, bool fFirst) 727 { 728 /* 729 * Stop if we got a read error in the previous run. 730 */ 731 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_LAST) 732 return VERR_NO_MORE_FILES; 733 734 /* 735 * Advance the frame (except for the first). 736 */ 737 if (!fFirst) /** @todo we can probably eliminate this fFirst business... */ 738 { 739 /* frame, pc and stack is taken from the existing frames return members. */ 740 pFrame->AddrFrame = pFrame->AddrReturnFrame; 741 pFrame->AddrPC = pFrame->AddrReturnPC; 742 pFrame->pSymPC = pFrame->pSymReturnPC; 743 pFrame->pLinePC = pFrame->pLineReturnPC; 744 745 /* increment the frame number. */ 746 pFrame->iFrame++; 747 748 /* UNWIND_INFO_RET -> USED_UNWIND; return type */ 749 if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET)) 750 pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO; 751 else 752 { 753 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO; 754 pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET; 755 if (pFrame->enmReturnFrameReturnType != RTDBGRETURNTYPE_INVALID) 756 { 757 pFrame->enmReturnType = pFrame->enmReturnFrameReturnType; 758 pFrame->enmReturnFrameReturnType = RTDBGRETURNTYPE_INVALID; 759 } 760 } 761 pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_TRAP_FRAME; 762 } 763 764 /* 765 * Figure the return address size and use the old PC to guess stack item size. 766 */ 575 #elif defined(VBOX_VMM_TARGET_X86) 767 576 /** @todo this is bogus... */ 768 577 unsigned cbRetAddr = RTDbgReturnTypeSize(pFrame->enmReturnType); … … 797 606 } 798 607 } 608 #endif 799 609 800 610 /* … … 810 620 void *pv; 811 621 } u, uRet, uArgs, uBp; 812 size_t cbRead = cbRetAddr *2 + cbStackItem + sizeof(pFrame->Args);622 size_t cbRead = cbRetAddr * 2 + cbStackItem + sizeof(pFrame->Args); 813 623 u.pv = alloca(cbRead); 814 624 uBp = u; … … 833 643 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 834 644 { 645 #ifdef VBOX_VMM_TARGET_ARMV8 646 AssertFailed(); /** @todo */ 647 648 #elif defined(VBOX_VMM_TARGET_X86) 835 649 if ( pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_PRIV 836 650 || pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64) … … 846 660 pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off; 847 661 } 662 #endif /* VBOX_VMM_TARGET_X86 */ 848 663 } 849 664 else … … 851 666 switch (cbStackItem) 852 667 { 668 #ifdef VBOX_VMM_TARGET_ARMV8 669 case 8: pFrame->AddrReturnFrame.off = CPUMGetGCPtrPacStripped(pVCpu, *uBp.pu64); break; 670 #else 671 case 8: pFrame->AddrReturnFrame.off = *uBp.pu64; break; 672 #endif 673 case 4: pFrame->AddrReturnFrame.off = *uBp.pu32; break; 674 #ifdef VBOX_VMM_TARGET_X86 853 675 case 2: pFrame->AddrReturnFrame.off = *uBp.pu16; break; 854 case 4: pFrame->AddrReturnFrame.off = *uBp.pu32; break; 855 case 8: pFrame->AddrReturnFrame.off = *uBp.pu64; break; 676 #endif 856 677 default: AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_1); 857 678 } 858 679 680 #ifdef VBOX_VMM_TARGET_X86 859 681 /* Watcom tries to keep the frame pointer odd for far returns. */ 860 682 if ( cbStackItem <= 4 … … 872 694 else if (pFrame->enmReturnType == RTDBGRETURNTYPE_NEAR32) 873 695 { 874 # if 1696 # if 1 875 697 /* Assumes returning 32-bit code. */ 876 698 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN; 877 699 pFrame->enmReturnType = RTDBGRETURNTYPE_FAR32; 878 700 cbRetAddr = 8; 879 # else701 # else 880 702 /* Assumes returning 16-bit code. */ 881 703 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN; 882 704 pFrame->enmReturnType = RTDBGRETURNTYPE_FAR16; 883 705 cbRetAddr = 4; 884 # endif706 # endif 885 707 } 886 708 } … … 901 723 uArgs.pb = u.pb + cbStackItem + cbRetAddr; 902 724 } 725 #endif /* VBOX_VMM_TARGET_X86 */ 903 726 904 727 pFrame->AddrReturnFrame.FlatPtr += pFrame->AddrReturnFrame.off - pFrame->AddrFrame.off; … … 911 734 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 912 735 { 736 #ifdef VBOX_VMM_TARGET_ARMV8 737 AssertFailed(); 738 739 #elif defined(VBOX_VMM_TARGET_X86) 913 740 if ( pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_PRIV 914 741 || pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64) … … 924 751 pFrame->AddrReturnStack.FlatPtr += pFrame->AddrReturnStack.off - pFrame->AddrStack.off; 925 752 } 753 #endif /* VBOX_VMM_TARGET_X86 */ 926 754 } 927 755 else … … 937 765 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 938 766 { 767 #ifdef VBOX_VMM_TARGET_ARMV8 768 AssertFailed(); 769 770 #elif defined(VBOX_VMM_TARGET_X86) 939 771 if (RTDbgReturnTypeIsNear(pFrame->enmReturnType)) 940 772 { … … 945 777 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, 946 778 pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_CS], pUnwindCtx->m_State.uPc); 779 #endif 947 780 } 948 781 else 949 782 { 783 #ifdef VBOX_VMM_TARGET_ARMV8 784 switch (pFrame->enmReturnType) 785 { 786 case RTDBGRETURNTYPE_NEAR64: 787 if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC)) 788 { 789 pFrame->AddrReturnPC.FlatPtr += CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64) - pFrame->AddrReturnPC.off; 790 pFrame->AddrReturnPC.off = CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64); 791 } 792 else 793 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, CPUMGetGCPtrPacStripped(pVCpu, *uRet.pu64)); 794 break; 795 default: 796 AssertMsgFailed(("enmReturnType=%d\n", pFrame->enmReturnType)); 797 return VERR_INVALID_PARAMETER; 798 } 799 800 #elif defined(VBOX_VMM_TARGET_X86) 950 801 int rc2; 951 802 switch (pFrame->enmReturnType) … … 1020 871 return VERR_INVALID_PARAMETER; 1021 872 } 873 #endif /* VBOX_VMM_TARGET_X86 */ 1022 874 } 1023 875 … … 1036 888 switch (cbStackItem) 1037 889 { 1038 case 2: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_16BIT; break;1039 890 case 4: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_32BIT; break; 1040 891 case 8: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_64BIT; break; 892 #ifdef VBOX_VMM_TARGET_X86 893 case 2: pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_16BIT; break; 894 #endif 1041 895 default: AssertMsgFailedReturn(("cbStackItem=%d\n", cbStackItem), VERR_DBGF_STACK_IPE_2); 1042 896 } … … 1053 907 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 1054 908 { 909 #if defined(VBOX_VMM_TARGET_X86) 1055 910 rc = dbgfR3StackWalkCollectRegisterChanges(pUnwindCtx->m_pUVM, pFrame, &pUnwindCtx->m_State); 1056 911 if (RT_FAILURE(rc)) … … 1065 920 return rc; 1066 921 } 922 #else 923 AssertFailed(); 924 #endif 1067 925 } 1068 926 … … 1080 938 { 1081 939 dbgfR3UnwindCtxSetPcAndSp(pUnwindCtx, &pFrame->AddrReturnPC, &pFrame->AddrReturnStack); 940 #ifdef VBOX_VMM_TARGET_ARMV8 941 pUnwindCtx->m_State.u.armv8.auGprs[ARMV8_A64_REG_BP] = pFrame->AddrReturnFrame.off; 942 #elif defined(VBOX_VMM_TARGET_X86) 1082 943 pUnwindCtx->m_State.u.x86.auRegs[X86_GREG_xBP] = pFrame->AddrReturnFrame.off; 1083 } 944 #endif 945 } 946 947 #ifdef VBOX_VMM_TARGET_ARMV8 948 if (pUnwindCtx->m_State.enmArch == RTLDRARCH_ARM64) 949 pUnwindCtx->m_State.u.armv8.Loaded.fAll = 0; 950 else 951 AssertFailed(); 952 953 #elif defined(VBOX_VMM_TARGET_X86) 1084 954 /** @todo Reevaluate CS if the previous frame return type isn't near. */ 1085 955 if ( pUnwindCtx->m_State.enmArch == RTLDRARCH_AMD64 … … 1089 959 else 1090 960 AssertFailed(); 961 #endif 962 1091 963 if (dbgfR3UnwindCtxDoOneFrame(pUnwindCtx)) 1092 964 { 965 #ifdef VBOX_VMM_TARGET_ARMV8 966 Assert(!pUnwindCtx->m_fIsHostRing0); 967 #elif defined(VBOX_VMM_TARGET_X86) 1093 968 if (pUnwindCtx->m_fIsHostRing0) 1094 969 DBGFR3AddrFromHostR0(&pFrame->AddrReturnFrame, pUnwindCtx->m_State.u.x86.FrameAddr.off); 1095 970 else 971 #endif 1096 972 { 1097 973 DBGFADDRESS AddrReturnFrame = pFrame->AddrReturnFrame; 974 #ifdef VBOX_VMM_TARGET_ARMV8 975 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &AddrReturnFrame, pUnwindCtx->m_State.u.armv8.FrameAddr); 976 #elif defined(VBOX_VMM_TARGET_X86) 1098 977 rc = DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &AddrReturnFrame, 1099 978 pUnwindCtx->m_State.u.x86.FrameAddr.sel, pUnwindCtx->m_State.u.x86.FrameAddr.off); 1100 979 if (RT_SUCCESS(rc)) 980 #endif 1101 981 pFrame->AddrReturnFrame = AddrReturnFrame; 1102 982 } … … 1108 988 return VINF_SUCCESS; 1109 989 } 1110 #endif1111 990 1112 991 … … 1137 1016 1138 1017 int rc = VINF_SUCCESS; 1139 #if defined(VBOX_VMM_TARGET_ARMV8)1140 1018 if (pAddrPC) 1141 1019 pCur->AddrPC = *pAddrPC; 1020 #ifdef VBOX_VMM_TARGET_ARMV8 1142 1021 else 1143 1022 DBGFR3AddrFromFlat(pUVM, &pCur->AddrPC, pCtx->Pc.u64); 1144 #else 1145 if (pAddrPC) 1146 pCur->AddrPC = *pAddrPC; 1023 #elif defined(VBOX_VMM_TARGET_X86) 1147 1024 else if (enmCodeType != DBGFCODETYPE_GUEST) 1148 1025 DBGFR3AddrFromFlat(pUVM, &pCur->AddrPC, pCtx->rip); … … 1167 1044 PVMCPU const pVCpu = pUVM->pVM->apCpusR3[idCpu]; 1168 1045 CPUMMODE const enmCpuMode = CPUMGetGuestMode(pVCpu); 1169 #if defined(VBOX_VMM_TARGET_ARMV8) 1046 1047 #ifdef VBOX_VMM_TARGET_ARMV8 1170 1048 /** @todo */ 1171 1049 Assert(enmCpuMode == CPUMMODE_ARMV8_AARCH64); RT_NOREF(enmCpuMode); … … 1173 1051 if (enmReturnType == RTDBGRETURNTYPE_INVALID) 1174 1052 pCur->enmReturnType = RTDBGRETURNTYPE_NEAR64; 1175 #else 1053 1054 #elif defined(VBOX_VMM_TARGET_X86) 1176 1055 if (enmCpuMode == CPUMMODE_REAL) 1177 1056 { … … 1196 1075 } 1197 1076 1198 #if !defined(VBOX_VMM_TARGET_ARMV8)1077 #ifdef VBOX_VMM_TARGET_X86 1199 1078 if (enmReturnType == RTDBGRETURNTYPE_INVALID) 1200 1079 switch (pCur->AddrPC.fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) … … 1213 1092 1214 1093 1215 #if defined(VBOX_VMM_TARGET_ARMV8)1216 1094 if (pAddrStack) 1217 1095 pCur->AddrStack = *pAddrStack; 1096 #ifdef VBOX_VMM_TARGET_ARMV8 1218 1097 else 1219 1098 DBGFR3AddrFromFlat(pUVM, &pCur->AddrStack, pCtx->aSpReg[1].u64 & fAddrMask); /** @todo EL0 stack. */ 1220 1221 Assert(!(pCur->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)); 1222 if (pAddrFrame) 1223 pCur->AddrFrame = *pAddrFrame; 1224 else 1225 DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->aGRegs[ARMV8_A64_REG_BP].x & fAddrMask); 1226 #else 1227 if (pAddrStack) 1228 pCur->AddrStack = *pAddrStack; 1099 #elif defined(VBOX_VMM_TARGET_X86) 1229 1100 else if (enmCodeType != DBGFCODETYPE_GUEST) 1230 1101 DBGFR3AddrFromFlat(pUVM, &pCur->AddrStack, pCtx->rsp & fAddrMask); 1231 1102 else 1232 1103 rc = DBGFR3AddrFromSelOff(pUVM, idCpu, &pCur->AddrStack, pCtx->ss.Sel, pCtx->rsp & fAddrMask); 1104 #endif 1233 1105 1234 1106 Assert(!(pCur->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO)); 1235 1107 if (pAddrFrame) 1236 1108 pCur->AddrFrame = *pAddrFrame; 1109 #ifdef VBOX_VMM_TARGET_ARMV8 1110 else 1111 DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->aGRegs[ARMV8_A64_REG_BP].x & fAddrMask); 1112 #elif defined(VBOX_VMM_TARGET_X86) 1237 1113 else if (enmCodeType != DBGFCODETYPE_GUEST) 1238 1114 DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, pCtx->rbp & fAddrMask); … … 1250 1126 pCur->enmReturnType = UnwindCtx.m_State.enmRetType; 1251 1127 pCur->fFlags |= DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO; 1252 #if defined(VBOX_VMM_TARGET_ARMV8)1128 #ifdef VBOX_VMM_TARGET_ARMV8 1253 1129 DBGFR3AddrFromFlat(pUVM, &pCur->AddrFrame, UnwindCtx.m_State.u.armv8.FrameAddr); 1254 #el se1130 #elif defined(VBOX_VMM_TARGET_X86) 1255 1131 if (!UnwindCtx.m_fIsHostRing0) 1256 1132 rc = DBGFR3AddrFromSelOff(UnwindCtx.m_pUVM, UnwindCtx.m_idCpu, &pCur->AddrFrame,
Note:
See TracChangeset
for help on using the changeset viewer.