diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2019-07-26 13:37:47 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2019-07-26 13:37:47 +0000 |
commit | 7f15397a65b22ff5bc102e17a815c0d619e39863 (patch) | |
tree | ad9289319d2538622151ef1a8960558efcaa5b75 /src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp | |
parent | 2c4159a73f3973f2ba72970e8022b9603f82f4db (diff) | |
download | VirtualBox-svn-7f15397a65b22ff5bc102e17a815c0d619e39863.tar.gz |
VMM: Kicking out raw-mode (work in progress). bugref:9517
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@80003 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp')
-rw-r--r-- | src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp | 427 |
1 files changed, 160 insertions, 267 deletions
diff --git a/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp b/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp index 06f0f83431a..d842ac4c816 100644 --- a/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp +++ b/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp @@ -376,297 +376,121 @@ VMMR3DECL(void) VMMR3FatalDump(PVM pVM, PVMCPU pVCpu, int rcErr) /* * Dump the relevant hypervisor registers and stack. */ - if (!VM_IS_RAW_MODE_ENABLED(pVM)) + if ( rcErr == VERR_VMM_RING0_ASSERTION /* fInRing3Call has already been cleared here. */ + || pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call) { - if ( rcErr == VERR_VMM_RING0_ASSERTION /* fInRing3Call has already been cleared here. */ - || pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call) - { - /* Dump the jmpbuf. */ - pHlp->pfnPrintf(pHlp, - "!!\n" - "!! CallRing3JmpBuf:\n" - "!!\n"); - pHlp->pfnPrintf(pHlp, - "SavedEsp=%RHv SavedEbp=%RHv SpResume=%RHv SpCheck=%RHv\n", - pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp, - pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp, - pVCpu->vmm.s.CallRing3JmpBufR0.SpResume, - pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck); - pHlp->pfnPrintf(pHlp, - "pvSavedStack=%RHv cbSavedStack=%#x fInRing3Call=%RTbool\n", - pVCpu->vmm.s.CallRing3JmpBufR0.pvSavedStack, - pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack, - pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call); - pHlp->pfnPrintf(pHlp, - "cbUsedMax=%#x cbUsedAvg=%#x cbUsedTotal=%#llx cUsedTotal=%#llx\n", - pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedMax, - pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedAvg, - pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedTotal, - pVCpu->vmm.s.CallRing3JmpBufR0.cUsedTotal); - - /* Dump the resume register frame on the stack. */ - PRTHCUINTPTR pBP; + /* Dump the jmpbuf. */ + pHlp->pfnPrintf(pHlp, + "!!\n" + "!! CallRing3JmpBuf:\n" + "!!\n"); + pHlp->pfnPrintf(pHlp, + "SavedEsp=%RHv SavedEbp=%RHv SpResume=%RHv SpCheck=%RHv\n", + pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp, + pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp, + pVCpu->vmm.s.CallRing3JmpBufR0.SpResume, + pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck); + pHlp->pfnPrintf(pHlp, + "pvSavedStack=%RHv cbSavedStack=%#x fInRing3Call=%RTbool\n", + pVCpu->vmm.s.CallRing3JmpBufR0.pvSavedStack, + pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack, + pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call); + pHlp->pfnPrintf(pHlp, + "cbUsedMax=%#x cbUsedAvg=%#x cbUsedTotal=%#llx cUsedTotal=%#llx\n", + pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedMax, + pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedAvg, + pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedTotal, + pVCpu->vmm.s.CallRing3JmpBufR0.cUsedTotal); + + /* Dump the resume register frame on the stack. */ + PRTHCUINTPTR pBP; #ifdef VMM_R0_SWITCH_STACK - pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.pbEMTStackR3[ pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3)]; + pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.pbEMTStackR3[ pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp + - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3)]; #else - pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.pbEMTStackR3[ pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack - - pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck - + pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp]; + pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.pbEMTStackR3[ pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack + - pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck + + pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp]; #endif #if HC_ARCH_BITS == 32 - pHlp->pfnPrintf(pHlp, - "eax=volatile ebx=%08x ecx=volatile edx=volatile esi=%08x edi=%08x\n" - "eip=%08x esp=%08x ebp=%08x efl=%08x\n" - , - pBP[-3], pBP[-2], pBP[-1], - pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 8, pBP[0], pBP[-4]); + pHlp->pfnPrintf(pHlp, + "eax=volatile ebx=%08x ecx=volatile edx=volatile esi=%08x edi=%08x\n" + "eip=%08x esp=%08x ebp=%08x efl=%08x\n" + , + pBP[-3], pBP[-2], pBP[-1], + pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 8, pBP[0], pBP[-4]); #else # ifdef RT_OS_WINDOWS - pHlp->pfnPrintf(pHlp, - "rax=volatile rbx=%016RX64 rcx=volatile rdx=volatile\n" - "rsi=%016RX64 rdi=%016RX64 r8=volatile r9=volatile \n" - "r10=volatile r11=volatile r12=%016RX64 r13=%016RX64\n" - "r14=%016RX64 r15=%016RX64\n" - "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 rfl=%08RX64\n" - , - pBP[-7], - pBP[-6], pBP[-5], - pBP[-4], pBP[-3], - pBP[-2], pBP[-1], - pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 16, pBP[0], pBP[-8]); + pHlp->pfnPrintf(pHlp, + "rax=volatile rbx=%016RX64 rcx=volatile rdx=volatile\n" + "rsi=%016RX64 rdi=%016RX64 r8=volatile r9=volatile \n" + "r10=volatile r11=volatile r12=%016RX64 r13=%016RX64\n" + "r14=%016RX64 r15=%016RX64\n" + "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 rfl=%08RX64\n" + , + pBP[-7], + pBP[-6], pBP[-5], + pBP[-4], pBP[-3], + pBP[-2], pBP[-1], + pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 16, pBP[0], pBP[-8]); # else - pHlp->pfnPrintf(pHlp, - "rax=volatile rbx=%016RX64 rcx=volatile rdx=volatile\n" - "rsi=volatile rdi=volatile r8=volatile r9=volatile \n" - "r10=volatile r11=volatile r12=%016RX64 r13=%016RX64\n" - "r14=%016RX64 r15=%016RX64\n" - "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 rflags=%08RX64\n" - , - pBP[-5], - pBP[-4], pBP[-3], - pBP[-2], pBP[-1], - pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 16, pBP[0], pBP[-6]); + pHlp->pfnPrintf(pHlp, + "rax=volatile rbx=%016RX64 rcx=volatile rdx=volatile\n" + "rsi=volatile rdi=volatile r8=volatile r9=volatile \n" + "r10=volatile r11=volatile r12=%016RX64 r13=%016RX64\n" + "r14=%016RX64 r15=%016RX64\n" + "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 rflags=%08RX64\n" + , + pBP[-5], + pBP[-4], pBP[-3], + pBP[-2], pBP[-1], + pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 16, pBP[0], pBP[-6]); # endif #endif - /* Callstack. */ - DBGFADDRESS AddrPc, AddrBp, AddrSp; - PCDBGFSTACKFRAME pFirstFrame; - rc2 = DBGFR3StackWalkBeginEx(pVM->pUVM, pVCpu->idCpu, DBGFCODETYPE_RING0, - DBGFR3AddrFromHostR0(&AddrBp, pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp), - DBGFR3AddrFromHostR0(&AddrSp, pVCpu->vmm.s.CallRing3JmpBufR0.SpResume), - DBGFR3AddrFromHostR0(&AddrPc, pVCpu->vmm.s.CallRing3JmpBufR0.SavedEipForUnwind), - RTDBGRETURNTYPE_INVALID, &pFirstFrame); - if (RT_SUCCESS(rc2)) - { - pHlp->pfnPrintf(pHlp, - "!!\n" - "!! Call Stack:\n" - "!!\n"); -#if HC_ARCH_BITS == 32 - pHlp->pfnPrintf(pHlp, "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n"); -#else - pHlp->pfnPrintf(pHlp, "RBP Ret RBP Ret RIP RIP Symbol [line]\n"); -#endif - for (PCDBGFSTACKFRAME pFrame = pFirstFrame; - pFrame; - pFrame = DBGFR3StackWalkNext(pFrame)) - { -#if HC_ARCH_BITS == 32 - pHlp->pfnPrintf(pHlp, - "%RHv %RHv %04RX32:%RHv %RHv %RHv %RHv %RHv", - (RTHCUINTPTR)pFrame->AddrFrame.off, - (RTHCUINTPTR)pFrame->AddrReturnFrame.off, - (RTHCUINTPTR)pFrame->AddrReturnPC.Sel, - (RTHCUINTPTR)pFrame->AddrReturnPC.off, - pFrame->Args.au32[0], - pFrame->Args.au32[1], - pFrame->Args.au32[2], - pFrame->Args.au32[3]); - pHlp->pfnPrintf(pHlp, " %RTsel:%08RHv", pFrame->AddrPC.Sel, pFrame->AddrPC.off); -#else - pHlp->pfnPrintf(pHlp, - "%RHv %RHv %RHv %RHv", - (RTHCUINTPTR)pFrame->AddrFrame.off, - (RTHCUINTPTR)pFrame->AddrReturnFrame.off, - (RTHCUINTPTR)pFrame->AddrReturnPC.off, - (RTHCUINTPTR)pFrame->AddrPC.off); -#endif - if (pFrame->pSymPC) - { - RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value; - if (offDisp > 0) - pHlp->pfnPrintf(pHlp, " %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp); - else if (offDisp < 0) - pHlp->pfnPrintf(pHlp, " %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp); - else - pHlp->pfnPrintf(pHlp, " %s", pFrame->pSymPC->szName); - } - if (pFrame->pLinePC) - pHlp->pfnPrintf(pHlp, " [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo); - pHlp->pfnPrintf(pHlp, "\n"); - for (uint32_t iReg = 0; iReg < pFrame->cSureRegs; iReg++) - { - const char *pszName = pFrame->paSureRegs[iReg].pszName; - if (!pszName) - pszName = DBGFR3RegCpuName(pVM->pUVM, pFrame->paSureRegs[iReg].enmReg, - pFrame->paSureRegs[iReg].enmType); - char szValue[1024]; - szValue[0] = '\0'; - DBGFR3RegFormatValue(szValue, sizeof(szValue), &pFrame->paSureRegs[iReg].Value, - pFrame->paSureRegs[iReg].enmType, false); - pHlp->pfnPrintf(pHlp, " %-3s=%s\n", pszName, szValue); - } - } - DBGFR3StackWalkEnd(pFirstFrame); - } - - /* Symbols on the stack. */ -#ifdef VMM_R0_SWITCH_STACK - uint32_t const iLast = VMM_STACK_SIZE / sizeof(uintptr_t); - uint32_t iAddr = (uint32_t)( pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp - - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3)) / sizeof(uintptr_t); - if (iAddr > iLast) - iAddr = 0; -#else - uint32_t const iLast = RT_MIN(pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack, VMM_STACK_SIZE) - / sizeof(uintptr_t); - uint32_t iAddr = 0; -#endif - pHlp->pfnPrintf(pHlp, - "!!\n" - "!! Addresses on the stack (iAddr=%#x, iLast=%#x)\n" - "!!\n", - iAddr, iLast); - uintptr_t const *paAddr = (uintptr_t const *)pVCpu->vmm.s.pbEMTStackR3; - while (iAddr < iLast) - { - uintptr_t const uAddr = paAddr[iAddr]; - if (uAddr > X86_PAGE_SIZE) - { - DBGFADDRESS Addr; - DBGFR3AddrFromFlat(pVM->pUVM, &Addr, uAddr); - RTGCINTPTR offDisp = 0; - PRTDBGSYMBOL pSym = DBGFR3AsSymbolByAddrA(pVM->pUVM, DBGF_AS_R0, &Addr, - RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL | RTDBGSYMADDR_FLAGS_SKIP_ABS_IN_DEFERRED, - &offDisp, NULL); - RTGCINTPTR offLineDisp; - PRTDBGLINE pLine = DBGFR3AsLineByAddrA(pVM->pUVM, DBGF_AS_R0, &Addr, &offLineDisp, NULL); - if (pLine || pSym) - { - pHlp->pfnPrintf(pHlp, "%#06x: %p =>", iAddr * sizeof(uintptr_t), uAddr); - if (pSym) - pHlp->pfnPrintf(pHlp, " %s + %#x", pSym->szName, (intptr_t)offDisp); - if (pLine) - pHlp->pfnPrintf(pHlp, " [%s:%u + %#x]\n", pLine->szFilename, pLine->uLineNo, offLineDisp); - else - pHlp->pfnPrintf(pHlp, "\n"); - RTDbgSymbolFree(pSym); - RTDbgLineFree(pLine); - } - } - iAddr++; - } - - /* raw stack */ - Hlp.fRecSummary = false; - pHlp->pfnPrintf(pHlp, - "!!\n" - "!! Raw stack (mind the direction).\n" - "!! pbEMTStackR0=%RHv pbEMTStackBottomR0=%RHv VMM_STACK_SIZE=%#x\n" - "!! pbEmtStackR3=%p\n" - "!!\n" - "%.*Rhxd\n", - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3), - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3) + VMM_STACK_SIZE, - VMM_STACK_SIZE, - pVCpu->vmm.s.pbEMTStackR3, - VMM_STACK_SIZE, pVCpu->vmm.s.pbEMTStackR3); - } - else - { - pHlp->pfnPrintf(pHlp, - "!! Skipping ring-0 registers and stack, rcErr=%Rrc\n", rcErr); - } - } - else - { - /* - * Try figure out where eip is. - */ - /* core code? */ - if (uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC < pVM->vmm.s.cbCoreCode) - pHlp->pfnPrintf(pHlp, - "!! EIP is in CoreCode, offset %#x\n", - uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC); - else - { /* ask PDM */ /** @todo ask DBGFR3Sym later? */ - char szModName[64]; - RTRCPTR RCPtrMod; - char szNearSym1[260]; - RTRCPTR RCPtrNearSym1; - char szNearSym2[260]; - RTRCPTR RCPtrNearSym2; - int rc = PDMR3LdrQueryRCModFromPC(pVM, uEIP, - &szModName[0], sizeof(szModName), &RCPtrMod, - &szNearSym1[0], sizeof(szNearSym1), &RCPtrNearSym1, - &szNearSym2[0], sizeof(szNearSym2), &RCPtrNearSym2); - if (RT_SUCCESS(rc)) - pHlp->pfnPrintf(pHlp, - "!! EIP in %s (%RRv) at rva %x near symbols:\n" - "!! %RRv rva %RRv off %08x %s\n" - "!! %RRv rva %RRv off -%08x %s\n", - szModName, RCPtrMod, (unsigned)(uEIP - RCPtrMod), - RCPtrNearSym1, RCPtrNearSym1 - RCPtrMod, (unsigned)(uEIP - RCPtrNearSym1), szNearSym1, - RCPtrNearSym2, RCPtrNearSym2 - RCPtrMod, (unsigned)(RCPtrNearSym2 - uEIP), szNearSym2); - else - pHlp->pfnPrintf(pHlp, - "!! EIP is not in any code known to VMM!\n"); - } - - /* Disassemble the instruction. */ - char szInstr[256]; - rc2 = DBGFR3DisasInstrEx(pVM->pUVM, pVCpu->idCpu, 0, 0, - DBGF_DISAS_FLAGS_CURRENT_HYPER | DBGF_DISAS_FLAGS_DEFAULT_MODE, - &szInstr[0], sizeof(szInstr), NULL); - if (RT_SUCCESS(rc2)) - pHlp->pfnPrintf(pHlp, - "!! %s\n", szInstr); - - /* Dump the hypervisor cpu state. */ - pHlp->pfnPrintf(pHlp, - "!!\n" - "!!\n" - "!!\n"); - rc2 = DBGFR3Info(pVM->pUVM, "cpumhyper", "verbose", pHlp); - fDoneHyper = true; - /* Callstack. */ + DBGFADDRESS AddrPc, AddrBp, AddrSp; PCDBGFSTACKFRAME pFirstFrame; - rc2 = DBGFR3StackWalkBegin(pVM->pUVM, pVCpu->idCpu, DBGFCODETYPE_HYPER, &pFirstFrame); + rc2 = DBGFR3StackWalkBeginEx(pVM->pUVM, pVCpu->idCpu, DBGFCODETYPE_RING0, + DBGFR3AddrFromHostR0(&AddrBp, pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp), + DBGFR3AddrFromHostR0(&AddrSp, pVCpu->vmm.s.CallRing3JmpBufR0.SpResume), + DBGFR3AddrFromHostR0(&AddrPc, pVCpu->vmm.s.CallRing3JmpBufR0.SavedEipForUnwind), + RTDBGRETURNTYPE_INVALID, &pFirstFrame); if (RT_SUCCESS(rc2)) { pHlp->pfnPrintf(pHlp, "!!\n" "!! Call Stack:\n" - "!!\n" - "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n"); + "!!\n"); +#if HC_ARCH_BITS == 32 + pHlp->pfnPrintf(pHlp, "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n"); +#else + pHlp->pfnPrintf(pHlp, "RBP Ret RBP Ret RIP RIP Symbol [line]\n"); +#endif for (PCDBGFSTACKFRAME pFrame = pFirstFrame; pFrame; pFrame = DBGFR3StackWalkNext(pFrame)) { +#if HC_ARCH_BITS == 32 pHlp->pfnPrintf(pHlp, - "%08RX32 %08RX32 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32", - (uint32_t)pFrame->AddrFrame.off, - (uint32_t)pFrame->AddrReturnFrame.off, - (uint32_t)pFrame->AddrReturnPC.Sel, - (uint32_t)pFrame->AddrReturnPC.off, + "%RHv %RHv %04RX32:%RHv %RHv %RHv %RHv %RHv", + (RTHCUINTPTR)pFrame->AddrFrame.off, + (RTHCUINTPTR)pFrame->AddrReturnFrame.off, + (RTHCUINTPTR)pFrame->AddrReturnPC.Sel, + (RTHCUINTPTR)pFrame->AddrReturnPC.off, pFrame->Args.au32[0], pFrame->Args.au32[1], pFrame->Args.au32[2], pFrame->Args.au32[3]); - pHlp->pfnPrintf(pHlp, " %RTsel:%08RGv", pFrame->AddrPC.Sel, pFrame->AddrPC.off); + pHlp->pfnPrintf(pHlp, " %RTsel:%08RHv", pFrame->AddrPC.Sel, pFrame->AddrPC.off); +#else + pHlp->pfnPrintf(pHlp, + "%RHv %RHv %RHv %RHv", + (RTHCUINTPTR)pFrame->AddrFrame.off, + (RTHCUINTPTR)pFrame->AddrReturnFrame.off, + (RTHCUINTPTR)pFrame->AddrReturnPC.off, + (RTHCUINTPTR)pFrame->AddrPC.off); +#endif if (pFrame->pSymPC) { RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value; @@ -680,20 +504,89 @@ VMMR3DECL(void) VMMR3FatalDump(PVM pVM, PVMCPU pVCpu, int rcErr) if (pFrame->pLinePC) pHlp->pfnPrintf(pHlp, " [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo); pHlp->pfnPrintf(pHlp, "\n"); + for (uint32_t iReg = 0; iReg < pFrame->cSureRegs; iReg++) + { + const char *pszName = pFrame->paSureRegs[iReg].pszName; + if (!pszName) + pszName = DBGFR3RegCpuName(pVM->pUVM, pFrame->paSureRegs[iReg].enmReg, + pFrame->paSureRegs[iReg].enmType); + char szValue[1024]; + szValue[0] = '\0'; + DBGFR3RegFormatValue(szValue, sizeof(szValue), &pFrame->paSureRegs[iReg].Value, + pFrame->paSureRegs[iReg].enmType, false); + pHlp->pfnPrintf(pHlp, " %-3s=%s\n", pszName, szValue); + } } DBGFR3StackWalkEnd(pFirstFrame); } + /* Symbols on the stack. */ +#ifdef VMM_R0_SWITCH_STACK + uint32_t const iLast = VMM_STACK_SIZE / sizeof(uintptr_t); + uint32_t iAddr = (uint32_t)( pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp + - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3)) / sizeof(uintptr_t); + if (iAddr > iLast) + iAddr = 0; +#else + uint32_t const iLast = RT_MIN(pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack, VMM_STACK_SIZE) + / sizeof(uintptr_t); + uint32_t iAddr = 0; +#endif + pHlp->pfnPrintf(pHlp, + "!!\n" + "!! Addresses on the stack (iAddr=%#x, iLast=%#x)\n" + "!!\n", + iAddr, iLast); + uintptr_t const *paAddr = (uintptr_t const *)pVCpu->vmm.s.pbEMTStackR3; + while (iAddr < iLast) + { + uintptr_t const uAddr = paAddr[iAddr]; + if (uAddr > X86_PAGE_SIZE) + { + DBGFADDRESS Addr; + DBGFR3AddrFromFlat(pVM->pUVM, &Addr, uAddr); + RTGCINTPTR offDisp = 0; + PRTDBGSYMBOL pSym = DBGFR3AsSymbolByAddrA(pVM->pUVM, DBGF_AS_R0, &Addr, + RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL | RTDBGSYMADDR_FLAGS_SKIP_ABS_IN_DEFERRED, + &offDisp, NULL); + RTGCINTPTR offLineDisp; + PRTDBGLINE pLine = DBGFR3AsLineByAddrA(pVM->pUVM, DBGF_AS_R0, &Addr, &offLineDisp, NULL); + if (pLine || pSym) + { + pHlp->pfnPrintf(pHlp, "%#06x: %p =>", iAddr * sizeof(uintptr_t), uAddr); + if (pSym) + pHlp->pfnPrintf(pHlp, " %s + %#x", pSym->szName, (intptr_t)offDisp); + if (pLine) + pHlp->pfnPrintf(pHlp, " [%s:%u + %#x]\n", pLine->szFilename, pLine->uLineNo, offLineDisp); + else + pHlp->pfnPrintf(pHlp, "\n"); + RTDbgSymbolFree(pSym); + RTDbgLineFree(pLine); + } + } + iAddr++; + } + /* raw stack */ Hlp.fRecSummary = false; pHlp->pfnPrintf(pHlp, "!!\n" - "!! Raw stack (mind the direction). pbEMTStackRC=%RRv pbEMTStackBottomRC=%RRv\n" + "!! Raw stack (mind the direction).\n" + "!! pbEMTStackR0=%RHv pbEMTStackBottomR0=%RHv VMM_STACK_SIZE=%#x\n" + "!! pbEmtStackR3=%p\n" "!!\n" "%.*Rhxd\n", - pVCpu->vmm.s.pbEMTStackRC, pVCpu->vmm.s.pbEMTStackBottomRC, + MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3), + MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3) + VMM_STACK_SIZE, + VMM_STACK_SIZE, + pVCpu->vmm.s.pbEMTStackR3, VMM_STACK_SIZE, pVCpu->vmm.s.pbEMTStackR3); - } /* !HMIsEnabled */ + } + else + { + pHlp->pfnPrintf(pHlp, + "!! Skipping ring-0 registers and stack, rcErr=%Rrc\n", rcErr); + } break; } |