Changeset 73460 in vbox for trunk/src/VBox
- Timestamp:
- Aug 2, 2018 9:06:59 PM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
r73449 r73460 2853 2853 * Display verbose frame info. 2854 2854 */ 2855 const char *pszRetType ;2855 const char *pszRetType = "invalid"; 2856 2856 switch (pFrame->enmReturnType) 2857 2857 { 2858 case DBGFRETURNTYPE_NEAR16: pszRetType = "retn/16"; break; 2859 case DBGFRETURNTYPE_NEAR32: pszRetType = "retn/32"; break; 2860 case DBGFRETURNTYPE_NEAR64: pszRetType = "retn/64"; break; 2861 case DBGFRETURNTYPE_FAR16: pszRetType = "retf/16"; break; 2862 case DBGFRETURNTYPE_FAR32: pszRetType = "retf/32"; break; 2863 case DBGFRETURNTYPE_FAR64: pszRetType = "retf/64"; break; 2864 case DBGFRETURNTYPE_IRET16: pszRetType = "iret-16"; break; 2865 case DBGFRETURNTYPE_IRET32: pszRetType = "iret/32s"; break; 2866 case DBGFRETURNTYPE_IRET32_PRIV: pszRetType = "iret/32p"; break; 2867 case DBGFRETURNTYPE_IRET32_V86: pszRetType = "iret/v86"; break; 2868 case DBGFRETURNTYPE_IRET64: pszRetType = "iret/64"; break; 2869 default: pszRetType = "invalid"; break; 2858 case RTDBGRETURNTYPE_NEAR16: pszRetType = "retn/16"; break; 2859 case RTDBGRETURNTYPE_NEAR32: pszRetType = "retn/32"; break; 2860 case RTDBGRETURNTYPE_NEAR64: pszRetType = "retn/64"; break; 2861 case RTDBGRETURNTYPE_FAR16: pszRetType = "retf/16"; break; 2862 case RTDBGRETURNTYPE_FAR32: pszRetType = "retf/32"; break; 2863 case RTDBGRETURNTYPE_FAR64: pszRetType = "retf/64"; break; 2864 case RTDBGRETURNTYPE_IRET16: pszRetType = "iret-16"; break; 2865 case RTDBGRETURNTYPE_IRET32: pszRetType = "iret/32s"; break; 2866 case RTDBGRETURNTYPE_IRET32_PRIV: pszRetType = "iret/32p"; break; 2867 case RTDBGRETURNTYPE_IRET32_V86: pszRetType = "iret/v86"; break; 2868 case RTDBGRETURNTYPE_IRET64: pszRetType = "iret/64"; break; 2869 2870 case RTDBGRETURNTYPE_END: 2871 case RTDBGRETURNTYPE_INVALID: 2872 case RTDBGRETURNTYPE_32BIT_HACK: 2873 break; 2870 2874 } 2871 2875 size_t cchLine = DBGCCmdHlpPrintfLen(pCmdHlp, " %s", pszRetType); … … 2878 2882 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_MAX_DEPTH) 2879 2883 cchLine += DBGCCmdHlpPrintfLen(pCmdHlp, " max-depth"); 2884 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_TRAP_FRAME) 2885 cchLine += DBGCCmdHlpPrintfLen(pCmdHlp, " trap-frame"); 2880 2886 2881 2887 if (pFrame->cSureRegs > 0) -
trunk/src/VBox/Debugger/DBGPlugInDarwin.cpp
r69500 r73460 129 129 *********************************************************************************************************************************/ 130 130 static DECLCALLBACK(int) dbgDiggerDarwinInit(PUVM pUVM, void *pvData); 131 131 132 132 133 … … 304 305 305 306 /** 307 * @copydoc DBGFOSREG::pfnStackUnwindAssist 308 */ 309 static DECLCALLBACK(int) dbgDiggerDarwinStackUnwindAssist(PUVM pUVM, void *pvData, VMCPUID idCpu, PDBGFSTACKFRAME pFrame, 310 PRTDBGUNWINDSTATE pState, PCCPUMCTX pInitialCtx, RTDBGAS hAs, 311 uint64_t *puScratch) 312 { 313 RT_NOREF(pUVM, pvData, idCpu, pFrame, pState, pInitialCtx, hAs, puScratch); 314 return VINF_SUCCESS; 315 } 316 317 318 /** 306 319 * @copydoc DBGFOSREG::pfnQueryInterface 307 320 */ … … 972 985 const DBGFOSREG g_DBGDiggerDarwin = 973 986 { 974 /* .u32Magic = */ DBGFOSREG_MAGIC, 975 /* .fFlags = */ 0, 976 /* .cbData = */ sizeof(DBGDIGGERDARWIN), 977 /* .szName = */ "Darwin", 978 /* .pfnConstruct = */ dbgDiggerDarwinConstruct, 979 /* .pfnDestruct = */ dbgDiggerDarwinDestruct, 980 /* .pfnProbe = */ dbgDiggerDarwinProbe, 981 /* .pfnInit = */ dbgDiggerDarwinInit, 982 /* .pfnRefresh = */ dbgDiggerDarwinRefresh, 983 /* .pfnTerm = */ dbgDiggerDarwinTerm, 984 /* .pfnQueryVersion = */ dbgDiggerDarwinQueryVersion, 985 /* .pfnQueryInterface = */ dbgDiggerDarwinQueryInterface, 986 /* .u32EndMagic = */ DBGFOSREG_MAGIC 987 /* .u32Magic = */ DBGFOSREG_MAGIC, 988 /* .fFlags = */ 0, 989 /* .cbData = */ sizeof(DBGDIGGERDARWIN), 990 /* .szName = */ "Darwin", 991 /* .pfnConstruct = */ dbgDiggerDarwinConstruct, 992 /* .pfnDestruct = */ dbgDiggerDarwinDestruct, 993 /* .pfnProbe = */ dbgDiggerDarwinProbe, 994 /* .pfnInit = */ dbgDiggerDarwinInit, 995 /* .pfnRefresh = */ dbgDiggerDarwinRefresh, 996 /* .pfnTerm = */ dbgDiggerDarwinTerm, 997 /* .pfnQueryVersion = */ dbgDiggerDarwinQueryVersion, 998 /* .pfnQueryInterface = */ dbgDiggerDarwinQueryInterface, 999 /* .pfnStackUnwindAssist = */ dbgDiggerDarwinStackUnwindAssist, 1000 /* .u32EndMagic = */ DBGFOSREG_MAGIC 987 1001 }; 988 1002 -
trunk/src/VBox/Debugger/DBGPlugInFreeBsd.cpp
r69500 r73460 585 585 586 586 /** 587 * @copydoc DBGFOSREG::pfnStackUnwindAssist 588 */ 589 static DECLCALLBACK(int) dbgDiggerFreeBsdStackUnwindAssist(PUVM pUVM, void *pvData, VMCPUID idCpu, PDBGFSTACKFRAME pFrame, 590 PRTDBGUNWINDSTATE pState, PCCPUMCTX pInitialCtx, RTDBGAS hAs, 591 uint64_t *puScratch) 592 { 593 RT_NOREF(pUVM, pvData, idCpu, pFrame, pState, pInitialCtx, hAs, puScratch); 594 return VINF_SUCCESS; 595 } 596 597 598 /** 587 599 * @copydoc DBGFOSREG::pfnQueryInterface 588 600 */ … … 799 811 const DBGFOSREG g_DBGDiggerFreeBsd = 800 812 { 801 /* .u32Magic = */ DBGFOSREG_MAGIC, 802 /* .fFlags = */ 0, 803 /* .cbData = */ sizeof(DBGDIGGERFBSD), 804 /* .szName = */ "FreeBSD", 805 /* .pfnConstruct = */ dbgDiggerFreeBsdConstruct, 806 /* .pfnDestruct = */ dbgDiggerFreeBsdDestruct, 807 /* .pfnProbe = */ dbgDiggerFreeBsdProbe, 808 /* .pfnInit = */ dbgDiggerFreeBsdInit, 809 /* .pfnRefresh = */ dbgDiggerFreeBsdRefresh, 810 /* .pfnTerm = */ dbgDiggerFreeBsdTerm, 811 /* .pfnQueryVersion = */ dbgDiggerFreeBsdQueryVersion, 812 /* .pfnQueryInterface = */ dbgDiggerFreeBsdQueryInterface, 813 /* .u32EndMagic = */ DBGFOSREG_MAGIC 813 /* .u32Magic = */ DBGFOSREG_MAGIC, 814 /* .fFlags = */ 0, 815 /* .cbData = */ sizeof(DBGDIGGERFBSD), 816 /* .szName = */ "FreeBSD", 817 /* .pfnConstruct = */ dbgDiggerFreeBsdConstruct, 818 /* .pfnDestruct = */ dbgDiggerFreeBsdDestruct, 819 /* .pfnProbe = */ dbgDiggerFreeBsdProbe, 820 /* .pfnInit = */ dbgDiggerFreeBsdInit, 821 /* .pfnRefresh = */ dbgDiggerFreeBsdRefresh, 822 /* .pfnTerm = */ dbgDiggerFreeBsdTerm, 823 /* .pfnQueryVersion = */ dbgDiggerFreeBsdQueryVersion, 824 /* .pfnQueryInterface = */ dbgDiggerFreeBsdQueryInterface, 825 /* .pfnStackUnwindAssist = */ dbgDiggerFreeBsdStackUnwindAssist, 826 /* .u32EndMagic = */ DBGFOSREG_MAGIC 814 827 }; 815 828 -
trunk/src/VBox/Debugger/DBGPlugInLinux.cpp
r73097 r73460 1082 1082 { 1083 1083 RTStrSpaceDestroy(&pThis->hCfgDb, dbgDiggerLinuxCfgDbDestroyWorker, NULL); 1084 } 1085 1086 1087 /** 1088 * @copydoc DBGFOSREG::pfnStackUnwindAssist 1089 */ 1090 static DECLCALLBACK(int) dbgDiggerLinuxStackUnwindAssist(PUVM pUVM, void *pvData, VMCPUID idCpu, PDBGFSTACKFRAME pFrame, 1091 PRTDBGUNWINDSTATE pState, PCCPUMCTX pInitialCtx, RTDBGAS hAs, 1092 uint64_t *puScratch) 1093 { 1094 RT_NOREF(pUVM, pvData, idCpu, pFrame, pState, pInitialCtx, hAs, puScratch); 1095 return VINF_SUCCESS; 1084 1096 } 1085 1097 … … 2598 2610 const DBGFOSREG g_DBGDiggerLinux = 2599 2611 { 2600 /* .u32Magic = */ DBGFOSREG_MAGIC, 2601 /* .fFlags = */ 0, 2602 /* .cbData = */ sizeof(DBGDIGGERLINUX), 2603 /* .szName = */ "Linux", 2604 /* .pfnConstruct = */ dbgDiggerLinuxConstruct, 2605 /* .pfnDestruct = */ dbgDiggerLinuxDestruct, 2606 /* .pfnProbe = */ dbgDiggerLinuxProbe, 2607 /* .pfnInit = */ dbgDiggerLinuxInit, 2608 /* .pfnRefresh = */ dbgDiggerLinuxRefresh, 2609 /* .pfnTerm = */ dbgDiggerLinuxTerm, 2610 /* .pfnQueryVersion = */ dbgDiggerLinuxQueryVersion, 2611 /* .pfnQueryInterface = */ dbgDiggerLinuxQueryInterface, 2612 /* .u32EndMagic = */ DBGFOSREG_MAGIC 2612 /* .u32Magic = */ DBGFOSREG_MAGIC, 2613 /* .fFlags = */ 0, 2614 /* .cbData = */ sizeof(DBGDIGGERLINUX), 2615 /* .szName = */ "Linux", 2616 /* .pfnConstruct = */ dbgDiggerLinuxConstruct, 2617 /* .pfnDestruct = */ dbgDiggerLinuxDestruct, 2618 /* .pfnProbe = */ dbgDiggerLinuxProbe, 2619 /* .pfnInit = */ dbgDiggerLinuxInit, 2620 /* .pfnRefresh = */ dbgDiggerLinuxRefresh, 2621 /* .pfnTerm = */ dbgDiggerLinuxTerm, 2622 /* .pfnQueryVersion = */ dbgDiggerLinuxQueryVersion, 2623 /* .pfnQueryInterface = */ dbgDiggerLinuxQueryInterface, 2624 /* .pfnStackUnwindAssist = */ dbgDiggerLinuxStackUnwindAssist, 2625 /* .u32EndMagic = */ DBGFOSREG_MAGIC 2613 2626 }; 2614 2627 -
trunk/src/VBox/Debugger/DBGPlugInOS2.cpp
r69500 r73460 116 116 117 117 /** 118 * @copydoc DBGFOSREG::pfnStackUnwindAssist 119 */ 120 static DECLCALLBACK(int) dbgDiggerOS2StackUnwindAssist(PUVM pUVM, void *pvData, VMCPUID idCpu, PDBGFSTACKFRAME pFrame, 121 PRTDBGUNWINDSTATE pState, PCCPUMCTX pInitialCtx, RTDBGAS hAs, 122 uint64_t *puScratch) 123 { 124 RT_NOREF(pUVM, pvData, idCpu, pFrame, pState, pInitialCtx, hAs, puScratch); 125 return VINF_SUCCESS; 126 } 127 128 129 /** 118 130 * @copydoc DBGFOSREG::pfnQueryInterface 119 131 */ … … 343 355 const DBGFOSREG g_DBGDiggerOS2 = 344 356 { 345 /* .u32Magic = */ DBGFOSREG_MAGIC, 346 /* .fFlags = */ 0, 347 /* .cbData = */ sizeof(DBGDIGGEROS2), 348 /* .szName = */ "OS/2", 349 /* .pfnConstruct = */ dbgDiggerOS2Construct, 350 /* .pfnDestruct = */ dbgDiggerOS2Destruct, 351 /* .pfnProbe = */ dbgDiggerOS2Probe, 352 /* .pfnInit = */ dbgDiggerOS2Init, 353 /* .pfnRefresh = */ dbgDiggerOS2Refresh, 354 /* .pfnTerm = */ dbgDiggerOS2Term, 355 /* .pfnQueryVersion = */ dbgDiggerOS2QueryVersion, 356 /* .pfnQueryInterface = */ dbgDiggerOS2QueryInterface, 357 /* .u32EndMagic = */ DBGFOSREG_MAGIC 357 /* .u32Magic = */ DBGFOSREG_MAGIC, 358 /* .fFlags = */ 0, 359 /* .cbData = */ sizeof(DBGDIGGEROS2), 360 /* .szName = */ "OS/2", 361 /* .pfnConstruct = */ dbgDiggerOS2Construct, 362 /* .pfnDestruct = */ dbgDiggerOS2Destruct, 363 /* .pfnProbe = */ dbgDiggerOS2Probe, 364 /* .pfnInit = */ dbgDiggerOS2Init, 365 /* .pfnRefresh = */ dbgDiggerOS2Refresh, 366 /* .pfnTerm = */ dbgDiggerOS2Term, 367 /* .pfnQueryVersion = */ dbgDiggerOS2QueryVersion, 368 /* .pfnQueryInterface = */ dbgDiggerOS2QueryInterface, 369 /* .pfnStackUnwindAssist = */ dbgDiggerOS2StackUnwindAssist, 370 /* .u32EndMagic = */ DBGFOSREG_MAGIC 358 371 }; -
trunk/src/VBox/Debugger/DBGPlugInSolaris.cpp
r69500 r73460 352 352 static DECLCALLBACK(int) dbgDiggerSolarisInit(PUVM pUVM, void *pvData); 353 353 354 355 356 /** 357 * @copydoc DBGFOSREG::pfnStackUnwindAssist 358 */ 359 static DECLCALLBACK(int) dbgDiggerSolarisStackUnwindAssist(PUVM pUVM, void *pvData, VMCPUID idCpu, PDBGFSTACKFRAME pFrame, 360 PRTDBGUNWINDSTATE pState, PCCPUMCTX pInitialCtx, RTDBGAS hAs, 361 uint64_t *puScratch) 362 { 363 RT_NOREF(pUVM, pvData, idCpu, pFrame, pState, pInitialCtx, hAs, puScratch); 364 return VINF_SUCCESS; 365 } 354 366 355 367 … … 1111 1123 const DBGFOSREG g_DBGDiggerSolaris = 1112 1124 { 1113 /* .u32Magic = */ DBGFOSREG_MAGIC, 1114 /* .fFlags = */ 0, 1115 /* .cbData = */ sizeof(DBGDIGGERSOLARIS), 1116 /* .szName = */ "Solaris", 1117 /* .pfnConstruct = */ dbgDiggerSolarisConstruct, 1118 /* .pfnDestruct = */ dbgDiggerSolarisDestruct, 1119 /* .pfnProbe = */ dbgDiggerSolarisProbe, 1120 /* .pfnInit = */ dbgDiggerSolarisInit, 1121 /* .pfnRefresh = */ dbgDiggerSolarisRefresh, 1122 /* .pfnTerm = */ dbgDiggerSolarisTerm, 1123 /* .pfnQueryVersion = */ dbgDiggerSolarisQueryVersion, 1124 /* .pfnQueryInterface = */ dbgDiggerSolarisQueryInterface, 1125 /* .u32EndMagic = */ DBGFOSREG_MAGIC 1125 /* .u32Magic = */ DBGFOSREG_MAGIC, 1126 /* .fFlags = */ 0, 1127 /* .cbData = */ sizeof(DBGDIGGERSOLARIS), 1128 /* .szName = */ "Solaris", 1129 /* .pfnConstruct = */ dbgDiggerSolarisConstruct, 1130 /* .pfnDestruct = */ dbgDiggerSolarisDestruct, 1131 /* .pfnProbe = */ dbgDiggerSolarisProbe, 1132 /* .pfnInit = */ dbgDiggerSolarisInit, 1133 /* .pfnRefresh = */ dbgDiggerSolarisRefresh, 1134 /* .pfnTerm = */ dbgDiggerSolarisTerm, 1135 /* .pfnQueryVersion = */ dbgDiggerSolarisQueryVersion, 1136 /* .pfnQueryInterface = */ dbgDiggerSolarisQueryInterface, 1137 /* .pfnStackUnwindAssist = */ dbgDiggerSolarisStackUnwindAssist, 1138 /* .u32EndMagic = */ DBGFOSREG_MAGIC 1126 1139 }; 1127 1140 -
trunk/src/VBox/Debugger/DBGPlugInWinNt.cpp
r73419 r73460 23 23 #include "DBGPlugIns.h" 24 24 #include <VBox/vmm/dbgf.h> 25 #include <VBox/vmm/cpumctx.h> 26 #include <VBox/vmm/mm.h> 25 27 #include <VBox/err.h> 26 28 #include <VBox/param.h> … … 31 33 #include <iprt/formats/pecoff.h> 32 34 #include <iprt/formats/mz.h> 35 #include <iprt/nt/nt-structures.h> 33 36 34 37 … … 262 265 #define WINNT32_VALID_ADDRESS(Addr) ((Addr) > UINT32_C(0x80000000) && (Addr) < UINT32_C(0xfffff000)) 263 266 /** Validates a 64-bit Windows NT kernel address */ 264 267 #define WINNT64_VALID_ADDRESS(Addr) ((Addr) > UINT64_C(0xffff800000000000) && (Addr) < UINT64_C(0xfffffffffffff000)) 265 268 /** Validates a kernel address. */ 266 269 #define WINNT_VALID_ADDRESS(pThis, Addr) ((pThis)->f32Bit ? WINNT32_VALID_ADDRESS(Addr) : WINNT64_VALID_ADDRESS(Addr)) … … 347 350 else 348 351 Log(("DigWinNt: %s: DBGFR3ModInMem failed: %Rrc\n", pszName, rc)); 352 } 353 354 355 /** 356 * @copydoc DBGFOSREG::pfnStackUnwindAssist 357 */ 358 static DECLCALLBACK(int) dbgDiggerWinNtStackUnwindAssist(PUVM pUVM, void *pvData, VMCPUID idCpu, PDBGFSTACKFRAME pFrame, 359 PRTDBGUNWINDSTATE pState, PCCPUMCTX pInitialCtx, RTDBGAS hAs, 360 uint64_t *puScratch) 361 { 362 Assert(pInitialCtx); 363 364 /* 365 * We want to locate trap frames here. The trap frame structure contains 366 * the 64-bit IRET frame, so given unwind information it's easy to identify 367 * using the return type and frame address. 368 */ 369 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_64BIT) 370 { 371 /* 372 * Is this a trap frame? If so, try read the trap frame. 373 */ 374 if ( pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64 375 && !(pFrame->AddrFrame.FlatPtr & 0x7) 376 && WINNT64_VALID_ADDRESS(pFrame->AddrFrame.FlatPtr) ) 377 { 378 KTRAP_FRAME_AMD64 TrapFrame; 379 RT_ZERO(TrapFrame); 380 uint64_t const uTrapFrameAddr = pFrame->AddrFrame.FlatPtr 381 - RT_UOFFSETOF(KTRAP_FRAME_AMD64, ErrCdOrXcptFrameOrS); 382 int rc = pState->pfnReadStack(pState, uTrapFrameAddr, sizeof(TrapFrame), &TrapFrame); 383 if (RT_SUCCESS(rc)) 384 { 385 /* Valid? Not too much else we can check here (EFlags isn't 386 reliable in manually construct frames). */ 387 if (TrapFrame.ExceptionActive <= 2) 388 { 389 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_TRAP_FRAME; 390 391 /* 392 * Add sure 'register' information from the frame to the frame. 393 * 394 * To avoid code duplication, we do this in two steps in a loop. 395 * The first iteration only figures out how many registers we're 396 * going to save and allocates room for them. The second iteration 397 * does the actual adding. 398 */ 399 uint32_t cRegs = pFrame->cSureRegs; 400 PDBGFREGVALEX paSureRegs = NULL; 401 #define ADD_REG_NAMED(a_Type, a_ValMemb, a_Value, a_pszName) do { \ 402 if (paSureRegs) \ 403 { \ 404 paSureRegs[iReg].pszName = a_pszName;\ 405 paSureRegs[iReg].enmReg = DBGFREG_END; \ 406 paSureRegs[iReg].enmType = a_Type; \ 407 paSureRegs[iReg].Value.a_ValMemb = (a_Value); \ 408 } \ 409 iReg++; \ 410 } while (0) 411 #define MAYBE_ADD_GREG(a_Value, a_enmReg, a_idxReg) do { \ 412 if (!(pState->u.x86.Loaded.s.fRegs & RT_BIT(a_idxReg))) \ 413 { \ 414 if (paSureRegs) \ 415 { \ 416 pState->u.x86.Loaded.s.fRegs |= RT_BIT(a_idxReg); \ 417 pState->u.x86.auRegs[a_idxReg] = (a_Value); \ 418 paSureRegs[iReg].Value.u64 = (a_Value); \ 419 paSureRegs[iReg].enmReg = a_enmReg; \ 420 paSureRegs[iReg].enmType = DBGFREGVALTYPE_U64; \ 421 paSureRegs[iReg].pszName = NULL; \ 422 } \ 423 iReg++; \ 424 } \ 425 } while (0) 426 for (unsigned iLoop = 0; iLoop < 2; iLoop++) 427 { 428 uint32_t iReg = pFrame->cSureRegs; 429 ADD_REG_NAMED(DBGFREGVALTYPE_U64, u64, uTrapFrameAddr, "TrapFrame"); 430 ADD_REG_NAMED(DBGFREGVALTYPE_U8, u8, TrapFrame.ExceptionActive, "ExceptionActive"); 431 if (TrapFrame.ExceptionActive == 0) 432 { 433 ADD_REG_NAMED(DBGFREGVALTYPE_U8, u8, TrapFrame.PreviousIrql, "PrevIrql"); 434 ADD_REG_NAMED(DBGFREGVALTYPE_U8, u8, (uint8_t)TrapFrame.ErrCdOrXcptFrameOrS, "IntNo"); 435 } 436 else if ( TrapFrame.ExceptionActive == 1 437 && TrapFrame.FaultIndicator == ((TrapFrame.ErrCdOrXcptFrameOrS >> 1) & 0x9)) 438 ADD_REG_NAMED(DBGFREGVALTYPE_U64, u64, TrapFrame.FaultAddrOrCtxRecOrTS, "cr2-probably"); 439 if (TrapFrame.SegCs & X86_SEL_RPL) 440 ADD_REG_NAMED(DBGFREGVALTYPE_U8, u8, 1, "UserMode"); 441 else 442 ADD_REG_NAMED(DBGFREGVALTYPE_U8, u8, 1, "KernelMode"); 443 if (TrapFrame.ExceptionActive <= 1) 444 { 445 MAYBE_ADD_GREG(TrapFrame.Rax, DBGFREG_RAX, X86_GREG_xAX); 446 MAYBE_ADD_GREG(TrapFrame.Rcx, DBGFREG_RCX, X86_GREG_xCX); 447 MAYBE_ADD_GREG(TrapFrame.Rdx, DBGFREG_RDX, X86_GREG_xDX); 448 MAYBE_ADD_GREG(TrapFrame.R8, DBGFREG_R8, X86_GREG_x8); 449 MAYBE_ADD_GREG(TrapFrame.R9, DBGFREG_R9, X86_GREG_x9); 450 MAYBE_ADD_GREG(TrapFrame.R10, DBGFREG_R10, X86_GREG_x10); 451 MAYBE_ADD_GREG(TrapFrame.R11, DBGFREG_R11, X86_GREG_x11); 452 } 453 else if (TrapFrame.ExceptionActive == 2) 454 { 455 MAYBE_ADD_GREG(TrapFrame.Rbx, DBGFREG_RBX, X86_GREG_xBX); 456 MAYBE_ADD_GREG(TrapFrame.Rsi, DBGFREG_RSI, X86_GREG_xSI); 457 MAYBE_ADD_GREG(TrapFrame.Rdi, DBGFREG_RDI, X86_GREG_xDI); 458 } 459 MAYBE_ADD_GREG(TrapFrame.Rbp, DBGFREG_RBP, X86_GREG_xBP); 460 461 /* Done? */ 462 if (iLoop > 0) 463 { 464 Assert(cRegs == iReg); 465 break; 466 } 467 468 /* Resize the array, zeroing the extension. */ 469 if (pFrame->cSureRegs) 470 paSureRegs = (PDBGFREGVALEX)MMR3HeapRealloc(pFrame->paSureRegs, iReg * sizeof(paSureRegs[0])); 471 else 472 paSureRegs = (PDBGFREGVALEX)MMR3HeapAllocU(pUVM, MM_TAG_DBGF_STACK, iReg * sizeof(paSureRegs[0])); 473 AssertReturn(paSureRegs, VERR_NO_MEMORY); 474 475 pFrame->paSureRegs = paSureRegs; 476 RT_BZERO(&paSureRegs[pFrame->cSureRegs], (iReg - pFrame->cSureRegs) * sizeof(paSureRegs[0])); 477 cRegs = iReg; 478 } 479 #undef ADD_REG_NAMED 480 #undef MAYBE_ADD_GREG 481 482 /* Commit the register update. */ 483 pFrame->cSureRegs = cRegs; 484 } 485 } 486 } 487 } 488 489 RT_NOREF(pUVM, pvData, idCpu, hAs, puScratch); 490 return VINF_SUCCESS; 349 491 } 350 492 … … 882 1024 const DBGFOSREG g_DBGDiggerWinNt = 883 1025 { 884 /* .u32Magic = */ DBGFOSREG_MAGIC, 885 /* .fFlags = */ 0, 886 /* .cbData = */ sizeof(DBGDIGGERWINNT), 887 /* .szName = */ "WinNT", 888 /* .pfnConstruct = */ dbgDiggerWinNtConstruct, 889 /* .pfnDestruct = */ dbgDiggerWinNtDestruct, 890 /* .pfnProbe = */ dbgDiggerWinNtProbe, 891 /* .pfnInit = */ dbgDiggerWinNtInit, 892 /* .pfnRefresh = */ dbgDiggerWinNtRefresh, 893 /* .pfnTerm = */ dbgDiggerWinNtTerm, 894 /* .pfnQueryVersion = */ dbgDiggerWinNtQueryVersion, 895 /* .pfnQueryInterface = */ dbgDiggerWinNtQueryInterface, 896 /* .u32EndMagic = */ DBGFOSREG_MAGIC 1026 /* .u32Magic = */ DBGFOSREG_MAGIC, 1027 /* .fFlags = */ 0, 1028 /* .cbData = */ sizeof(DBGDIGGERWINNT), 1029 /* .szName = */ "WinNT", 1030 /* .pfnConstruct = */ dbgDiggerWinNtConstruct, 1031 /* .pfnDestruct = */ dbgDiggerWinNtDestruct, 1032 /* .pfnProbe = */ dbgDiggerWinNtProbe, 1033 /* .pfnInit = */ dbgDiggerWinNtInit, 1034 /* .pfnRefresh = */ dbgDiggerWinNtRefresh, 1035 /* .pfnTerm = */ dbgDiggerWinNtTerm, 1036 /* .pfnQueryVersion = */ dbgDiggerWinNtQueryVersion, 1037 /* .pfnQueryInterface = */ dbgDiggerWinNtQueryInterface, 1038 /* .pfnStackUnwindAssist = */ dbgDiggerWinNtStackUnwindAssist, 1039 /* .u32EndMagic = */ DBGFOSREG_MAGIC 897 1040 }; 898 1041 -
trunk/src/VBox/VMM/VMMR3/DBGFOS.cpp
r73414 r73460 638 638 } 639 639 640 641 642 /** 643 * Internal wrapper for calling DBGFOSREG::pfnStackUnwindAssist. 644 */ 645 int dbgfR3OSStackUnwindAssist(PUVM pUVM, VMCPUID idCpu, PDBGFSTACKFRAME pFrame, PRTDBGUNWINDSTATE pState, 646 PCCPUMCTX pInitialCtx, RTDBGAS hAs, uint64_t *puScratch) 647 { 648 int rc = VINF_SUCCESS; 649 if (pUVM->dbgf.s.pCurOS) 650 { 651 ASMCompilerBarrier(); 652 DBGF_OS_READ_LOCK(pUVM); 653 PDBGFOS pOS = pUVM->dbgf.s.pCurOS; 654 if (pOS) 655 rc = pOS->pReg->pfnStackUnwindAssist(pUVM, pUVM->dbgf.s.pCurOS->abData, idCpu, pFrame, 656 pState, pInitialCtx, hAs, puScratch); 657 DBGF_OS_READ_UNLOCK(pUVM); 658 } 659 return rc; 660 } 661 -
trunk/src/VBox/VMM/VMMR3/DBGFStack.cpp
r73455 r73460 40 40 * Structures and Typedefs * 41 41 *********************************************************************************************************************************/ 42 /** Magic value for DBGFUNWINDSTATE::u32Magic (James Moody). */ 43 #define DBGFUNWINDSTATE_MAGIC UINT32_C(0x19250326) 44 /** Magic value for DBGFUNWINDSTATE::u32Magic after use. */ 45 #define DBGFUNWINDSTATE_MAGIC_DEAD UINT32_C(0x20101209) 46 47 /** 48 * Register state. 49 */ 50 typedef struct DBGFUNWINDSTATE 51 { 52 /** Structure magic (DBGFUNWINDSTATE_MAGIC) */ 53 uint32_t u32Magic; 54 /** The state architecture. */ 55 RTLDRARCH enmArch; 56 57 /** The program counter register. 58 * amd64/x86: RIP/EIP/IP 59 * sparc: PC 60 * arm32: PC / R15 61 */ 62 uint64_t uPc; 63 64 /** Return type. */ 65 DBGFRETRUNTYPE enmRetType; 66 67 /** Register state (see enmArch). */ 68 union 69 { 70 /** RTLDRARCH_AMD64, RTLDRARCH_X86_32 and RTLDRARCH_X86_16. */ 71 struct 72 { 73 /** General purpose registers indexed by X86_GREG_XXX. */ 74 uint64_t auRegs[16]; 75 /** The frame address. */ 76 RTFAR64 FrameAddr; 77 /** Set if we're in real or virtual 8086 mode. */ 78 bool fRealOrV86; 79 /** The flags register. */ 80 uint64_t uRFlags; 81 /** Trap error code. */ 82 uint64_t uErrCd; 83 /** Segment registers (indexed by X86_SREG_XXX). */ 84 uint16_t auSegs[6]; 85 86 /** Bitmap tracking register we've loaded and which content can possibly be trusted. */ 87 union 88 { 89 /** For effective clearing of the bits. */ 90 uint32_t fAll; 91 /** Detailed view. */ 92 struct 93 { 94 /** Bitmap indicating whether a GPR was loaded (parallel to auRegs). */ 95 uint16_t fRegs; 96 /** Bitmap indicating whether a segment register was loaded (parallel to auSegs). */ 97 uint8_t fSegs; 98 /** Set if uPc was loaded. */ 99 uint8_t fPc : 1; 100 /** Set if FrameAddr was loaded. */ 101 uint8_t fFrameAddr : 1; 102 /** Set if uRFlags was loaded. */ 103 uint8_t fRFlags : 1; 104 /** Set if uErrCd was loaded. */ 105 uint8_t fErrCd : 1; 106 } s; 107 } Loaded; 108 } x86; 109 110 /** @todo add ARM and others as needed. */ 111 } u; 112 113 /** 114 * Stack read callback. 115 * 116 * @returns IPRT status code. 117 * @param pThis Pointer to this structure. 118 * @param uSp The stack pointer address. 119 * @param cbToRead The number of bytes to read. 120 * @param pvDst Where to put the bytes we read. 121 */ 122 DECLCALLBACKMEMBER(int, pfnReadStack)(struct DBGFUNWINDSTATE *pThis, RTUINTPTR uSp, size_t cbToRead, void *pvDst); 123 /** User argument (usefule for pfnReadStack). */ 124 void *pvUser; 125 126 } DBGFUNWINDSTATE; 127 typedef struct DBGFUNWINDSTATE *PDBGFUNWINDSTATE; 128 typedef struct DBGFUNWINDSTATE const *PCDBGFUNWINDSTATE; 129 130 static DECLCALLBACK(int) dbgfR3StackReadCallback(PDBGFUNWINDSTATE pThis, RTUINTPTR uSp, size_t cbToRead, void *pvDst); 131 42 static DECLCALLBACK(int) dbgfR3StackReadCallback(PRTDBGUNWINDSTATE pThis, RTUINTPTR uSp, size_t cbToRead, void *pvDst); 132 43 133 44 /** … … 143 54 VMCPUID m_idCpu; 144 55 RTDBGAS m_hAs; 145 146 DBGFUNWINDSTATE m_State; 56 PCCPUMCTX m_pInitialCtx; 57 uint64_t m_uOsScratch; /**< For passing to DBGFOSREG::pfnStackUnwindAssist. */ 58 59 RTDBGUNWINDSTATE m_State; 147 60 148 61 RTDBGMOD m_hCached; … … 159 72 DBGFUNWINDCTX(PUVM pUVM, VMCPUID idCpu, PCCPUMCTX pInitialCtx, RTDBGAS hAs) 160 73 { 161 m_State.u32Magic = DBGFUNWINDSTATE_MAGIC;74 m_State.u32Magic = RTDBGUNWINDSTATE_MAGIC; 162 75 m_State.enmArch = RTLDRARCH_AMD64; 163 76 m_State.pfnReadStack = dbgfR3StackReadCallback; … … 196 109 m_idCpu = idCpu; 197 110 m_hAs = DBGFR3AsResolveAndRetain(pUVM, hAs); 111 m_pInitialCtx = pInitialCtx; 112 m_uOsScratch = 0; 198 113 199 114 m_hCached = NIL_RTDBGMOD; … … 243 158 244 159 /** 245 * @interface_method_impl{ DBGFUNWINDSTATE,pfnReadStack}246 */ 247 static DECLCALLBACK(int) dbgfR3StackReadCallback(P DBGFUNWINDSTATE pThis, RTUINTPTR uSp, size_t cbToRead, void *pvDst)160 * @interface_method_impl{RTDBGUNWINDSTATE,pfnReadStack} 161 */ 162 static DECLCALLBACK(int) dbgfR3StackReadCallback(PRTDBGUNWINDSTATE pThis, RTUINTPTR uSp, size_t cbToRead, void *pvDst) 248 163 { 249 164 Assert( pThis->enmArch == RTLDRARCH_AMD64 … … 308 223 * @param puDst The read destination. 309 224 */ 310 DECLINLINE(int) dbgUnwindLoadStackU16(P DBGFUNWINDSTATE pThis, uint64_t uSrcAddr, uint16_t *puDst)225 DECLINLINE(int) dbgUnwindLoadStackU16(PRTDBGUNWINDSTATE pThis, uint64_t uSrcAddr, uint16_t *puDst) 311 226 { 312 227 return pThis->pfnReadStack(pThis, uSrcAddr, sizeof(*puDst), puDst); … … 322 237 * @param puDst The read destination. 323 238 */ 324 DECLINLINE(int) dbgUnwindLoadStackU64(P DBGFUNWINDSTATE pThis, uint64_t uSrcAddr, uint64_t *puDst)239 DECLINLINE(int) dbgUnwindLoadStackU64(PRTDBGUNWINDSTATE pThis, uint64_t uSrcAddr, uint64_t *puDst) 325 240 { 326 241 return pThis->pfnReadStack(pThis, uSrcAddr, sizeof(*puDst), puDst); … … 362 277 * @param fErrCd Non-zero if there is an error code on the stack. 363 278 */ 364 static bool dbgUnwindPeAmd64DoOneIRet(P DBGFUNWINDSTATE pThis, uint8_t fErrCd)279 static bool dbgUnwindPeAmd64DoOneIRet(PRTDBGUNWINDSTATE pThis, uint8_t fErrCd) 365 280 { 366 281 Assert(fErrCd <= 1); … … 375 290 } 376 291 377 pThis->enmRetType = DBGFRETURNTYPE_IRET64;292 pThis->enmRetType = RTDBGRETURNTYPE_IRET64; 378 293 pThis->u.x86.FrameAddr.off = pThis->u.x86.auRegs[X86_GREG_xSP] - /* pretend rbp is pushed on the stack */ 8; 379 294 pThis->u.x86.FrameAddr.sel = pThis->u.x86.auSegs[X86_SREG_SS]; … … 419 334 */ 420 335 static bool dbgUnwindPeAmd64DoOne(RTDBGMOD hMod, PCIMAGE_RUNTIME_FUNCTION_ENTRY paFunctions, size_t cFunctions, 421 P DBGFUNWINDSTATE pThis, uint32_t uRvaRip)336 PRTDBGUNWINDSTATE pThis, uint32_t uRvaRip) 422 337 { 423 338 /* … … 681 596 * RSP should now give us the return address, so perform a RET. 682 597 */ 683 pThis->enmRetType = DBGFRETURNTYPE_NEAR64;598 pThis->enmRetType = RTDBGRETURNTYPE_NEAR64; 684 599 685 600 pThis->u.x86.FrameAddr.off = pThis->u.x86.auRegs[X86_GREG_xSP] - /* pretend rbp is pushed on the stack */ 8; … … 794 709 } 795 710 796 static int dbgfR3StackWalkCollectRegisterChanges(PUVM pUVM, PDBGFSTACKFRAME pFrame, PDBGFUNWINDSTATE pState) 711 /** 712 * Collects sure registers on frame exit. 713 * 714 * @returns VINF_SUCCESS or VERR_NO_MEMORY. 715 * @param pUVM The user mode VM handle for the allocation. 716 * @param pFrame The frame in question. 717 * @param pState The unwind state. 718 */ 719 static int dbgfR3StackWalkCollectRegisterChanges(PUVM pUVM, PDBGFSTACKFRAME pFrame, PRTDBGUNWINDSTATE pState) 797 720 { 798 721 pFrame->cSureRegs = 0; … … 931 854 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO; 932 855 pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET; 933 if (pFrame->enmReturnFrameReturnType != DBGFRETURNTYPE_INVALID)856 if (pFrame->enmReturnFrameReturnType != RTDBGRETURNTYPE_INVALID) 934 857 { 935 858 pFrame->enmReturnType = pFrame->enmReturnFrameReturnType; 936 pFrame->enmReturnFrameReturnType = DBGFRETURNTYPE_INVALID;859 pFrame->enmReturnFrameReturnType = RTDBGRETURNTYPE_INVALID; 937 860 } 938 861 } 939 } 940 941 /* 942 * Enagage the OS layer and collect register changes. 943 */ 944 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 945 { 946 /** @todo engage the OS buggers to identify trap frames and update unwindctx accordingly. */ 947 if (!fFirst) 948 { 949 int rc = dbgfR3StackWalkCollectRegisterChanges(pUnwindCtx->m_pUVM, pFrame, &pUnwindCtx->m_State); 950 if (RT_FAILURE(rc)) 951 return rc; 952 } 862 pFrame->fFlags &= ~DBGFSTACKFRAME_FLAGS_TRAP_FRAME; 953 863 } 954 864 … … 957 867 */ 958 868 /** @todo this is bogus... */ 959 unsigned cbRetAddr = DBGFReturnTypeSize(pFrame->enmReturnType);869 unsigned cbRetAddr = RTDbgReturnTypeSize(pFrame->enmReturnType); 960 870 unsigned cbStackItem; 961 871 switch (pFrame->AddrPC.fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) … … 968 878 switch (pFrame->enmReturnType) 969 879 { 970 case DBGFRETURNTYPE_FAR16:971 case DBGFRETURNTYPE_IRET16:972 case DBGFRETURNTYPE_IRET32_V86:973 case DBGFRETURNTYPE_NEAR16: cbStackItem = 2; break;974 975 case DBGFRETURNTYPE_FAR32:976 case DBGFRETURNTYPE_IRET32:977 case DBGFRETURNTYPE_IRET32_PRIV:978 case DBGFRETURNTYPE_NEAR32: cbStackItem = 4; break;979 980 case DBGFRETURNTYPE_FAR64:981 case DBGFRETURNTYPE_IRET64:982 case DBGFRETURNTYPE_NEAR64: cbStackItem = 8; break;880 case RTDBGRETURNTYPE_FAR16: 881 case RTDBGRETURNTYPE_IRET16: 882 case RTDBGRETURNTYPE_IRET32_V86: 883 case RTDBGRETURNTYPE_NEAR16: cbStackItem = 2; break; 884 885 case RTDBGRETURNTYPE_FAR32: 886 case RTDBGRETURNTYPE_IRET32: 887 case RTDBGRETURNTYPE_IRET32_PRIV: 888 case RTDBGRETURNTYPE_NEAR32: cbStackItem = 4; break; 889 890 case RTDBGRETURNTYPE_FAR64: 891 case RTDBGRETURNTYPE_IRET64: 892 case RTDBGRETURNTYPE_NEAR64: cbStackItem = 8; break; 983 893 984 894 default: … … 1024 934 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 1025 935 { 1026 if ( pFrame->enmReturnType == DBGFRETURNTYPE_IRET32_PRIV1027 || pFrame->enmReturnType == DBGFRETURNTYPE_IRET64)936 if ( pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_PRIV 937 || pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64) 1028 938 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnFrame, 1029 939 pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_SS], pUnwindCtx->m_State.u.x86.auRegs[X86_GREG_xBP]); 1030 else if (pFrame->enmReturnType == DBGFRETURNTYPE_IRET32_V86)940 else if (pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_V86) 1031 941 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnFrame, 1032 942 ((uint32_t)pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_SS] << 4) … … 1055 965 { 1056 966 pFrame->AddrReturnFrame.off &= ~(RTGCUINTPTR)1; 1057 if (pFrame->enmReturnType == DBGFRETURNTYPE_NEAR16)967 if (pFrame->enmReturnType == RTDBGRETURNTYPE_NEAR16) 1058 968 { 1059 969 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN; 1060 pFrame->enmReturnType = DBGFRETURNTYPE_FAR16;970 pFrame->enmReturnType = RTDBGRETURNTYPE_FAR16; 1061 971 cbRetAddr = 4; 1062 972 } 1063 else if (pFrame->enmReturnType == DBGFRETURNTYPE_NEAR32)973 else if (pFrame->enmReturnType == RTDBGRETURNTYPE_NEAR32) 1064 974 { 1065 975 pFrame->fFlags |= DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN; 1066 pFrame->enmReturnType = DBGFRETURNTYPE_FAR32;976 pFrame->enmReturnType = RTDBGRETURNTYPE_FAR32; 1067 977 cbRetAddr = 8; 1068 978 } … … 1070 980 else if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN) 1071 981 { 1072 if (pFrame->enmReturnType == DBGFRETURNTYPE_FAR16)982 if (pFrame->enmReturnType == RTDBGRETURNTYPE_FAR16) 1073 983 { 1074 pFrame->enmReturnType = DBGFRETURNTYPE_NEAR16;984 pFrame->enmReturnType = RTDBGRETURNTYPE_NEAR16; 1075 985 cbRetAddr = 2; 1076 986 } 1077 else if (pFrame->enmReturnType == DBGFRETURNTYPE_NEAR32)987 else if (pFrame->enmReturnType == RTDBGRETURNTYPE_NEAR32) 1078 988 { 1079 pFrame->enmReturnType = DBGFRETURNTYPE_FAR32;989 pFrame->enmReturnType = RTDBGRETURNTYPE_FAR32; 1080 990 cbRetAddr = 4; 1081 991 } … … 1094 1004 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 1095 1005 { 1096 if ( pFrame->enmReturnType == DBGFRETURNTYPE_IRET32_PRIV1097 || pFrame->enmReturnType == DBGFRETURNTYPE_IRET64)1006 if ( pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_PRIV 1007 || pFrame->enmReturnType == RTDBGRETURNTYPE_IRET64) 1098 1008 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnStack, 1099 1009 pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_SS], pUnwindCtx->m_State.u.x86.auRegs[X86_GREG_xSP]); 1100 else if (pFrame->enmReturnType == DBGFRETURNTYPE_IRET32_V86)1010 else if (pFrame->enmReturnType == RTDBGRETURNTYPE_IRET32_V86) 1101 1011 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnStack, 1102 1012 ((uint32_t)pUnwindCtx->m_State.u.x86.auSegs[X86_SREG_SS] << 4) … … 1120 1030 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 1121 1031 { 1122 if ( DBGFReturnTypeIsNear(pFrame->enmReturnType))1032 if (RTDbgReturnTypeIsNear(pFrame->enmReturnType)) 1123 1033 { 1124 1034 pFrame->AddrReturnPC.off = pUnwindCtx->m_State.uPc; … … 1132 1042 switch (pFrame->enmReturnType) 1133 1043 { 1134 case DBGFRETURNTYPE_NEAR16:1044 case RTDBGRETURNTYPE_NEAR16: 1135 1045 if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC)) 1136 1046 { … … 1141 1051 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, *uRet.pu16); 1142 1052 break; 1143 case DBGFRETURNTYPE_NEAR32:1053 case RTDBGRETURNTYPE_NEAR32: 1144 1054 if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC)) 1145 1055 { … … 1150 1060 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, *uRet.pu32); 1151 1061 break; 1152 case DBGFRETURNTYPE_NEAR64:1062 case RTDBGRETURNTYPE_NEAR64: 1153 1063 if (DBGFADDRESS_IS_VALID(&pFrame->AddrReturnPC)) 1154 1064 { … … 1159 1069 DBGFR3AddrFromFlat(pUnwindCtx->m_pUVM, &pFrame->AddrReturnPC, *uRet.pu64); 1160 1070 break; 1161 case DBGFRETURNTYPE_FAR16:1071 case RTDBGRETURNTYPE_FAR16: 1162 1072 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[1], uRet.pu16[0]); 1163 1073 break; 1164 case DBGFRETURNTYPE_FAR32:1074 case RTDBGRETURNTYPE_FAR32: 1165 1075 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[2], uRet.pu32[0]); 1166 1076 break; 1167 case DBGFRETURNTYPE_FAR64:1077 case RTDBGRETURNTYPE_FAR64: 1168 1078 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[4], uRet.pu64[0]); 1169 1079 break; 1170 case DBGFRETURNTYPE_IRET16:1080 case RTDBGRETURNTYPE_IRET16: 1171 1081 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[1], uRet.pu16[0]); 1172 1082 break; 1173 case DBGFRETURNTYPE_IRET32:1083 case RTDBGRETURNTYPE_IRET32: 1174 1084 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[2], uRet.pu32[0]); 1175 1085 break; 1176 case DBGFRETURNTYPE_IRET32_PRIV:1086 case RTDBGRETURNTYPE_IRET32_PRIV: 1177 1087 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[2], uRet.pu32[0]); 1178 1088 break; 1179 case DBGFRETURNTYPE_IRET32_V86:1089 case RTDBGRETURNTYPE_IRET32_V86: 1180 1090 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[2], uRet.pu32[0]); 1181 1091 break; 1182 case DBGFRETURNTYPE_IRET64:1092 case RTDBGRETURNTYPE_IRET64: 1183 1093 DBGFR3AddrFromSelOff(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, &pFrame->AddrReturnPC, uRet.pu16[4], uRet.pu64[0]); 1184 1094 break; … … 1214 1124 1215 1125 /* 1126 * Collect register changes. 1127 * Then call the OS layer to assist us (e.g. NT trap frames). 1128 */ 1129 if (pFrame->fFlags & DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO) 1130 { 1131 if (!fFirst) 1132 { 1133 int rc = dbgfR3StackWalkCollectRegisterChanges(pUnwindCtx->m_pUVM, pFrame, &pUnwindCtx->m_State); 1134 if (RT_FAILURE(rc)) 1135 return rc; 1136 } 1137 1138 if ( pUnwindCtx->m_pInitialCtx 1139 && pUnwindCtx->m_hAs != NIL_RTDBGAS) 1140 { 1141 int rc = dbgfR3OSStackUnwindAssist(pUnwindCtx->m_pUVM, pUnwindCtx->m_idCpu, pFrame, &pUnwindCtx->m_State, 1142 pUnwindCtx->m_pInitialCtx, pUnwindCtx->m_hAs, &pUnwindCtx->m_uOsScratch); 1143 if (RT_FAILURE(rc)) 1144 return rc; 1145 } 1146 } 1147 1148 /* 1216 1149 * Try use unwind information to locate the return frame pointer (for the 1217 1150 * next loop iteration). 1218 1151 */ 1219 1152 Assert(!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET)); 1220 pFrame->enmReturnFrameReturnType = DBGFRETURNTYPE_INVALID;1153 pFrame->enmReturnFrameReturnType = RTDBGRETURNTYPE_INVALID; 1221 1154 if (!(pFrame->fFlags & DBGFSTACKFRAME_FLAGS_LAST)) 1222 1155 { … … 1258 1191 PCDBGFADDRESS pAddrStack, 1259 1192 PCDBGFADDRESS pAddrPC, 1260 DBGFRETURNTYPE enmReturnType,1193 RTDBGRETURNTYPE enmReturnType, 1261 1194 PCDBGFSTACKFRAME *ppFirstFrame) 1262 1195 { … … 1301 1234 { 1302 1235 fAddrMask = UINT16_MAX; 1303 if (enmReturnType == DBGFRETURNTYPE_INVALID)1304 pCur->enmReturnType = DBGFRETURNTYPE_NEAR16;1236 if (enmReturnType == RTDBGRETURNTYPE_INVALID) 1237 pCur->enmReturnType = RTDBGRETURNTYPE_NEAR16; 1305 1238 } 1306 1239 else if ( enmCpuMode == CPUMMODE_PROTECTED … … 1308 1241 { 1309 1242 fAddrMask = UINT32_MAX; 1310 if (enmReturnType == DBGFRETURNTYPE_INVALID)1311 pCur->enmReturnType = DBGFRETURNTYPE_NEAR32;1243 if (enmReturnType == RTDBGRETURNTYPE_INVALID) 1244 pCur->enmReturnType = RTDBGRETURNTYPE_NEAR32; 1312 1245 } 1313 1246 else 1314 1247 { 1315 1248 fAddrMask = UINT64_MAX; 1316 if (enmReturnType == DBGFRETURNTYPE_INVALID)1317 pCur->enmReturnType = DBGFRETURNTYPE_NEAR64;1249 if (enmReturnType == RTDBGRETURNTYPE_INVALID) 1250 pCur->enmReturnType = RTDBGRETURNTYPE_NEAR64; 1318 1251 } 1319 1252 } 1320 1253 1321 if (enmReturnType == DBGFRETURNTYPE_INVALID)1254 if (enmReturnType == RTDBGRETURNTYPE_INVALID) 1322 1255 switch (pCur->AddrPC.fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) 1323 1256 { 1324 case DBGFADDRESS_FLAGS_FAR16: pCur->enmReturnType = DBGFRETURNTYPE_NEAR16; break;1325 case DBGFADDRESS_FLAGS_FAR32: pCur->enmReturnType = DBGFRETURNTYPE_NEAR32; break;1326 case DBGFADDRESS_FLAGS_FAR64: pCur->enmReturnType = DBGFRETURNTYPE_NEAR64; break;1257 case DBGFADDRESS_FLAGS_FAR16: pCur->enmReturnType = RTDBGRETURNTYPE_NEAR16; break; 1258 case DBGFADDRESS_FLAGS_FAR32: pCur->enmReturnType = RTDBGRETURNTYPE_NEAR32; break; 1259 case DBGFADDRESS_FLAGS_FAR64: pCur->enmReturnType = RTDBGRETURNTYPE_NEAR64; break; 1327 1260 case DBGFADDRESS_FLAGS_RING0: 1328 pCur->enmReturnType = HC_ARCH_BITS == 64 ? DBGFRETURNTYPE_NEAR64 : DBGFRETURNTYPE_NEAR32;1261 pCur->enmReturnType = HC_ARCH_BITS == 64 ? RTDBGRETURNTYPE_NEAR64 : RTDBGRETURNTYPE_NEAR32; 1329 1262 break; 1330 1263 default: 1331 pCur->enmReturnType = DBGFRETURNTYPE_NEAR32;1264 pCur->enmReturnType = RTDBGRETURNTYPE_NEAR32; 1332 1265 break; 1333 1266 } … … 1438 1371 PCDBGFADDRESS pAddrStack, 1439 1372 PCDBGFADDRESS pAddrPC, 1440 DBGFRETURNTYPE enmReturnType,1373 RTDBGRETURNTYPE enmReturnType, 1441 1374 PCDBGFSTACKFRAME *ppFirstFrame) 1442 1375 { … … 1455 1388 if (pAddrPC) 1456 1389 AssertReturn(DBGFR3AddrIsValid(pUVM, pAddrPC), VERR_INVALID_PARAMETER); 1457 AssertReturn(enmReturnType >= DBGFRETURNTYPE_INVALID && enmReturnType < DBGFRETURNTYPE_END, VERR_INVALID_PARAMETER);1390 AssertReturn(enmReturnType >= RTDBGRETURNTYPE_INVALID && enmReturnType < RTDBGRETURNTYPE_END, VERR_INVALID_PARAMETER); 1458 1391 1459 1392 /* … … 1510 1443 PCDBGFADDRESS pAddrStack, 1511 1444 PCDBGFADDRESS pAddrPC, 1512 DBGFRETURNTYPE enmReturnType,1445 RTDBGRETURNTYPE enmReturnType, 1513 1446 PCDBGFSTACKFRAME *ppFirstFrame) 1514 1447 { … … 1534 1467 VMMR3DECL(int) DBGFR3StackWalkBegin(PUVM pUVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFSTACKFRAME *ppFirstFrame) 1535 1468 { 1536 return dbgfR3StackWalkBeginCommon(pUVM, idCpu, enmCodeType, NULL, NULL, NULL, DBGFRETURNTYPE_INVALID, ppFirstFrame);1469 return dbgfR3StackWalkBeginCommon(pUVM, idCpu, enmCodeType, NULL, NULL, NULL, RTDBGRETURNTYPE_INVALID, ppFirstFrame); 1537 1470 } 1538 1471 -
trunk/src/VBox/VMM/VMMR3/VMMGuruMeditation.cpp
r73360 r73460 473 473 PCDBGFSTACKFRAME pFirstFrame; 474 474 rc2 = DBGFR3StackWalkBeginEx(pVM->pUVM, pVCpu->idCpu, DBGFCODETYPE_RING0, &ebp, &esp, &pc, 475 DBGFRETURNTYPE_INVALID, &pFirstFrame);475 RTDBGRETURNTYPE_INVALID, &pFirstFrame); 476 476 if (RT_SUCCESS(rc2)) 477 477 { -
trunk/src/VBox/VMM/VMMR3/VMMR3.def
r73417 r73460 207 207 MMR3HeapFree 208 208 MMR3HeapRealloc 209 MMR3HeapAllocU 209 210 210 211 MMR3HyperAllocOnceNoRel -
trunk/src/VBox/VMM/include/DBGFInternal.h
r73414 r73460 153 153 154 154 155 #ifdef IN_RING3 155 156 /** 156 157 * Guest OS digger instance. … … 167 168 uint8_t abData[16]; 168 169 } DBGFOS; 170 #endif 169 171 /** Pointer to guest OS digger instance. */ 170 typedef DBGFOS *PDBGFOS;172 typedef struct DBGFOS *PDBGFOS; 171 173 /** Pointer to const guest OS digger instance. */ 172 typedef DBGFOS const *PCDBGFOS;174 typedef struct DBGFOS const *PCDBGFOS; 173 175 174 176 … … 497 499 498 500 501 #ifdef IN_RING3 499 502 int dbgfR3AsInit(PUVM pUVM); 500 503 void dbgfR3AsTerm(PUVM pUVM); … … 506 509 void dbgfR3OSTermPart1(PUVM pUVM); 507 510 void dbgfR3OSTermPart2(PUVM pUVM); 511 int dbgfR3OSStackUnwindAssist(PUVM pUVM, VMCPUID idCpu, PDBGFSTACKFRAME pFrame, PRTDBGUNWINDSTATE pState, 512 PCCPUMCTX pInitialCtx, RTDBGAS hAs, uint64_t *puScratch); 508 513 int dbgfR3RegInit(PUVM pUVM); 509 514 void dbgfR3RegTerm(PUVM pUVM); … … 517 522 int dbgfR3BugCheckInit(PVM pVM); 518 523 519 520 521 #ifdef IN_RING3522 524 /** 523 525 * DBGF disassembler state (substate of DISSTATE). … … 541 543 char *pszOutput, uint32_t cbOutput, PDBGFDISSTATE pDisState); 542 544 545 #endif /* IN_RING3 */ 546 547 /** @} */ 548 543 549 #endif 544 545 /** @} */546 547 #endif
Note:
See TracChangeset
for help on using the changeset viewer.