VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMGuruMeditation.cpp@ 30441

Last change on this file since 30441 was 30083, checked in by vboxsync, 15 years ago

Guru: adjustments/fixes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 26.0 KB
Line 
1/* $Id: VMMGuruMeditation.cpp 30083 2010-06-07 16:19:26Z vboxsync $ */
2/** @file
3 * VMM - The Virtual Machine Monitor, Guru Meditation Code.
4 */
5
6/*
7 * Copyright (C) 2006-2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#define LOG_GROUP LOG_GROUP_VMM
22#include <VBox/vmm.h>
23#include <VBox/pdmapi.h>
24#include <VBox/pdmcritsect.h>
25#include <VBox/trpm.h>
26#include <VBox/dbgf.h>
27#include "VMMInternal.h"
28#include <VBox/vm.h>
29#include <VBox/mm.h>
30#include <VBox/iom.h>
31#include <VBox/em.h>
32
33#include <VBox/err.h>
34#include <VBox/param.h>
35#include <VBox/version.h>
36#include <VBox/hwaccm.h>
37#include <iprt/assert.h>
38#include <iprt/time.h>
39#include <iprt/stream.h>
40#include <iprt/string.h>
41#include <iprt/stdarg.h>
42
43
44/*******************************************************************************
45* Structures and Typedefs *
46*******************************************************************************/
47/**
48 * Structure to pass to DBGFR3Info() and for doing all other
49 * output during fatal dump.
50 */
51typedef struct VMMR3FATALDUMPINFOHLP
52{
53 /** The helper core. */
54 DBGFINFOHLP Core;
55 /** The release logger instance. */
56 PRTLOGGER pRelLogger;
57 /** The saved release logger flags. */
58 RTUINT fRelLoggerFlags;
59 /** The logger instance. */
60 PRTLOGGER pLogger;
61 /** The saved logger flags. */
62 RTUINT fLoggerFlags;
63 /** The saved logger destination flags. */
64 RTUINT fLoggerDestFlags;
65 /** Whether to output to stderr or not. */
66 bool fStdErr;
67} VMMR3FATALDUMPINFOHLP, *PVMMR3FATALDUMPINFOHLP;
68/** Pointer to a VMMR3FATALDUMPINFOHLP structure. */
69typedef const VMMR3FATALDUMPINFOHLP *PCVMMR3FATALDUMPINFOHLP;
70
71
72/**
73 * Print formatted string.
74 *
75 * @param pHlp Pointer to this structure.
76 * @param pszFormat The format string.
77 * @param ... Arguments.
78 */
79static DECLCALLBACK(void) vmmR3FatalDumpInfoHlp_pfnPrintf(PCDBGFINFOHLP pHlp, const char *pszFormat, ...)
80{
81 va_list args;
82 va_start(args, pszFormat);
83 pHlp->pfnPrintfV(pHlp, pszFormat, args);
84 va_end(args);
85}
86
87
88/**
89 * Print formatted string.
90 *
91 * @param pHlp Pointer to this structure.
92 * @param pszFormat The format string.
93 * @param args Argument list.
94 */
95static DECLCALLBACK(void) vmmR3FatalDumpInfoHlp_pfnPrintfV(PCDBGFINFOHLP pHlp, const char *pszFormat, va_list args)
96{
97 PCVMMR3FATALDUMPINFOHLP pMyHlp = (PCVMMR3FATALDUMPINFOHLP)pHlp;
98
99 if (pMyHlp->pRelLogger)
100 {
101 va_list args2;
102 va_copy(args2, args);
103 RTLogLoggerV(pMyHlp->pRelLogger, pszFormat, args2);
104 va_end(args2);
105 }
106 if (pMyHlp->pLogger)
107 {
108 va_list args2;
109 va_copy(args2, args);
110 RTLogLoggerV(pMyHlp->pLogger, pszFormat, args);
111 va_end(args2);
112 }
113 if (pMyHlp->fStdErr)
114 {
115 va_list args2;
116 va_copy(args2, args);
117 RTStrmPrintfV(g_pStdErr, pszFormat, args);
118 va_end(args2);
119 }
120}
121
122
123/**
124 * Initializes the fatal dump output helper.
125 *
126 * @param pHlp The structure to initialize.
127 */
128static void vmmR3FatalDumpInfoHlpInit(PVMMR3FATALDUMPINFOHLP pHlp)
129{
130 memset(pHlp, 0, sizeof(*pHlp));
131
132 pHlp->Core.pfnPrintf = vmmR3FatalDumpInfoHlp_pfnPrintf;
133 pHlp->Core.pfnPrintfV = vmmR3FatalDumpInfoHlp_pfnPrintfV;
134
135 /*
136 * The loggers.
137 */
138 pHlp->pRelLogger = RTLogRelDefaultInstance();
139#ifndef LOG_ENABLED
140 if (!pHlp->pRelLogger)
141#endif
142 pHlp->pLogger = RTLogDefaultInstance();
143
144 if (pHlp->pRelLogger)
145 {
146 pHlp->fRelLoggerFlags = pHlp->pRelLogger->fFlags;
147 pHlp->pRelLogger->fFlags &= ~(RTLOGFLAGS_BUFFERED | RTLOGFLAGS_DISABLED);
148 }
149
150 if (pHlp->pLogger)
151 {
152 pHlp->fLoggerFlags = pHlp->pLogger->fFlags;
153 pHlp->fLoggerDestFlags = pHlp->pLogger->fDestFlags;
154 pHlp->pLogger->fFlags &= ~(RTLOGFLAGS_BUFFERED | RTLOGFLAGS_DISABLED);
155#ifndef DEBUG_sandervl
156 pHlp->pLogger->fDestFlags |= RTLOGDEST_DEBUGGER;
157#endif
158 }
159
160 /*
161 * Check if we need write to stderr.
162 */
163#ifdef DEBUG_sandervl
164 pHlp->fStdErr = false; /* takes too long to display here */
165#else
166 pHlp->fStdErr = (!pHlp->pRelLogger || !(pHlp->pRelLogger->fDestFlags & (RTLOGDEST_STDOUT | RTLOGDEST_STDERR)))
167 && (!pHlp->pLogger || !(pHlp->pLogger->fDestFlags & (RTLOGDEST_STDOUT | RTLOGDEST_STDERR)));
168#endif
169}
170
171
172/**
173 * Deletes the fatal dump output helper.
174 *
175 * @param pHlp The structure to delete.
176 */
177static void vmmR3FatalDumpInfoHlpDelete(PVMMR3FATALDUMPINFOHLP pHlp)
178{
179 if (pHlp->pRelLogger)
180 {
181 RTLogFlush(pHlp->pRelLogger);
182 pHlp->pRelLogger->fFlags = pHlp->fRelLoggerFlags;
183 }
184
185 if (pHlp->pLogger)
186 {
187 RTLogFlush(pHlp->pLogger);
188 pHlp->pLogger->fFlags = pHlp->fLoggerFlags;
189 pHlp->pLogger->fDestFlags = pHlp->fLoggerDestFlags;
190 }
191}
192
193
194/**
195 * Dumps the VM state on a fatal error.
196 *
197 * @param pVM VM Handle.
198 * @param pVCpu VMCPU Handle.
199 * @param rcErr VBox status code.
200 */
201VMMR3DECL(void) VMMR3FatalDump(PVM pVM, PVMCPU pVCpu, int rcErr)
202{
203 /*
204 * Create our output helper and sync it with the log settings.
205 * This helper will be used for all the output.
206 */
207 VMMR3FATALDUMPINFOHLP Hlp;
208 PCDBGFINFOHLP pHlp = &Hlp.Core;
209 vmmR3FatalDumpInfoHlpInit(&Hlp);
210
211 /* Release owned locks to make sure other VCPUs can continue in case they were waiting for one. */
212 PDMR3CritSectLeaveAll(pVM);
213
214 /*
215 * Header.
216 */
217 pHlp->pfnPrintf(pHlp,
218 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
219 "!!\n"
220 "!! Guru Meditation %d (%Rrc)\n"
221 "!!\n",
222 rcErr, rcErr);
223
224 /*
225 * Continue according to context.
226 */
227 bool fDoneHyper = false;
228 switch (rcErr)
229 {
230 /*
231 * Hypervisor errors.
232 */
233 case VERR_VMM_RING0_ASSERTION:
234 case VINF_EM_DBG_HYPER_ASSERTION:
235 case VERR_VMM_RING3_CALL_DISABLED:
236 {
237 const char *pszMsg1 = VMMR3GetRZAssertMsg1(pVM);
238 while (pszMsg1 && *pszMsg1 == '\n')
239 pszMsg1++;
240 const char *pszMsg2 = VMMR3GetRZAssertMsg2(pVM);
241 while (pszMsg2 && *pszMsg2 == '\n')
242 pszMsg2++;
243 pHlp->pfnPrintf(pHlp,
244 "%s"
245 "%s",
246 pszMsg1,
247 pszMsg2);
248 if ( !pszMsg2
249 || !*pszMsg2
250 || strchr(pszMsg2, '\0')[-1] != '\n')
251 pHlp->pfnPrintf(pHlp, "\n");
252 /* fall thru */
253 }
254 case VERR_TRPM_DONT_PANIC:
255 case VERR_TRPM_PANIC:
256 case VINF_EM_RAW_STALE_SELECTOR:
257 case VINF_EM_RAW_IRET_TRAP:
258 case VINF_EM_DBG_HYPER_BREAKPOINT:
259 case VINF_EM_DBG_HYPER_STEPPED:
260 case VERR_VMM_HYPER_CR3_MISMATCH:
261 {
262 /*
263 * Active trap? This is only of partial interest when in hardware
264 * assisted virtualization mode, thus the different messages.
265 */
266 uint32_t uEIP = CPUMGetHyperEIP(pVCpu);
267 TRPMEVENT enmType;
268 uint8_t u8TrapNo = 0xce;
269 RTGCUINT uErrorCode = 0xdeadface;
270 RTGCUINTPTR uCR2 = 0xdeadface;
271 int rc2 = TRPMQueryTrapAll(pVCpu, &u8TrapNo, &enmType, &uErrorCode, &uCR2);
272 if (!HWACCMIsEnabled(pVM))
273 {
274 if (RT_SUCCESS(rc2))
275 pHlp->pfnPrintf(pHlp,
276 "!! TRAP=%02x ERRCD=%RGv CR2=%RGv EIP=%RX32 Type=%d\n",
277 u8TrapNo, uErrorCode, uCR2, uEIP, enmType);
278 else
279 pHlp->pfnPrintf(pHlp,
280 "!! EIP=%RX32 NOTRAP\n",
281 uEIP);
282 }
283 else if (RT_SUCCESS(rc2))
284 pHlp->pfnPrintf(pHlp,
285 "!! ACTIVE TRAP=%02x ERRCD=%RGv CR2=%RGv PC=%RGr Type=%d (Guest!)\n",
286 u8TrapNo, uErrorCode, uCR2, CPUMGetGuestRIP(pVCpu), enmType);
287
288 /*
289 * Dump the relevant hypervisor registers and stack.
290 */
291 if (HWACCMIsEnabled(pVM))
292 {
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\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 pHlp->pfnPrintf(pHlp,
308 "pvSavedStack=%RHv cbSavedStack=%#x fInRing3Call=%RTbool\n",
309 pVCpu->vmm.s.CallRing3JmpBufR0.pvSavedStack,
310 pVCpu->vmm.s.CallRing3JmpBufR0.cbSavedStack,
311 pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call);
312 pHlp->pfnPrintf(pHlp,
313 "cbUsedMax=%#x cbUsedAvg=%#x 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 /* Callstack. */
366 DBGFADDRESS pc;
367 pc.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID;
368#if HC_ARCH_BITS == 64
369 pc.FlatPtr = pc.off = pVCpu->vmm.s.CallRing3JmpBufR0.rip;
370#else
371 pc.FlatPtr = pc.off = pVCpu->vmm.s.CallRing3JmpBufR0.eip;
372#endif
373 pc.Sel = DBGF_SEL_FLAT;
374
375 DBGFADDRESS ebp;
376 ebp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID;
377 ebp.FlatPtr = ebp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEbp;
378 ebp.Sel = DBGF_SEL_FLAT;
379
380 DBGFADDRESS esp;
381 esp.fFlags = DBGFADDRESS_FLAGS_RING0 | DBGFADDRESS_FLAGS_VALID;
382 esp.Sel = DBGF_SEL_FLAT;
383 esp.FlatPtr = esp.off = pVCpu->vmm.s.CallRing3JmpBufR0.SavedEsp;
384
385 PCDBGFSTACKFRAME pFirstFrame;
386 rc2 = DBGFR3StackWalkBeginEx(pVM, pVCpu->idCpu, DBGFCODETYPE_RING0, &ebp, &esp, &pc,
387 DBGFRETURNTYPE_INVALID, &pFirstFrame);
388 if (RT_SUCCESS(rc2))
389 {
390 pHlp->pfnPrintf(pHlp,
391 "!!\n"
392 "!! Call Stack:\n"
393 "!!\n");
394#if HC_ARCH_BITS == 32
395 pHlp->pfnPrintf(pHlp, "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n");
396#else
397 pHlp->pfnPrintf(pHlp, "RBP Ret RBP Ret RIP RIP Symbol [line]\n");
398#endif
399 for (PCDBGFSTACKFRAME pFrame = pFirstFrame;
400 pFrame;
401 pFrame = DBGFR3StackWalkNext(pFrame))
402 {
403#if HC_ARCH_BITS == 32
404 pHlp->pfnPrintf(pHlp,
405 "%RHv %RHv %04RX32:%RHv %RHv %RHv %RHv %RHv",
406 (RTHCUINTPTR)pFrame->AddrFrame.off,
407 (RTHCUINTPTR)pFrame->AddrReturnFrame.off,
408 (RTHCUINTPTR)pFrame->AddrReturnPC.Sel,
409 (RTHCUINTPTR)pFrame->AddrReturnPC.off,
410 pFrame->Args.au32[0],
411 pFrame->Args.au32[1],
412 pFrame->Args.au32[2],
413 pFrame->Args.au32[3]);
414 pHlp->pfnPrintf(pHlp, " %RTsel:%08RHv", pFrame->AddrPC.Sel, pFrame->AddrPC.off);
415#else
416 pHlp->pfnPrintf(pHlp,
417 "%RHv %RHv %RHv %RHv",
418 (RTHCUINTPTR)pFrame->AddrFrame.off,
419 (RTHCUINTPTR)pFrame->AddrReturnFrame.off,
420 (RTHCUINTPTR)pFrame->AddrReturnPC.off,
421 (RTHCUINTPTR)pFrame->AddrPC.off);
422#endif
423 if (pFrame->pSymPC)
424 {
425 RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value;
426 if (offDisp > 0)
427 pHlp->pfnPrintf(pHlp, " %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp);
428 else if (offDisp < 0)
429 pHlp->pfnPrintf(pHlp, " %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp);
430 else
431 pHlp->pfnPrintf(pHlp, " %s", pFrame->pSymPC->szName);
432 }
433 if (pFrame->pLinePC)
434 pHlp->pfnPrintf(pHlp, " [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo);
435 pHlp->pfnPrintf(pHlp, "\n");
436 }
437 DBGFR3StackWalkEnd(pFirstFrame);
438 }
439
440 /* raw stack */
441 pHlp->pfnPrintf(pHlp,
442 "!!\n"
443 "!! Raw stack (mind the direction). \n"
444 "!! pbEMTStackR0=%RHv pbEMTStackBottomR0=%RHv VMM_STACK_SIZE=%#x\n"
445 "!! pbEmtStackR3=%p\n"
446 "!!\n"
447 "%.*Rhxd\n",
448 MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3),
449 MMHyperCCToR0(pVM, pVCpu->vmm.s.pbEMTStackR3) + VMM_STACK_SIZE,
450 VMM_STACK_SIZE,
451 pVCpu->vmm.s.pbEMTStackR3,
452 VMM_STACK_SIZE, pVCpu->vmm.s.pbEMTStackR3);
453 }
454 else
455 {
456 pHlp->pfnPrintf(pHlp,
457 "!! Skipping ring-0 registers and stack, rcErr=%Rrc\n", rcErr);
458 }
459 }
460 else
461 {
462 /*
463 * Try figure out where eip is.
464 */
465 /* core code? */
466 if (uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC < pVM->vmm.s.cbCoreCode)
467 pHlp->pfnPrintf(pHlp,
468 "!! EIP is in CoreCode, offset %#x\n",
469 uEIP - (RTGCUINTPTR)pVM->vmm.s.pvCoreCodeRC);
470 else
471 { /* ask PDM */ /** @todo ask DBGFR3Sym later? */
472 char szModName[64];
473 RTRCPTR RCPtrMod;
474 char szNearSym1[260];
475 RTRCPTR RCPtrNearSym1;
476 char szNearSym2[260];
477 RTRCPTR RCPtrNearSym2;
478 int rc = PDMR3LdrQueryRCModFromPC(pVM, uEIP,
479 &szModName[0], sizeof(szModName), &RCPtrMod,
480 &szNearSym1[0], sizeof(szNearSym1), &RCPtrNearSym1,
481 &szNearSym2[0], sizeof(szNearSym2), &RCPtrNearSym2);
482 if (RT_SUCCESS(rc))
483 pHlp->pfnPrintf(pHlp,
484 "!! EIP in %s (%RRv) at rva %x near symbols:\n"
485 "!! %RRv rva %RRv off %08x %s\n"
486 "!! %RRv rva %RRv off -%08x %s\n",
487 szModName, RCPtrMod, (unsigned)(uEIP - RCPtrMod),
488 RCPtrNearSym1, RCPtrNearSym1 - RCPtrMod, (unsigned)(uEIP - RCPtrNearSym1), szNearSym1,
489 RCPtrNearSym2, RCPtrNearSym2 - RCPtrMod, (unsigned)(RCPtrNearSym2 - uEIP), szNearSym2);
490 else
491 pHlp->pfnPrintf(pHlp,
492 "!! EIP is not in any code known to VMM!\n");
493 }
494
495 /* Disassemble the instruction. */
496 char szInstr[256];
497 rc2 = DBGFR3DisasInstrEx(pVM, pVCpu->idCpu, 0, 0, DBGF_DISAS_FLAGS_CURRENT_HYPER, &szInstr[0], sizeof(szInstr), NULL);
498 if (RT_SUCCESS(rc2))
499 pHlp->pfnPrintf(pHlp,
500 "!! %s\n", szInstr);
501
502 /* Dump the hypervisor cpu state. */
503 pHlp->pfnPrintf(pHlp,
504 "!!\n"
505 "!!\n"
506 "!!\n");
507 rc2 = DBGFR3Info(pVM, "cpumhyper", "verbose", pHlp);
508 fDoneHyper = true;
509
510 /* Callstack. */
511 PCDBGFSTACKFRAME pFirstFrame;
512 rc2 = DBGFR3StackWalkBegin(pVM, pVCpu->idCpu, DBGFCODETYPE_HYPER, &pFirstFrame);
513 if (RT_SUCCESS(rc2))
514 {
515 pHlp->pfnPrintf(pHlp,
516 "!!\n"
517 "!! Call Stack:\n"
518 "!!\n"
519 "EBP Ret EBP Ret CS:EIP Arg0 Arg1 Arg2 Arg3 CS:EIP Symbol [line]\n");
520 for (PCDBGFSTACKFRAME pFrame = pFirstFrame;
521 pFrame;
522 pFrame = DBGFR3StackWalkNext(pFrame))
523 {
524 pHlp->pfnPrintf(pHlp,
525 "%08RX32 %08RX32 %04RX32:%08RX32 %08RX32 %08RX32 %08RX32 %08RX32",
526 (uint32_t)pFrame->AddrFrame.off,
527 (uint32_t)pFrame->AddrReturnFrame.off,
528 (uint32_t)pFrame->AddrReturnPC.Sel,
529 (uint32_t)pFrame->AddrReturnPC.off,
530 pFrame->Args.au32[0],
531 pFrame->Args.au32[1],
532 pFrame->Args.au32[2],
533 pFrame->Args.au32[3]);
534 pHlp->pfnPrintf(pHlp, " %RTsel:%08RGv", pFrame->AddrPC.Sel, pFrame->AddrPC.off);
535 if (pFrame->pSymPC)
536 {
537 RTGCINTPTR offDisp = pFrame->AddrPC.FlatPtr - pFrame->pSymPC->Value;
538 if (offDisp > 0)
539 pHlp->pfnPrintf(pHlp, " %s+%llx", pFrame->pSymPC->szName, (int64_t)offDisp);
540 else if (offDisp < 0)
541 pHlp->pfnPrintf(pHlp, " %s-%llx", pFrame->pSymPC->szName, -(int64_t)offDisp);
542 else
543 pHlp->pfnPrintf(pHlp, " %s", pFrame->pSymPC->szName);
544 }
545 if (pFrame->pLinePC)
546 pHlp->pfnPrintf(pHlp, " [%s @ 0i%d]", pFrame->pLinePC->szFilename, pFrame->pLinePC->uLineNo);
547 pHlp->pfnPrintf(pHlp, "\n");
548 }
549 DBGFR3StackWalkEnd(pFirstFrame);
550 }
551
552 /* raw stack */
553 pHlp->pfnPrintf(pHlp,
554 "!!\n"
555 "!! Raw stack (mind the direction). pbEMTStackRC=%RRv pbEMTStackBottomRC=%RRv\n"
556 "!!\n"
557 "%.*Rhxd\n",
558 pVCpu->vmm.s.pbEMTStackRC, pVCpu->vmm.s.pbEMTStackBottomRC,
559 VMM_STACK_SIZE, pVCpu->vmm.s.pbEMTStackR3);
560 } /* !HWACCMIsEnabled */
561 break;
562 }
563
564 default:
565 {
566 break;
567 }
568
569 } /* switch (rcErr) */
570
571
572 /*
573 * Generic info dumper loop.
574 */
575 static struct
576 {
577 const char *pszInfo;
578 const char *pszArgs;
579 } const aInfo[] =
580 {
581 { "mappings", NULL },
582 { "hma", NULL },
583 { "cpumguest", "verbose" },
584 { "cpumguestinstr", "verbose" },
585 { "cpumhyper", "verbose" },
586 { "cpumhost", "verbose" },
587 { "mode", "all" },
588 { "cpuid", "verbose" },
589 { "handlers", "phys virt hyper stats" },
590 { "timers", NULL },
591 { "activetimers", NULL },
592 };
593 for (unsigned i = 0; i < RT_ELEMENTS(aInfo); i++)
594 {
595 if (fDoneHyper && !strcmp(aInfo[i].pszInfo, "cpumhyper"))
596 continue;
597 pHlp->pfnPrintf(pHlp,
598 "!!\n"
599 "!! {%s, %s}\n"
600 "!!\n",
601 aInfo[i].pszInfo, aInfo[i].pszArgs);
602 DBGFR3Info(pVM, aInfo[i].pszInfo, aInfo[i].pszArgs, pHlp);
603 }
604
605 /* All other info items */
606 DBGFR3InfoMulti(pVM,
607 "*",
608 "mappings|hma|cpum|cpumguest|cpumguestinstr|cpumhyper|cpumhost|mode|cpuid"
609 "|pgmpd|pgmcr3|timers|activetimers|handlers|help",
610 "!!\n"
611 "!! {%s}\n"
612 "!!\n",
613 pHlp);
614
615
616 /* done */
617 pHlp->pfnPrintf(pHlp,
618 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
619
620
621 /*
622 * Delete the output instance (flushing and restoring of flags).
623 */
624 vmmR3FatalDumpInfoHlpDelete(&Hlp);
625}
626
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette