Changeset 30072 in vbox for trunk/src/VBox/VMM/VMMGuruMeditation.cpp
- Timestamp:
- Jun 7, 2010 1:54:47 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMGuruMeditation.cpp
r30060 r30072 250 250 || strchr(pszMsg2, '\0')[-1] != '\n') 251 251 pHlp->pfnPrintf(pHlp, "\n"); 252 pHlp->pfnPrintf(pHlp, "!!\n");253 252 /* fall thru */ 254 253 } … … 288 287 289 288 /* 290 * The hypervisor dump is not relevant when we're in VT-x/AMD-V mode.289 * Dump the relevant hypervisor registers and stack. 291 290 */ 292 291 if (HWACCMIsEnabled(pVM)) 293 292 { 294 pHlp->pfnPrintf(pHlp, "\n"); 295 #if defined(RT_OS_WINDOWS) && HC_ARCH_BITS == 32 293 if ( rcErr == VERR_VMM_RING0_ASSERTION /* fInRing3Call has already been cleared here. */ 294 || pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call) 295 { 296 /* Dump the jmpbuf. */ 297 pHlp->pfnPrintf(pHlp, 298 "!!\n" 299 "!! CallRing3JmpBuf:\n" 300 "!!\n"); 301 pHlp->pfnPrintf(pHlp, 302 "SavedEsp=%RHv SavedEbp=%RHv SpResume=%RHv SpCheck=%RHv fInRing3Call=%RTbool\n", 303 pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp, 304 pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp, 305 pVCpu->vmm.s.CallRing3JmpBufR0.SpResume, 306 pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck, 307 pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call); 308 pHlp->pfnPrintf(pHlp, 309 "pvSavedStack=%RHv SavedEbp=%RX32 SpResume=%RHv SpCheck=%RHv\n", 310 pVCpu->vmm.s.CallRing3JmpBufR0.pvSavedStack, 311 pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack); 312 pHlp->pfnPrintf(pHlp, 313 "cbUsedMax=%#4x cbUsedAvg=%#4x cbUsedTotal=%#llx cUsedTotal=%#llx\n", 314 pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedMax, 315 pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedAvg, 316 pVCpu->vmm.s.CallRing3JmpBufR0.cbUsedTotal, 317 pVCpu->vmm.s.CallRing3JmpBufR0.cUsedTotal); 318 319 /* Dump the resume register frame on the stack. */ 320 PRTHCUINTPTR pBP; 321 #ifdef VMM_R0_SWITCH_STACK 322 pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.pbEMTStackR3[ pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp 323 - MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3)]; 324 #else 325 pBP = (PRTHCUINTPTR)&pVCpu->vmm.s.pbEMTStackR3[ pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack 326 - pVCpu->vmm.s.CallRing3JmpBufR0.SpCheck 327 + pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp]; 328 #endif 329 #if HC_ARCH_BITS == 32 330 pHlp->pfnPrintf(pHlp, 331 "eax=volatile ebx=%08x ecx=volatile edx=volatile esi=%08x edi=%08x\n" 332 "eip=%08x esp=%08x ebp=%08x efl=%08x\n" 333 , 334 pBP[-3], pBP[-2], pBP[-1], 335 pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 8, pBP[0], pBP[-4]); 336 #else 337 # ifdef RT_OS_WINDOWS 338 pHlp->pfnPrintf(pHlp, 339 "rax=volatile rbx=%016RX64 rcx=volatile rdx=volatile\n" 340 "rsi=%016RX64 rdi=%016RX64 r8=volatile r9=volatile \n" 341 "r10=volatile r11=volatile r12=%016RX64 r13=%016RX64\n" 342 "r14=%016RX64 r15=%016RX64\n" 343 "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 rfl=%08RX64\n" 344 , 345 pBP[-7], 346 pBP[-6], pBP[-5], 347 pBP[-4], pBP[-3], 348 pBP[-2], pBP[-1], 349 pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 16, pBP[0], pBP[-8]); 350 # else 351 pHlp->pfnPrintf(pHlp, 352 "rax=volatile rbx=%016RX64 rcx=volatile rdx=volatile\n" 353 "rsi=volatile rdi=volatile r8=volatile r9=volatile \n" 354 "r10=volatile r11=volatile r12=%016RX64 r13=%016RX64\n" 355 "r14=%016RX64 r15=%016RX64\n" 356 "rip=%016RX64 rsp=%016RX64 rbp=%016RX64 rflags=%08RX64\n" 357 , 358 pBP[-5], 359 pBP[-4], pBP[-3], 360 pBP[-2], pBP[-1], 361 pBP[1], pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp - 16, pBP[0], pBP[-6]); 362 # endif 363 #endif 364 365 #if HC_ARCH_BITS == 32 366 /* Callstack. */ 367 DBGFADDRESS pc; 368 pc.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 369 # if HC_ARCH_BITS == 64 370 pc.FlatPtr = pc.off = pVCpu->vmm.s.CallRing3JmpBufR0.rip; 371 # else 372 pc.FlatPtr = pc.off = pVCpu->vmm.s.CallRing3JmpBufR0.eip; 373 # endif 374 pc.Sel = DBGF_SEL_FLAT; 375 376 DBGFADDRESS ebp; 377 ebp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 378 ebp.FlatPtr = ebp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp; 379 ebp.Sel = DBGF_SEL_FLAT; 380 381 DBGFADDRESS esp; 382 esp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 383 esp.Sel = DBGF_SEL_FLAT; 384 esp.FlatPtr = esp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp; 385 386 PCDBGFSTACKFRAME pFirstFrame; 387 rc2 = DBGFR3StackWalkBeginEx(pVM, pVCpu->idCpu, DBGFCODETYPE_RING0, &ebp, &esp, &pc, 388 DBGFRETURNTYPE_INVALID, &pFirstFrame); 389 if (RT_SUCCESS(rc2)) 390 { 391 pHlp->pfnPrintf(pHlp, 392 "!!\n" 393 "!! Call Stack:\n" 394 "!!\n" 395 "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n"); 396 for (PCDBGFSTACKFRAME pFrame = pFirstFrame; 397 pFrame; 398 pFrame = DBGFR3StackWalkNext(pFrame)) 399 { 400 pHlp->pfnPrintf(pHlp, 401 "%08RX32 %08RX32 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32", 402 (uint32_t)pFrame->AddrFrame.off, 403 (uint32_t)pFrame->AddrReturnFrame.off, 404 (uint32_t)pFrame->AddrReturnPC.Sel, 405 (uint32_t)pFrame->AddrReturnPC.off, 406 pFrame->Args.au32[0], 407 pFrame->Args.au32[1], 408 pFrame->Args.au32[2], 409 pFrame->Args.au32[3]); 410 pHlp->pfnPrintf(pHlp, " %RTsel:%08RGv", pFrame->AddrPC.Sel, pFrame->AddrPC.off); 411 if (pFrame->pSymPC) 412 { 413 RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value; 414 if (offDisp > 0) 415 pHlp->pfnPrintf(pHlp, " %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp); 416 else if (offDisp < 0) 417 pHlp->pfnPrintf(pHlp, " %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp); 418 else 419 pHlp->pfnPrintf(pHlp, " %s", pFrame->pSymPC->szName); 420 } 421 if (pFrame->pLinePC) 422 pHlp->pfnPrintf(pHlp, " [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo); 423 pHlp->pfnPrintf(pHlp, "\n"); 424 } 425 DBGFR3StackWalkEnd(pFirstFrame); 426 } 427 #endif /* defined(RT_OS_WINDOWS) && HC_ARCH_BITS == 32 */ 428 429 /* raw stack */ 430 pHlp->pfnPrintf(pHlp, 431 "!!\n" 432 "!! Raw stack (mind the direction). \n" 433 "!! pbEMTStackR0=%RHv pbEMTStackBottomR0=%RHv VMM_STACK_SIZE=%#x\n" 434 "!!\n" 435 "%.*Rhxd\n", 436 MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3), 437 MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3) + VMM_STACK_SIZE, 438 VMM_STACK_SIZE, 439 VMM_STACK_SIZE, pVCpu->vmm.s.pbEMTStackR3); 440 } 441 else 442 { 443 pHlp->pfnPrintf(pHlp, 444 "!! Skipping ring-0 registers and stack, rcErr=%Rrc\n", rcErr); 445 } 446 } 447 else 448 { 449 /* 450 * Try figure out where eip is. 451 */ 452 /* core code? */ 453 if (uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC < pVM->vmm.s.cbCoreCode) 454 pHlp->pfnPrintf(pHlp, 455 "!! EIP is in CoreCode, offset %#x\n", 456 uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC); 457 else 458 { /* ask PDM */ /** @todo ask DBGFR3Sym later? */ 459 char szModName[64]; 460 RTRCPTR RCPtrMod; 461 char szNearSym1[260]; 462 RTRCPTR RCPtrNearSym1; 463 char szNearSym2[260]; 464 RTRCPTR RCPtrNearSym2; 465 int rc = PDMR3LdrQueryRCModFromPC(pVM, uEIP, 466 &szModName[0], sizeof(szModName), &RCPtrMod, 467 &szNearSym1[0], sizeof(szNearSym1), &RCPtrNearSym1, 468 &szNearSym2[0], sizeof(szNearSym2), &RCPtrNearSym2); 469 if (RT_SUCCESS(rc)) 470 pHlp->pfnPrintf(pHlp, 471 "!! EIP in %s (%RRv) at rva %x near symbols:\n" 472 "!! %RRv rva %RRv off %08x %s\n" 473 "!! %RRv rva %RRv off -%08x %s\n", 474 szModName, RCPtrMod, (unsigned)(uEIP - RCPtrMod), 475 RCPtrNearSym1, RCPtrNearSym1 - RCPtrMod, (unsigned)(uEIP - RCPtrNearSym1), szNearSym1, 476 RCPtrNearSym2, RCPtrNearSym2 - RCPtrMod, (unsigned)(RCPtrNearSym2 - uEIP), szNearSym2); 477 else 478 pHlp->pfnPrintf(pHlp, 479 "!! EIP is not in any code known to VMM!\n"); 480 } 481 482 /* Disassemble the instruction. */ 483 char szInstr[256]; 484 rc2 = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, 0, 0, DBGF_DISAS_FLAGS_CURRENT_HYPER, &szInstr[0], sizeof(szInstr), NULL); 485 if (RT_SUCCESS(rc2)) 486 pHlp->pfnPrintf(pHlp, 487 "!! %s\n", szInstr); 488 489 /* Dump the hypervisor cpu state. */ 490 pHlp->pfnPrintf(pHlp, 491 "!!\n" 492 "!!\n" 493 "!!\n"); 494 rc2 = DBGFR3Info(pVM, "cpumhyper", "verbose", pHlp); 495 fDoneHyper = true; 496 296 497 /* Callstack. */ 297 498 PCDBGFSTACKFRAME pFirstFrame; 298 DBGFADDRESS eip, ebp, esp; 299 300 eip.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 301 #if HC_ARCH_BITS == 64 302 eip.FlatPtr = eip.off = pVCpu->vmm.s.CallRing3JmpBufR0.rip; 303 #else 304 eip.FlatPtr = eip.off = pVCpu->vmm.s.CallRing3JmpBufR0.eip; 305 #endif 306 eip.Sel = DBGF_SEL_FLAT; 307 ebp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 308 ebp.FlatPtr = ebp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp; 309 ebp.Sel = DBGF_SEL_FLAT; 310 esp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID; 311 esp.Sel = DBGF_SEL_FLAT; 312 esp.FlatPtr = esp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp; 313 314 rc2 = DBGFR3StackWalkBeginEx(pVM, pVCpu->idCpu, DBGFCODETYPE_RING0, &ebp, &esp, &eip, 315 DBGFRETURNTYPE_INVALID, &pFirstFrame); 499 rc2 = DBGFR3StackWalkBegin(pVM, pVCpu->idCpu, DBGFCODETYPE_HYPER, &pFirstFrame); 316 500 if (RT_SUCCESS(rc2)) 317 501 { … … 352 536 DBGFR3StackWalkEnd(pFirstFrame); 353 537 } 354 #endif /* defined(RT_OS_WINDOWS) && HC_ARCH_BITS == 32 */355 }356 else357 {358 /*359 * Try figure out where eip is.360 */361 /* core code? */362 if (uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC < pVM->vmm.s.cbCoreCode)363 pHlp->pfnPrintf(pHlp,364 "!! EIP is in CoreCode, offset %#x\n",365 uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC);366 else367 { /* ask PDM */ /** @todo ask DBGFR3Sym later? */368 char szModName[64];369 RTRCPTR RCPtrMod;370 char szNearSym1[260];371 RTRCPTR RCPtrNearSym1;372 char szNearSym2[260];373 RTRCPTR RCPtrNearSym2;374 int rc = PDMR3LdrQueryRCModFromPC(pVM, uEIP,375 &szModName[0], sizeof(szModName), &RCPtrMod,376 &szNearSym1[0], sizeof(szNearSym1), &RCPtrNearSym1,377 &szNearSym2[0], sizeof(szNearSym2), &RCPtrNearSym2);378 if (RT_SUCCESS(rc))379 pHlp->pfnPrintf(pHlp,380 "!! EIP in %s (%RRv) at rva %x near symbols:\n"381 "!! %RRv rva %RRv off %08x %s\n"382 "!! %RRv rva %RRv off -%08x %s\n",383 szModName, RCPtrMod, (unsigned)(uEIP - RCPtrMod),384 RCPtrNearSym1, RCPtrNearSym1 - RCPtrMod, (unsigned)(uEIP - RCPtrNearSym1), szNearSym1,385 RCPtrNearSym2, RCPtrNearSym2 - RCPtrMod, (unsigned)(RCPtrNearSym2 - uEIP), szNearSym2);386 else387 pHlp->pfnPrintf(pHlp,388 "!! EIP is not in any code known to VMM!\n");389 }390 391 /* Disassemble the instruction. */392 char szInstr[256];393 rc2 = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, 0, 0, DBGF_DISAS_FLAGS_CURRENT_HYPER, &szInstr[0], sizeof(szInstr), NULL);394 if (RT_SUCCESS(rc2))395 pHlp->pfnPrintf(pHlp,396 "!! %s\n", szInstr);397 398 /* Dump the hypervisor cpu state. */399 pHlp->pfnPrintf(pHlp,400 "!!\n"401 "!!\n"402 "!!\n");403 rc2 = DBGFR3Info(pVM, "cpumhyper", "verbose", pHlp);404 fDoneHyper = true;405 406 /* Callstack. */407 PCDBGFSTACKFRAME pFirstFrame;408 rc2 = DBGFR3StackWalkBegin(pVM, pVCpu->idCpu, DBGFCODETYPE_HYPER, &pFirstFrame);409 if (RT_SUCCESS(rc2))410 {411 pHlp->pfnPrintf(pHlp,412 "!!\n"413 "!! Call Stack:\n"414 "!!\n"415 "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n");416 for (PCDBGFSTACKFRAME pFrame = pFirstFrame;417 pFrame;418 pFrame = DBGFR3StackWalkNext(pFrame))419 {420 pHlp->pfnPrintf(pHlp,421 "%08RX32 %08RX32 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32",422 (uint32_t)pFrame->AddrFrame.off,423 (uint32_t)pFrame->AddrReturnFrame.off,424 (uint32_t)pFrame->AddrReturnPC.Sel,425 (uint32_t)pFrame->AddrReturnPC.off,426 pFrame->Args.au32[0],427 pFrame->Args.au32[1],428 pFrame->Args.au32[2],429 pFrame->Args.au32[3]);430 pHlp->pfnPrintf(pHlp, " %RTsel:%08RGv", pFrame->AddrPC.Sel, pFrame->AddrPC.off);431 if (pFrame->pSymPC)432 {433 RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value;434 if (offDisp > 0)435 pHlp->pfnPrintf(pHlp, " %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp);436 else if (offDisp < 0)437 pHlp->pfnPrintf(pHlp, " %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp);438 else439 pHlp->pfnPrintf(pHlp, " %s", pFrame->pSymPC->szName);440 }441 if (pFrame->pLinePC)442 pHlp->pfnPrintf(pHlp, " [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo);443 pHlp->pfnPrintf(pHlp, "\n");444 }445 DBGFR3StackWalkEnd(pFirstFrame);446 }447 538 448 539 /* raw stack */ … … 519 610 */ 520 611 vmmR3FatalDumpInfoHlpDelete(&Hlp); 521 522 /*523 * Reset the ring-0 long jump buffer and stack.524 */525 pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call = 0;526 #ifdef RT_ARCH_X86527 pVCpu->vmm.s.CallRing3JmpBufR0.eip = 0;528 #else529 pVCpu->vmm.s.CallRing3JmpBufR0.rip = 0;530 #endif531 *(uint64_t *)pVCpu->vmm.s.pbEMTStackR3 = 0; /* clear marker */532 612 } 533 613
Note:
See TracChangeset
for help on using the changeset viewer.