1 | /** @file
|
---|
2 | * DBGF - Debugger Facility.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef VBOX_INCLUDED_vmm_dbgf_h
|
---|
37 | #define VBOX_INCLUDED_vmm_dbgf_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <VBox/types.h>
|
---|
43 | #include <VBox/log.h> /* LOG_ENABLED */
|
---|
44 | #include <VBox/vmm/vmm.h>
|
---|
45 | #include <VBox/vmm/dbgfsel.h>
|
---|
46 |
|
---|
47 | #include <iprt/stdarg.h>
|
---|
48 | #include <iprt/dbg.h>
|
---|
49 |
|
---|
50 | RT_C_DECLS_BEGIN
|
---|
51 |
|
---|
52 |
|
---|
53 | /** @defgroup grp_dbgf The Debugger Facility API
|
---|
54 | * @ingroup grp_vmm
|
---|
55 | * @{
|
---|
56 | */
|
---|
57 |
|
---|
58 | /** @defgroup grp_dbgf_r0 The R0 DBGF API
|
---|
59 | * @{
|
---|
60 | */
|
---|
61 | VMMR0_INT_DECL(void) DBGFR0InitPerVMData(PGVM pGVM);
|
---|
62 | VMMR0_INT_DECL(void) DBGFR0CleanupVM(PGVM pGVM);
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Request buffer for DBGFR0TracerCreateReqHandler / VMMR0_DO_DBGF_TRACER_CREATE.
|
---|
66 | * @see DBGFR0TracerCreateReqHandler.
|
---|
67 | */
|
---|
68 | typedef struct DBGFTRACERCREATEREQ
|
---|
69 | {
|
---|
70 | /** The header. */
|
---|
71 | SUPVMMR0REQHDR Hdr;
|
---|
72 | /** Out: Where to return the address of the ring-3 tracer instance. */
|
---|
73 | PDBGFTRACERINSR3 pTracerInsR3;
|
---|
74 |
|
---|
75 | /** Number of bytes for the shared event ring buffer. */
|
---|
76 | uint32_t cbRingBuf;
|
---|
77 |
|
---|
78 | /** Set if the raw-mode component is desired. */
|
---|
79 | bool fRCEnabled;
|
---|
80 | /** Explicit padding. */
|
---|
81 | bool afReserved[3];
|
---|
82 |
|
---|
83 | } DBGFTRACERCREATEREQ;
|
---|
84 | /** Pointer to a DBGFR0TracerCreate / VMMR0_DO_DBGF_TRACER_CREATE request buffer. */
|
---|
85 | typedef DBGFTRACERCREATEREQ *PDBGFTRACERCREATEREQ;
|
---|
86 |
|
---|
87 | VMMR0_INT_DECL(int) DBGFR0TracerCreateReqHandler(PGVM pGVM, PDBGFTRACERCREATEREQ pReq);
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Request buffer for DBGFR0BpInitReqHandler / VMMR0_DO_DBGF_BP_INIT and
|
---|
91 | * DBGFR0BpPortIoInitReqHandler / VMMR0_DO_DBGF_BP_PORTIO_INIT.
|
---|
92 | * @see DBGFR0BpInitReqHandler, DBGFR0BpPortIoInitReqHandler.
|
---|
93 | */
|
---|
94 | typedef struct DBGFBPINITREQ
|
---|
95 | {
|
---|
96 | /** The header. */
|
---|
97 | SUPVMMR0REQHDR Hdr;
|
---|
98 | /** Out: Ring-3 pointer of the L1 lookup table on success. */
|
---|
99 | R3PTRTYPE(volatile uint32_t *) paBpLocL1R3;
|
---|
100 | } DBGFBPINITREQ;
|
---|
101 | /** Pointer to a DBGFR0BpInitReqHandler / VMMR0_DO_DBGF_BP_INIT request buffer. */
|
---|
102 | typedef DBGFBPINITREQ *PDBGFBPINITREQ;
|
---|
103 |
|
---|
104 | VMMR0_INT_DECL(int) DBGFR0BpInitReqHandler(PGVM pGVM, PDBGFBPINITREQ pReq);
|
---|
105 | VMMR0_INT_DECL(int) DBGFR0BpPortIoInitReqHandler(PGVM pGVM, PDBGFBPINITREQ pReq);
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Request buffer for DBGFR0BpOwnerInitReqHandler / VMMR0_DO_DBGF_BP_OWNER_INIT.
|
---|
109 | * @see DBGFR0BpOwnerInitReqHandler.
|
---|
110 | */
|
---|
111 | typedef struct DBGFBPOWNERINITREQ
|
---|
112 | {
|
---|
113 | /** The header. */
|
---|
114 | SUPVMMR0REQHDR Hdr;
|
---|
115 | /** Out: Ring-3 pointer of the breakpoint owner table on success. */
|
---|
116 | R3PTRTYPE(void *) paBpOwnerR3;
|
---|
117 | } DBGFBPOWNERINITREQ;
|
---|
118 | /** Pointer to a DBGFR0BpOwnerInitReqHandler / VMMR0_DO_DBGF_BP_INIT request buffer. */
|
---|
119 | typedef DBGFBPOWNERINITREQ *PDBGFBPOWNERINITREQ;
|
---|
120 |
|
---|
121 | VMMR0_INT_DECL(int) DBGFR0BpOwnerInitReqHandler(PGVM pGVM, PDBGFBPOWNERINITREQ pReq);
|
---|
122 |
|
---|
123 | /**
|
---|
124 | * Request buffer for DBGFR0BpChunkAllocReqHandler / VMMR0_DO_DBGF_CHUNK_ALLOC.
|
---|
125 | * @see DBGFR0BpChunkAllocReqHandler.
|
---|
126 | */
|
---|
127 | typedef struct DBGFBPCHUNKALLOCREQ
|
---|
128 | {
|
---|
129 | /** The header. */
|
---|
130 | SUPVMMR0REQHDR Hdr;
|
---|
131 | /** Out: Ring-3 pointer of the chunk base on success. */
|
---|
132 | R3PTRTYPE(void *) pChunkBaseR3;
|
---|
133 |
|
---|
134 | /** The chunk ID to allocate. */
|
---|
135 | uint32_t idChunk;
|
---|
136 | } DBGFBPCHUNKALLOCREQ;
|
---|
137 | /** Pointer to a DBGFR0BpChunkAllocReqHandler / VMMR0_DO_DBGF_CHUNK_ALLOC request buffer. */
|
---|
138 | typedef DBGFBPCHUNKALLOCREQ *PDBGFBPCHUNKALLOCREQ;
|
---|
139 |
|
---|
140 | VMMR0_INT_DECL(int) DBGFR0BpChunkAllocReqHandler(PGVM pGVM, PDBGFBPCHUNKALLOCREQ pReq);
|
---|
141 |
|
---|
142 | /**
|
---|
143 | * Request buffer for DBGFR0BpL2TblChunkAllocReqHandler / VMMR0_DO_DBGF_L2_TBL_CHUNK_ALLOC.
|
---|
144 | * @see DBGFR0BpL2TblChunkAllocReqHandler.
|
---|
145 | */
|
---|
146 | typedef struct DBGFBPL2TBLCHUNKALLOCREQ
|
---|
147 | {
|
---|
148 | /** The header. */
|
---|
149 | SUPVMMR0REQHDR Hdr;
|
---|
150 | /** Out: Ring-3 pointer of the chunk base on success. */
|
---|
151 | R3PTRTYPE(void *) pChunkBaseR3;
|
---|
152 |
|
---|
153 | /** The chunk ID to allocate. */
|
---|
154 | uint32_t idChunk;
|
---|
155 | } DBGFBPL2TBLCHUNKALLOCREQ;
|
---|
156 | /** Pointer to a DBGFR0BpChunkAllocReqHandler / VMMR0_DO_DBGF_L2_TBL_CHUNK_ALLOC request buffer. */
|
---|
157 | typedef DBGFBPL2TBLCHUNKALLOCREQ *PDBGFBPL2TBLCHUNKALLOCREQ;
|
---|
158 |
|
---|
159 | VMMR0_INT_DECL(int) DBGFR0BpL2TblChunkAllocReqHandler(PGVM pGVM, PDBGFBPL2TBLCHUNKALLOCREQ pReq);
|
---|
160 | /** @} */
|
---|
161 |
|
---|
162 |
|
---|
163 | #ifdef IN_RING3
|
---|
164 |
|
---|
165 | /**
|
---|
166 | * Mixed address.
|
---|
167 | */
|
---|
168 | typedef struct DBGFADDRESS
|
---|
169 | {
|
---|
170 | /** The flat address. */
|
---|
171 | RTGCUINTPTR FlatPtr;
|
---|
172 | /** The selector offset address. */
|
---|
173 | RTGCUINTPTR off;
|
---|
174 | /** The selector. DBGF_SEL_FLAT is a legal value. */
|
---|
175 | RTSEL Sel;
|
---|
176 | /** Flags describing further details about the address. */
|
---|
177 | uint16_t fFlags;
|
---|
178 | } DBGFADDRESS;
|
---|
179 | /** Pointer to a mixed address. */
|
---|
180 | typedef DBGFADDRESS *PDBGFADDRESS;
|
---|
181 | /** Pointer to a const mixed address. */
|
---|
182 | typedef const DBGFADDRESS *PCDBGFADDRESS;
|
---|
183 |
|
---|
184 | /** @name DBGFADDRESS Flags.
|
---|
185 | * @{ */
|
---|
186 | /** A 16:16 far address. */
|
---|
187 | #define DBGFADDRESS_FLAGS_FAR16 0
|
---|
188 | /** A 16:32 far address. */
|
---|
189 | #define DBGFADDRESS_FLAGS_FAR32 1
|
---|
190 | /** A 16:64 far address. */
|
---|
191 | #define DBGFADDRESS_FLAGS_FAR64 2
|
---|
192 | /** A flat address. */
|
---|
193 | #define DBGFADDRESS_FLAGS_FLAT 3
|
---|
194 | /** A physical address. */
|
---|
195 | #define DBGFADDRESS_FLAGS_PHYS 4
|
---|
196 | /** A ring-0 host address (internal use only). */
|
---|
197 | #define DBGFADDRESS_FLAGS_RING0 5
|
---|
198 | /** The address type mask. */
|
---|
199 | #define DBGFADDRESS_FLAGS_TYPE_MASK 7
|
---|
200 |
|
---|
201 | /** Set if the address is valid. */
|
---|
202 | #define DBGFADDRESS_FLAGS_VALID RT_BIT(3)
|
---|
203 |
|
---|
204 | /** Checks if the mixed address is flat or not. */
|
---|
205 | #define DBGFADDRESS_IS_FLAT(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FLAT )
|
---|
206 | /** Checks if the mixed address is flat or not. */
|
---|
207 | #define DBGFADDRESS_IS_PHYS(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_PHYS )
|
---|
208 | /** Checks if the mixed address is far 16:16 or not. */
|
---|
209 | #define DBGFADDRESS_IS_FAR16(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR16 )
|
---|
210 | /** Checks if the mixed address is far 16:32 or not. */
|
---|
211 | #define DBGFADDRESS_IS_FAR32(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR32 )
|
---|
212 | /** Checks if the mixed address is far 16:64 or not. */
|
---|
213 | #define DBGFADDRESS_IS_FAR64(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR64 )
|
---|
214 | /** Checks if the mixed address is any kind of far address. */
|
---|
215 | #define DBGFADDRESS_IS_FAR(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) <= DBGFADDRESS_FLAGS_FAR64 )
|
---|
216 | /** Checks if the mixed address host context ring-0 (special). */
|
---|
217 | #define DBGFADDRESS_IS_R0_HC(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_RING0 )
|
---|
218 | /** Checks if the mixed address a virtual guest context address (incl HMA). */
|
---|
219 | #define DBGFADDRESS_IS_VIRT_GC(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) <= DBGFADDRESS_FLAGS_FLAT )
|
---|
220 | /** Checks if the mixed address is valid. */
|
---|
221 | #define DBGFADDRESS_IS_VALID(pAddress) RT_BOOL((pAddress)->fFlags & DBGFADDRESS_FLAGS_VALID)
|
---|
222 | /** @} */
|
---|
223 |
|
---|
224 | VMMR3DECL(int) DBGFR3AddrFromSelOff(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off);
|
---|
225 | VMMR3DECL(int) DBGFR3AddrFromSelInfoOff(PUVM pUVM, PDBGFADDRESS pAddress, PCDBGFSELINFO pSelInfo, RTUINTPTR off);
|
---|
226 | VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromFlat(PUVM pUVM, PDBGFADDRESS pAddress, RTGCUINTPTR FlatPtr);
|
---|
227 | VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromPhys(PUVM pUVM, PDBGFADDRESS pAddress, RTGCPHYS PhysAddr);
|
---|
228 | VMMR3_INT_DECL(PDBGFADDRESS) DBGFR3AddrFromHostR0(PDBGFADDRESS pAddress, RTR0UINTPTR R0Ptr);
|
---|
229 | VMMR3DECL(bool) DBGFR3AddrIsValid(PUVM pUVM, PCDBGFADDRESS pAddress);
|
---|
230 | VMMR3DECL(int) DBGFR3AddrToPhys(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, PRTGCPHYS pGCPhys);
|
---|
231 | VMMR3DECL(int) DBGFR3AddrToHostPhys(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys);
|
---|
232 | VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr);
|
---|
233 | VMMR3DECL(PDBGFADDRESS) DBGFR3AddrAdd(PDBGFADDRESS pAddress, RTGCUINTPTR uAddend);
|
---|
234 | VMMR3DECL(PDBGFADDRESS) DBGFR3AddrSub(PDBGFADDRESS pAddress, RTGCUINTPTR uSubtrahend);
|
---|
235 |
|
---|
236 | #endif /* IN_RING3 */
|
---|
237 |
|
---|
238 |
|
---|
239 |
|
---|
240 | /**
|
---|
241 | * VMM Debug Event Type.
|
---|
242 | */
|
---|
243 | typedef enum DBGFEVENTTYPE
|
---|
244 | {
|
---|
245 | /** Halt completed.
|
---|
246 | * This notifies that a halt command have been successfully completed.
|
---|
247 | */
|
---|
248 | DBGFEVENT_HALT_DONE = 0,
|
---|
249 | /** Detach completed.
|
---|
250 | * This notifies that the detach command have been successfully completed.
|
---|
251 | */
|
---|
252 | DBGFEVENT_DETACH_DONE,
|
---|
253 | /** The command from the debugger is not recognized.
|
---|
254 | * This means internal error or half implemented features.
|
---|
255 | */
|
---|
256 | DBGFEVENT_INVALID_COMMAND,
|
---|
257 |
|
---|
258 | /** Fatal error.
|
---|
259 | * This notifies a fatal error in the VMM and that the debugger get's a
|
---|
260 | * chance to first hand information about the the problem.
|
---|
261 | */
|
---|
262 | DBGFEVENT_FATAL_ERROR,
|
---|
263 | /** Breakpoint Hit.
|
---|
264 | * This notifies that a breakpoint installed by the debugger was hit. The
|
---|
265 | * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
|
---|
266 | */
|
---|
267 | DBGFEVENT_BREAKPOINT,
|
---|
268 | /** I/O port breakpoint.
|
---|
269 | * @todo not yet implemented. */
|
---|
270 | DBGFEVENT_BREAKPOINT_IO,
|
---|
271 | /** MMIO breakpoint.
|
---|
272 | * @todo not yet implemented. */
|
---|
273 | DBGFEVENT_BREAKPOINT_MMIO,
|
---|
274 | /** Breakpoint Hit in the Hypervisor.
|
---|
275 | * This notifies that a breakpoint installed by the debugger was hit. The
|
---|
276 | * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
|
---|
277 | * @todo raw-mode: remove this
|
---|
278 | */
|
---|
279 | DBGFEVENT_BREAKPOINT_HYPER,
|
---|
280 | /** Assertion in the Hypervisor (breakpoint instruction).
|
---|
281 | * This notifies that a breakpoint instruction was hit in the hypervisor context.
|
---|
282 | */
|
---|
283 | DBGFEVENT_ASSERTION_HYPER,
|
---|
284 | /** Single Stepped.
|
---|
285 | * This notifies that a single step operation was completed.
|
---|
286 | */
|
---|
287 | DBGFEVENT_STEPPED,
|
---|
288 | /** Single Stepped.
|
---|
289 | * This notifies that a hypervisor single step operation was completed.
|
---|
290 | */
|
---|
291 | DBGFEVENT_STEPPED_HYPER,
|
---|
292 | /** The developer have used the DBGFSTOP macro or the PDMDeviceDBGFSTOP function
|
---|
293 | * to bring up the debugger at a specific place.
|
---|
294 | */
|
---|
295 | DBGFEVENT_DEV_STOP,
|
---|
296 | /** The VM is powering off.
|
---|
297 | * When this notification is received, the debugger thread should detach ASAP.
|
---|
298 | */
|
---|
299 | DBGFEVENT_POWERING_OFF,
|
---|
300 |
|
---|
301 | /** Hardware Interrupt break.
|
---|
302 | * @todo not yet implemented. */
|
---|
303 | DBGFEVENT_INTERRUPT_HARDWARE,
|
---|
304 | /** Software Interrupt break.
|
---|
305 | * @todo not yet implemented. */
|
---|
306 | DBGFEVENT_INTERRUPT_SOFTWARE,
|
---|
307 |
|
---|
308 | /** The first selectable event.
|
---|
309 | * Whether the debugger wants or doesn't want these events can be configured
|
---|
310 | * via DBGFR3xxx and queried via DBGFR3yyy. */
|
---|
311 | DBGFEVENT_FIRST_SELECTABLE,
|
---|
312 | /** Tripple fault. */
|
---|
313 | DBGFEVENT_TRIPLE_FAULT = DBGFEVENT_FIRST_SELECTABLE,
|
---|
314 |
|
---|
315 | /** @name Exception events
|
---|
316 | * The exception events normally represents guest exceptions, but depending on
|
---|
317 | * the execution mode some virtualization exceptions may occure (no nested
|
---|
318 | * paging, raw-mode, ++). When necessary, we will request additional VM exits.
|
---|
319 | * @{ */
|
---|
320 | DBGFEVENT_XCPT_FIRST, /**< The first exception event. */
|
---|
321 | DBGFEVENT_XCPT_DE /**< 0x00 - \#DE - Fault - NoErr - Integer divide error (zero/overflow). */
|
---|
322 | = DBGFEVENT_XCPT_FIRST,
|
---|
323 | DBGFEVENT_XCPT_DB, /**< 0x01 - \#DB - trap/fault - NoErr - debug event. */
|
---|
324 | DBGFEVENT_XCPT_02, /**< 0x02 - Reserved for NMI, see interrupt events. */
|
---|
325 | DBGFEVENT_XCPT_BP, /**< 0x03 - \#BP - Trap - NoErr - Breakpoint, INT 3 instruction. */
|
---|
326 | DBGFEVENT_XCPT_OF, /**< 0x04 - \#OF - Trap - NoErr - Overflow, INTO instruction. */
|
---|
327 | DBGFEVENT_XCPT_BR, /**< 0x05 - \#BR - Fault - NoErr - BOUND Range Exceeded, BOUND instruction. */
|
---|
328 | DBGFEVENT_XCPT_UD, /**< 0x06 - \#UD - Fault - NoErr - Undefined(/Invalid) Opcode. */
|
---|
329 | DBGFEVENT_XCPT_NM, /**< 0x07 - \#NM - Fault - NoErr - Device not available, FP or (F)WAIT instruction. */
|
---|
330 | DBGFEVENT_XCPT_DF, /**< 0x08 - \#DF - Abort - Err=0 - Double fault. */
|
---|
331 | DBGFEVENT_XCPT_09, /**< 0x09 - Int9 - Fault - NoErr - Coprocessor Segment Overrun (obsolete). */
|
---|
332 | DBGFEVENT_XCPT_TS, /**< 0x0a - \#TS - Fault - ErrCd - Invalid TSS, Taskswitch or TSS access. */
|
---|
333 | DBGFEVENT_XCPT_NP, /**< 0x0b - \#NP - Fault - ErrCd - Segment not present. */
|
---|
334 | DBGFEVENT_XCPT_SS, /**< 0x0c - \#SS - Fault - ErrCd - Stack-Segment fault. */
|
---|
335 | DBGFEVENT_XCPT_GP, /**< 0x0d - \#GP - Fault - ErrCd - General protection fault. */
|
---|
336 | DBGFEVENT_XCPT_PF, /**< 0x0e - \#PF - Fault - ErrCd - Page fault. - interrupt gate!!! */
|
---|
337 | DBGFEVENT_XCPT_0f, /**< 0x0f - Rsvd - Resvd - Resvd - Intel Reserved. */
|
---|
338 | DBGFEVENT_XCPT_MF, /**< 0x10 - \#MF - Fault - NoErr - x86 FPU Floating-Point Error (Math fault), FP or (F)WAIT instruction. */
|
---|
339 | DBGFEVENT_XCPT_AC, /**< 0x11 - \#AC - Fault - Err=0 - Alignment Check. */
|
---|
340 | DBGFEVENT_XCPT_MC, /**< 0x12 - \#MC - Abort - NoErr - Machine Check. */
|
---|
341 | DBGFEVENT_XCPT_XF, /**< 0x13 - \#XF - Fault - NoErr - SIMD Floating-Point Exception. */
|
---|
342 | DBGFEVENT_XCPT_VE, /**< 0x14 - \#VE - Fault - Noerr - Virtualization exception. */
|
---|
343 | DBGFEVENT_XCPT_15, /**< 0x15 - Intel Reserved. */
|
---|
344 | DBGFEVENT_XCPT_16, /**< 0x16 - Intel Reserved. */
|
---|
345 | DBGFEVENT_XCPT_17, /**< 0x17 - Intel Reserved. */
|
---|
346 | DBGFEVENT_XCPT_18, /**< 0x18 - Intel Reserved. */
|
---|
347 | DBGFEVENT_XCPT_19, /**< 0x19 - Intel Reserved. */
|
---|
348 | DBGFEVENT_XCPT_1a, /**< 0x1a - Intel Reserved. */
|
---|
349 | DBGFEVENT_XCPT_1b, /**< 0x1b - Intel Reserved. */
|
---|
350 | DBGFEVENT_XCPT_1c, /**< 0x1c - Intel Reserved. */
|
---|
351 | DBGFEVENT_XCPT_1d, /**< 0x1d - Intel Reserved. */
|
---|
352 | DBGFEVENT_XCPT_SX, /**< 0x1e - \#SX - Fault - ErrCd - Security Exception. */
|
---|
353 | DBGFEVENT_XCPT_1f, /**< 0x1f - Intel Reserved. */
|
---|
354 | DBGFEVENT_XCPT_LAST /**< The last exception event. */
|
---|
355 | = DBGFEVENT_XCPT_1f,
|
---|
356 | /** @} */
|
---|
357 |
|
---|
358 | /** @name Instruction events
|
---|
359 | * The instruction events exerts all possible effort to intercept the
|
---|
360 | * relevant instructions. However, in some execution modes we won't be able
|
---|
361 | * to catch them. So it goes.
|
---|
362 | * @{ */
|
---|
363 | DBGFEVENT_INSTR_FIRST, /**< The first VM instruction event. */
|
---|
364 | DBGFEVENT_INSTR_HALT /**< Instruction: HALT */
|
---|
365 | = DBGFEVENT_INSTR_FIRST,
|
---|
366 | DBGFEVENT_INSTR_MWAIT, /**< Instruction: MWAIT */
|
---|
367 | DBGFEVENT_INSTR_MONITOR, /**< Instruction: MONITOR */
|
---|
368 | DBGFEVENT_INSTR_CPUID, /**< Instruction: CPUID (missing stuff in raw-mode). */
|
---|
369 | DBGFEVENT_INSTR_INVD, /**< Instruction: INVD */
|
---|
370 | DBGFEVENT_INSTR_WBINVD, /**< Instruction: WBINVD */
|
---|
371 | DBGFEVENT_INSTR_INVLPG, /**< Instruction: INVLPG */
|
---|
372 | DBGFEVENT_INSTR_RDTSC, /**< Instruction: RDTSC */
|
---|
373 | DBGFEVENT_INSTR_RDTSCP, /**< Instruction: RDTSCP */
|
---|
374 | DBGFEVENT_INSTR_RDPMC, /**< Instruction: RDPMC */
|
---|
375 | DBGFEVENT_INSTR_RDMSR, /**< Instruction: RDMSR */
|
---|
376 | DBGFEVENT_INSTR_WRMSR, /**< Instruction: WRMSR */
|
---|
377 | DBGFEVENT_INSTR_CRX_READ, /**< Instruction: CRx read instruction (missing smsw in raw-mode, and reads in general in VT-x). */
|
---|
378 | DBGFEVENT_INSTR_CRX_WRITE, /**< Instruction: CRx write */
|
---|
379 | DBGFEVENT_INSTR_DRX_READ, /**< Instruction: DRx read */
|
---|
380 | DBGFEVENT_INSTR_DRX_WRITE, /**< Instruction: DRx write */
|
---|
381 | DBGFEVENT_INSTR_PAUSE, /**< Instruction: PAUSE instruction (not in raw-mode). */
|
---|
382 | DBGFEVENT_INSTR_XSETBV, /**< Instruction: XSETBV */
|
---|
383 | DBGFEVENT_INSTR_SIDT, /**< Instruction: SIDT */
|
---|
384 | DBGFEVENT_INSTR_LIDT, /**< Instruction: LIDT */
|
---|
385 | DBGFEVENT_INSTR_SGDT, /**< Instruction: SGDT */
|
---|
386 | DBGFEVENT_INSTR_LGDT, /**< Instruction: LGDT */
|
---|
387 | DBGFEVENT_INSTR_SLDT, /**< Instruction: SLDT */
|
---|
388 | DBGFEVENT_INSTR_LLDT, /**< Instruction: LLDT */
|
---|
389 | DBGFEVENT_INSTR_STR, /**< Instruction: STR */
|
---|
390 | DBGFEVENT_INSTR_LTR, /**< Instruction: LTR */
|
---|
391 | DBGFEVENT_INSTR_GETSEC, /**< Instruction: GETSEC */
|
---|
392 | DBGFEVENT_INSTR_RSM, /**< Instruction: RSM */
|
---|
393 | DBGFEVENT_INSTR_RDRAND, /**< Instruction: RDRAND */
|
---|
394 | DBGFEVENT_INSTR_RDSEED, /**< Instruction: RDSEED */
|
---|
395 | DBGFEVENT_INSTR_XSAVES, /**< Instruction: XSAVES */
|
---|
396 | DBGFEVENT_INSTR_XRSTORS, /**< Instruction: XRSTORS */
|
---|
397 | DBGFEVENT_INSTR_VMM_CALL, /**< Instruction: VMCALL (intel) or VMMCALL (AMD) */
|
---|
398 | DBGFEVENT_INSTR_LAST_COMMON /**< Instruction: the last common event. */
|
---|
399 | = DBGFEVENT_INSTR_VMM_CALL,
|
---|
400 | DBGFEVENT_INSTR_VMX_FIRST, /**< Instruction: VT-x - First. */
|
---|
401 | DBGFEVENT_INSTR_VMX_VMCLEAR /**< Instruction: VT-x VMCLEAR */
|
---|
402 | = DBGFEVENT_INSTR_VMX_FIRST,
|
---|
403 | DBGFEVENT_INSTR_VMX_VMLAUNCH, /**< Instruction: VT-x VMLAUNCH */
|
---|
404 | DBGFEVENT_INSTR_VMX_VMPTRLD, /**< Instruction: VT-x VMPTRLD */
|
---|
405 | DBGFEVENT_INSTR_VMX_VMPTRST, /**< Instruction: VT-x VMPTRST */
|
---|
406 | DBGFEVENT_INSTR_VMX_VMREAD, /**< Instruction: VT-x VMREAD */
|
---|
407 | DBGFEVENT_INSTR_VMX_VMRESUME, /**< Instruction: VT-x VMRESUME */
|
---|
408 | DBGFEVENT_INSTR_VMX_VMWRITE, /**< Instruction: VT-x VMWRITE */
|
---|
409 | DBGFEVENT_INSTR_VMX_VMXOFF, /**< Instruction: VT-x VMXOFF */
|
---|
410 | DBGFEVENT_INSTR_VMX_VMXON, /**< Instruction: VT-x VMXON */
|
---|
411 | DBGFEVENT_INSTR_VMX_VMFUNC, /**< Instruction: VT-x VMFUNC */
|
---|
412 | DBGFEVENT_INSTR_VMX_INVEPT, /**< Instruction: VT-x INVEPT */
|
---|
413 | DBGFEVENT_INSTR_VMX_INVVPID, /**< Instruction: VT-x INVVPID */
|
---|
414 | DBGFEVENT_INSTR_VMX_INVPCID, /**< Instruction: VT-x INVPCID */
|
---|
415 | DBGFEVENT_INSTR_VMX_LAST /**< Instruction: VT-x - Last. */
|
---|
416 | = DBGFEVENT_INSTR_VMX_INVPCID,
|
---|
417 | DBGFEVENT_INSTR_SVM_FIRST, /**< Instruction: AMD-V - first */
|
---|
418 | DBGFEVENT_INSTR_SVM_VMRUN /**< Instruction: AMD-V VMRUN */
|
---|
419 | = DBGFEVENT_INSTR_SVM_FIRST,
|
---|
420 | DBGFEVENT_INSTR_SVM_VMLOAD, /**< Instruction: AMD-V VMLOAD */
|
---|
421 | DBGFEVENT_INSTR_SVM_VMSAVE, /**< Instruction: AMD-V VMSAVE */
|
---|
422 | DBGFEVENT_INSTR_SVM_STGI, /**< Instruction: AMD-V STGI */
|
---|
423 | DBGFEVENT_INSTR_SVM_CLGI, /**< Instruction: AMD-V CLGI */
|
---|
424 | DBGFEVENT_INSTR_SVM_LAST /**< Instruction: The last ADM-V VM exit event. */
|
---|
425 | = DBGFEVENT_INSTR_SVM_CLGI,
|
---|
426 | DBGFEVENT_INSTR_LAST /**< Instruction: The last instruction event. */
|
---|
427 | = DBGFEVENT_INSTR_SVM_LAST,
|
---|
428 | /** @} */
|
---|
429 |
|
---|
430 |
|
---|
431 | /** @name VM exit events.
|
---|
432 | * VM exits events for VT-x and AMD-V execution mode. Many of the VM exits
|
---|
433 | * behind these events are also directly translated into instruction events, but
|
---|
434 | * the difference here is that the exit events will not try provoke the exits.
|
---|
435 | * @{ */
|
---|
436 | DBGFEVENT_EXIT_FIRST, /**< The first VM exit event. */
|
---|
437 | DBGFEVENT_EXIT_TASK_SWITCH /**< Exit: Task switch. */
|
---|
438 | = DBGFEVENT_EXIT_FIRST,
|
---|
439 | DBGFEVENT_EXIT_HALT, /**< Exit: HALT instruction. */
|
---|
440 | DBGFEVENT_EXIT_MWAIT, /**< Exit: MWAIT instruction. */
|
---|
441 | DBGFEVENT_EXIT_MONITOR, /**< Exit: MONITOR instruction. */
|
---|
442 | DBGFEVENT_EXIT_CPUID, /**< Exit: CPUID instruction (missing stuff in raw-mode). */
|
---|
443 | DBGFEVENT_EXIT_INVD, /**< Exit: INVD instruction. */
|
---|
444 | DBGFEVENT_EXIT_WBINVD, /**< Exit: WBINVD instruction. */
|
---|
445 | DBGFEVENT_EXIT_INVLPG, /**< Exit: INVLPG instruction. */
|
---|
446 | DBGFEVENT_EXIT_RDTSC, /**< Exit: RDTSC instruction. */
|
---|
447 | DBGFEVENT_EXIT_RDTSCP, /**< Exit: RDTSCP instruction. */
|
---|
448 | DBGFEVENT_EXIT_RDPMC, /**< Exit: RDPMC instruction. */
|
---|
449 | DBGFEVENT_EXIT_RDMSR, /**< Exit: RDMSR instruction. */
|
---|
450 | DBGFEVENT_EXIT_WRMSR, /**< Exit: WRMSR instruction. */
|
---|
451 | DBGFEVENT_EXIT_CRX_READ, /**< Exit: CRx read instruction (missing smsw in raw-mode, and reads in general in VT-x). */
|
---|
452 | DBGFEVENT_EXIT_CRX_WRITE, /**< Exit: CRx write instruction. */
|
---|
453 | DBGFEVENT_EXIT_DRX_READ, /**< Exit: DRx read instruction. */
|
---|
454 | DBGFEVENT_EXIT_DRX_WRITE, /**< Exit: DRx write instruction. */
|
---|
455 | DBGFEVENT_EXIT_PAUSE, /**< Exit: PAUSE instruction (not in raw-mode). */
|
---|
456 | DBGFEVENT_EXIT_XSETBV, /**< Exit: XSETBV instruction. */
|
---|
457 | DBGFEVENT_EXIT_SIDT, /**< Exit: SIDT instruction. */
|
---|
458 | DBGFEVENT_EXIT_LIDT, /**< Exit: LIDT instruction. */
|
---|
459 | DBGFEVENT_EXIT_SGDT, /**< Exit: SGDT instruction. */
|
---|
460 | DBGFEVENT_EXIT_LGDT, /**< Exit: LGDT instruction. */
|
---|
461 | DBGFEVENT_EXIT_SLDT, /**< Exit: SLDT instruction. */
|
---|
462 | DBGFEVENT_EXIT_LLDT, /**< Exit: LLDT instruction. */
|
---|
463 | DBGFEVENT_EXIT_STR, /**< Exit: STR instruction. */
|
---|
464 | DBGFEVENT_EXIT_LTR, /**< Exit: LTR instruction. */
|
---|
465 | DBGFEVENT_EXIT_GETSEC, /**< Exit: GETSEC instruction. */
|
---|
466 | DBGFEVENT_EXIT_RSM, /**< Exit: RSM instruction. */
|
---|
467 | DBGFEVENT_EXIT_RDRAND, /**< Exit: RDRAND instruction. */
|
---|
468 | DBGFEVENT_EXIT_RDSEED, /**< Exit: RDSEED instruction. */
|
---|
469 | DBGFEVENT_EXIT_XSAVES, /**< Exit: XSAVES instruction. */
|
---|
470 | DBGFEVENT_EXIT_XRSTORS, /**< Exit: XRSTORS instruction. */
|
---|
471 | DBGFEVENT_EXIT_VMM_CALL, /**< Exit: VMCALL (intel) or VMMCALL (AMD) instruction. */
|
---|
472 | DBGFEVENT_EXIT_LAST_COMMON /**< Exit: the last common event. */
|
---|
473 | = DBGFEVENT_EXIT_VMM_CALL,
|
---|
474 | DBGFEVENT_EXIT_VMX_FIRST, /**< Exit: VT-x - First. */
|
---|
475 | DBGFEVENT_EXIT_VMX_VMCLEAR /**< Exit: VT-x VMCLEAR instruction. */
|
---|
476 | = DBGFEVENT_EXIT_VMX_FIRST,
|
---|
477 | DBGFEVENT_EXIT_VMX_VMLAUNCH, /**< Exit: VT-x VMLAUNCH instruction. */
|
---|
478 | DBGFEVENT_EXIT_VMX_VMPTRLD, /**< Exit: VT-x VMPTRLD instruction. */
|
---|
479 | DBGFEVENT_EXIT_VMX_VMPTRST, /**< Exit: VT-x VMPTRST instruction. */
|
---|
480 | DBGFEVENT_EXIT_VMX_VMREAD, /**< Exit: VT-x VMREAD instruction. */
|
---|
481 | DBGFEVENT_EXIT_VMX_VMRESUME, /**< Exit: VT-x VMRESUME instruction. */
|
---|
482 | DBGFEVENT_EXIT_VMX_VMWRITE, /**< Exit: VT-x VMWRITE instruction. */
|
---|
483 | DBGFEVENT_EXIT_VMX_VMXOFF, /**< Exit: VT-x VMXOFF instruction. */
|
---|
484 | DBGFEVENT_EXIT_VMX_VMXON, /**< Exit: VT-x VMXON instruction. */
|
---|
485 | DBGFEVENT_EXIT_VMX_VMFUNC, /**< Exit: VT-x VMFUNC instruction. */
|
---|
486 | DBGFEVENT_EXIT_VMX_INVEPT, /**< Exit: VT-x INVEPT instruction. */
|
---|
487 | DBGFEVENT_EXIT_VMX_INVVPID, /**< Exit: VT-x INVVPID instruction. */
|
---|
488 | DBGFEVENT_EXIT_VMX_INVPCID, /**< Exit: VT-x INVPCID instruction. */
|
---|
489 | DBGFEVENT_EXIT_VMX_EPT_VIOLATION, /**< Exit: VT-x EPT violation. */
|
---|
490 | DBGFEVENT_EXIT_VMX_EPT_MISCONFIG, /**< Exit: VT-x EPT misconfiguration. */
|
---|
491 | DBGFEVENT_EXIT_VMX_VAPIC_ACCESS, /**< Exit: VT-x Virtual APIC page access. */
|
---|
492 | DBGFEVENT_EXIT_VMX_VAPIC_WRITE, /**< Exit: VT-x Virtual APIC write. */
|
---|
493 | DBGFEVENT_EXIT_VMX_LAST /**< Exit: VT-x - Last. */
|
---|
494 | = DBGFEVENT_EXIT_VMX_VAPIC_WRITE,
|
---|
495 | DBGFEVENT_EXIT_SVM_FIRST, /**< Exit: AMD-V - first */
|
---|
496 | DBGFEVENT_EXIT_SVM_VMRUN /**< Exit: AMD-V VMRUN instruction. */
|
---|
497 | = DBGFEVENT_EXIT_SVM_FIRST,
|
---|
498 | DBGFEVENT_EXIT_SVM_VMLOAD, /**< Exit: AMD-V VMLOAD instruction. */
|
---|
499 | DBGFEVENT_EXIT_SVM_VMSAVE, /**< Exit: AMD-V VMSAVE instruction. */
|
---|
500 | DBGFEVENT_EXIT_SVM_STGI, /**< Exit: AMD-V STGI instruction. */
|
---|
501 | DBGFEVENT_EXIT_SVM_CLGI, /**< Exit: AMD-V CLGI instruction. */
|
---|
502 | DBGFEVENT_EXIT_SVM_LAST /**< Exit: The last ADM-V VM exit event. */
|
---|
503 | = DBGFEVENT_EXIT_SVM_CLGI,
|
---|
504 | DBGFEVENT_EXIT_LAST /**< Exit: The last VM exit event. */
|
---|
505 | = DBGFEVENT_EXIT_SVM_LAST,
|
---|
506 | /** @} */
|
---|
507 |
|
---|
508 |
|
---|
509 | /** @name Misc VT-x and AMD-V execution events.
|
---|
510 | * @{ */
|
---|
511 | DBGFEVENT_VMX_SPLIT_LOCK, /**< VT-x: Split-lock \#AC triggered by host having detection enabled. */
|
---|
512 | /** @} */
|
---|
513 |
|
---|
514 |
|
---|
515 | /** Access to an unassigned I/O port.
|
---|
516 | * @todo not yet implemented. */
|
---|
517 | DBGFEVENT_IOPORT_UNASSIGNED,
|
---|
518 | /** Access to an unused I/O port on a device.
|
---|
519 | * @todo not yet implemented. */
|
---|
520 | DBGFEVENT_IOPORT_UNUSED,
|
---|
521 | /** Unassigned memory event.
|
---|
522 | * @todo not yet implemented. */
|
---|
523 | DBGFEVENT_MEMORY_UNASSIGNED,
|
---|
524 | /** Attempt to write to unshadowed ROM.
|
---|
525 | * @todo not yet implemented. */
|
---|
526 | DBGFEVENT_MEMORY_ROM_WRITE,
|
---|
527 |
|
---|
528 | /** Windows guest reported BSOD via hyperv MSRs. */
|
---|
529 | DBGFEVENT_BSOD_MSR,
|
---|
530 | /** Windows guest reported BSOD via EFI variables. */
|
---|
531 | DBGFEVENT_BSOD_EFI,
|
---|
532 | /** Windows guest reported BSOD via VMMDev. */
|
---|
533 | DBGFEVENT_BSOD_VMMDEV,
|
---|
534 |
|
---|
535 | /** End of valid event values. */
|
---|
536 | DBGFEVENT_END,
|
---|
537 | /** The usual 32-bit hack. */
|
---|
538 | DBGFEVENT_32BIT_HACK = 0x7fffffff
|
---|
539 | } DBGFEVENTTYPE;
|
---|
540 | AssertCompile(DBGFEVENT_XCPT_LAST - DBGFEVENT_XCPT_FIRST == 0x1f);
|
---|
541 |
|
---|
542 | /**
|
---|
543 | * The context of an event.
|
---|
544 | */
|
---|
545 | typedef enum DBGFEVENTCTX
|
---|
546 | {
|
---|
547 | /** The usual invalid entry. */
|
---|
548 | DBGFEVENTCTX_INVALID = 0,
|
---|
549 | /** Raw mode. */
|
---|
550 | DBGFEVENTCTX_RAW,
|
---|
551 | /** Recompiled mode. */
|
---|
552 | DBGFEVENTCTX_REM,
|
---|
553 | /** VMX / AVT mode. */
|
---|
554 | DBGFEVENTCTX_HM,
|
---|
555 | /** Hypervisor context. */
|
---|
556 | DBGFEVENTCTX_HYPER,
|
---|
557 | /** Other mode */
|
---|
558 | DBGFEVENTCTX_OTHER,
|
---|
559 |
|
---|
560 | /** The usual 32-bit hack */
|
---|
561 | DBGFEVENTCTX_32BIT_HACK = 0x7fffffff
|
---|
562 | } DBGFEVENTCTX;
|
---|
563 |
|
---|
564 | /**
|
---|
565 | * VMM Debug Event.
|
---|
566 | */
|
---|
567 | typedef struct DBGFEVENT
|
---|
568 | {
|
---|
569 | /** Type. */
|
---|
570 | DBGFEVENTTYPE enmType;
|
---|
571 | /** Context */
|
---|
572 | DBGFEVENTCTX enmCtx;
|
---|
573 | /** The vCPU/EMT which generated the event. */
|
---|
574 | VMCPUID idCpu;
|
---|
575 | /** Reserved. */
|
---|
576 | uint32_t uReserved;
|
---|
577 | /** Type specific data. */
|
---|
578 | union
|
---|
579 | {
|
---|
580 | /** Fatal error details. */
|
---|
581 | struct
|
---|
582 | {
|
---|
583 | /** The GC return code. */
|
---|
584 | int rc;
|
---|
585 | } FatalError;
|
---|
586 |
|
---|
587 | /** Source location. */
|
---|
588 | struct
|
---|
589 | {
|
---|
590 | /** File name. */
|
---|
591 | R3PTRTYPE(const char *) pszFile;
|
---|
592 | /** Function name. */
|
---|
593 | R3PTRTYPE(const char *) pszFunction;
|
---|
594 | /** Message. */
|
---|
595 | R3PTRTYPE(const char *) pszMessage;
|
---|
596 | /** Line number. */
|
---|
597 | unsigned uLine;
|
---|
598 | } Src;
|
---|
599 |
|
---|
600 | /** Assertion messages. */
|
---|
601 | struct
|
---|
602 | {
|
---|
603 | /** The first message. */
|
---|
604 | R3PTRTYPE(const char *) pszMsg1;
|
---|
605 | /** The second message. */
|
---|
606 | R3PTRTYPE(const char *) pszMsg2;
|
---|
607 | } Assert;
|
---|
608 |
|
---|
609 | /** Breakpoint. */
|
---|
610 | struct DBGFEVENTBP
|
---|
611 | {
|
---|
612 | /** The handle of the breakpoint which was hit. */
|
---|
613 | DBGFBP hBp;
|
---|
614 | } Bp;
|
---|
615 |
|
---|
616 | /** Generic debug event. */
|
---|
617 | struct DBGFEVENTGENERIC
|
---|
618 | {
|
---|
619 | /** Number of arguments. */
|
---|
620 | uint8_t cArgs;
|
---|
621 | /** Alignment padding. */
|
---|
622 | uint8_t uPadding[7];
|
---|
623 | /** Arguments. */
|
---|
624 | uint64_t auArgs[5];
|
---|
625 | } Generic;
|
---|
626 |
|
---|
627 | /** Padding for ensuring that the structure is 8 byte aligned. */
|
---|
628 | uint64_t au64Padding[6];
|
---|
629 | } u;
|
---|
630 | } DBGFEVENT;
|
---|
631 | AssertCompileSizeAlignment(DBGFEVENT, 8);
|
---|
632 | AssertCompileSize(DBGFEVENT, 64);
|
---|
633 | /** Pointer to VMM Debug Event. */
|
---|
634 | typedef DBGFEVENT *PDBGFEVENT;
|
---|
635 | /** Pointer to const VMM Debug Event. */
|
---|
636 | typedef const DBGFEVENT *PCDBGFEVENT;
|
---|
637 |
|
---|
638 | #ifdef IN_RING3 /* The event API only works in ring-3. */
|
---|
639 |
|
---|
640 | /** @def DBGFSTOP
|
---|
641 | * Stops the debugger raising a DBGFEVENT_DEVELOPER_STOP event.
|
---|
642 | *
|
---|
643 | * @returns VBox status code which must be propagated up to EM if not VINF_SUCCESS.
|
---|
644 | * @param pVM The cross context VM structure.
|
---|
645 | */
|
---|
646 | # ifdef VBOX_STRICT
|
---|
647 | # define DBGFSTOP(pVM) DBGFR3EventSrc(pVM, DBGFEVENT_DEV_STOP, __FILE__, __LINE__, __PRETTY_FUNCTION__, NULL)
|
---|
648 | # else
|
---|
649 | # define DBGFSTOP(pVM) VINF_SUCCESS
|
---|
650 | # endif
|
---|
651 |
|
---|
652 | VMMR3_INT_DECL(int) DBGFR3Init(PVM pVM);
|
---|
653 | VMMR3_INT_DECL(int) DBGFR3Term(PVM pVM);
|
---|
654 | VMMR3DECL(void) DBGFR3TermUVM(PUVM pUVM);
|
---|
655 | VMMR3_INT_DECL(void) DBGFR3PowerOff(PVM pVM);
|
---|
656 | VMMR3_INT_DECL(void) DBGFR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
657 |
|
---|
658 | VMMR3_INT_DECL(int) DBGFR3VMMForcedAction(PVM pVM, PVMCPU pVCpu);
|
---|
659 | VMMR3_INT_DECL(VBOXSTRICTRC) DBGFR3EventHandlePending(PVM pVM, PVMCPU pVCpu);
|
---|
660 | VMMR3DECL(int) DBGFR3Event(PVM pVM, DBGFEVENTTYPE enmEvent);
|
---|
661 | VMMR3DECL(int) DBGFR3EventSrc(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine,
|
---|
662 | const char *pszFunction, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 7);
|
---|
663 | VMMR3DECL(int) DBGFR3EventSrcV(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine,
|
---|
664 | const char *pszFunction, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 0);
|
---|
665 | VMMR3_INT_DECL(int) DBGFR3EventAssertion(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszMsg1, const char *pszMsg2);
|
---|
666 | VMMR3_INT_DECL(int) DBGFR3EventBreakpoint(PVM pVM, DBGFEVENTTYPE enmEvent);
|
---|
667 |
|
---|
668 | VMMR3_INT_DECL(int) DBGFR3PrgStep(PVMCPU pVCpu);
|
---|
669 |
|
---|
670 | VMMR3DECL(int) DBGFR3Attach(PUVM pUVM);
|
---|
671 | VMMR3DECL(int) DBGFR3Detach(PUVM pUVM);
|
---|
672 | VMMR3DECL(int) DBGFR3EventWait(PUVM pUVM, RTMSINTERVAL cMillies, PDBGFEVENT pEvent);
|
---|
673 | VMMR3DECL(int) DBGFR3Halt(PUVM pUVM, VMCPUID idCpu);
|
---|
674 | VMMR3DECL(bool) DBGFR3IsHalted(PUVM pUVM, VMCPUID idCpu);
|
---|
675 | VMMR3DECL(int) DBGFR3QueryWaitable(PUVM pUVM);
|
---|
676 | VMMR3DECL(int) DBGFR3Resume(PUVM pUVM, VMCPUID idCpu);
|
---|
677 | VMMR3DECL(int) DBGFR3InjectNMI(PUVM pUVM, VMCPUID idCpu);
|
---|
678 | VMMR3DECL(int) DBGFR3Step(PUVM pUVM, VMCPUID idCpu);
|
---|
679 | VMMR3DECL(int) DBGFR3StepEx(PUVM pUVM, VMCPUID idCpu, uint32_t fFlags, PCDBGFADDRESS pStopPcAddr,
|
---|
680 | PCDBGFADDRESS pStopPopAddr, RTGCUINTPTR cbStopPop, uint32_t cMaxSteps);
|
---|
681 |
|
---|
682 | /** @name DBGF_STEP_F_XXX - Flags for DBGFR3StepEx.
|
---|
683 | *
|
---|
684 | * @note The stop filters are not applied to the starting instruction.
|
---|
685 | *
|
---|
686 | * @{ */
|
---|
687 | /** Step into CALL, INT, SYSCALL and SYSENTER instructions. */
|
---|
688 | #define DBGF_STEP_F_INTO RT_BIT_32(0)
|
---|
689 | /** Step over CALL, INT, SYSCALL and SYSENTER instruction when considering
|
---|
690 | * what's "next". */
|
---|
691 | #define DBGF_STEP_F_OVER RT_BIT_32(1)
|
---|
692 |
|
---|
693 | /** Stop on the next CALL, INT, SYSCALL, SYSENTER instruction. */
|
---|
694 | #define DBGF_STEP_F_STOP_ON_CALL RT_BIT_32(8)
|
---|
695 | /** Stop on the next RET, IRET, SYSRET, SYSEXIT instruction. */
|
---|
696 | #define DBGF_STEP_F_STOP_ON_RET RT_BIT_32(9)
|
---|
697 | /** Stop after the next RET, IRET, SYSRET, SYSEXIT instruction. */
|
---|
698 | #define DBGF_STEP_F_STOP_AFTER_RET RT_BIT_32(10)
|
---|
699 | /** Stop on the given address.
|
---|
700 | * The comparison will be made using effective (flat) addresses. */
|
---|
701 | #define DBGF_STEP_F_STOP_ON_ADDRESS RT_BIT_32(11)
|
---|
702 | /** Stop when the stack pointer pops to or past the given address.
|
---|
703 | * The comparison will be made using effective (flat) addresses. */
|
---|
704 | #define DBGF_STEP_F_STOP_ON_STACK_POP RT_BIT_32(12)
|
---|
705 | /** Mask of stop filter flags. */
|
---|
706 | #define DBGF_STEP_F_STOP_FILTER_MASK UINT32_C(0x00001f00)
|
---|
707 |
|
---|
708 | /** Mask of valid flags. */
|
---|
709 | #define DBGF_STEP_F_VALID_MASK UINT32_C(0x00001f03)
|
---|
710 | /** @} */
|
---|
711 |
|
---|
712 | /**
|
---|
713 | * Event configuration array element, see DBGFR3EventConfigEx.
|
---|
714 | */
|
---|
715 | typedef struct DBGFEVENTCONFIG
|
---|
716 | {
|
---|
717 | /** The event to configure */
|
---|
718 | DBGFEVENTTYPE enmType;
|
---|
719 | /** The new state. */
|
---|
720 | bool fEnabled;
|
---|
721 | /** Unused. */
|
---|
722 | uint8_t abUnused[3];
|
---|
723 | } DBGFEVENTCONFIG;
|
---|
724 | /** Pointer to an event config. */
|
---|
725 | typedef DBGFEVENTCONFIG *PDBGFEVENTCONFIG;
|
---|
726 | /** Pointer to a const event config. */
|
---|
727 | typedef const DBGFEVENTCONFIG *PCDBGFEVENTCONFIG;
|
---|
728 |
|
---|
729 | VMMR3DECL(int) DBGFR3EventConfigEx(PUVM pUVM, PCDBGFEVENTCONFIG paConfigs, size_t cConfigs);
|
---|
730 | VMMR3DECL(int) DBGFR3EventConfig(PUVM pUVM, DBGFEVENTTYPE enmEvent, bool fEnabled);
|
---|
731 | VMMR3DECL(bool) DBGFR3EventIsEnabled(PUVM pUVM, DBGFEVENTTYPE enmEvent);
|
---|
732 | VMMR3DECL(int) DBGFR3EventQuery(PUVM pUVM, PDBGFEVENTCONFIG paConfigs, size_t cConfigs);
|
---|
733 |
|
---|
734 | /** @name DBGFINTERRUPTSTATE_XXX - interrupt break state.
|
---|
735 | * @{ */
|
---|
736 | #define DBGFINTERRUPTSTATE_DISABLED 0
|
---|
737 | #define DBGFINTERRUPTSTATE_ENABLED 1
|
---|
738 | #define DBGFINTERRUPTSTATE_DONT_TOUCH 2
|
---|
739 | /** @} */
|
---|
740 |
|
---|
741 | /**
|
---|
742 | * Interrupt break state configuration entry.
|
---|
743 | */
|
---|
744 | typedef struct DBGFINTERRUPTCONFIG
|
---|
745 | {
|
---|
746 | /** The interrupt number. */
|
---|
747 | uint8_t iInterrupt;
|
---|
748 | /** The hardware interrupt state (DBGFINTERRUPTSTATE_XXX). */
|
---|
749 | uint8_t enmHardState;
|
---|
750 | /** The software interrupt state (DBGFINTERRUPTSTATE_XXX). */
|
---|
751 | uint8_t enmSoftState;
|
---|
752 | } DBGFINTERRUPTCONFIG;
|
---|
753 | /** Pointer to an interrupt break state config entyr. */
|
---|
754 | typedef DBGFINTERRUPTCONFIG *PDBGFINTERRUPTCONFIG;
|
---|
755 | /** Pointer to a const interrupt break state config entyr. */
|
---|
756 | typedef DBGFINTERRUPTCONFIG const *PCDBGFINTERRUPTCONFIG;
|
---|
757 |
|
---|
758 | VMMR3DECL(int) DBGFR3InterruptConfigEx(PUVM pUVM, PCDBGFINTERRUPTCONFIG paConfigs, size_t cConfigs);
|
---|
759 | VMMR3DECL(int) DBGFR3InterruptHardwareConfig(PUVM pUVM, uint8_t iInterrupt, bool fEnabled);
|
---|
760 | VMMR3DECL(int) DBGFR3InterruptSoftwareConfig(PUVM pUVM, uint8_t iInterrupt, bool fEnabled);
|
---|
761 | VMMR3DECL(int) DBGFR3InterruptHardwareIsEnabled(PUVM pUVM, uint8_t iInterrupt);
|
---|
762 | VMMR3DECL(int) DBGFR3InterruptSoftwareIsEnabled(PUVM pUVM, uint8_t iInterrupt);
|
---|
763 |
|
---|
764 | #endif /* IN_RING3 */
|
---|
765 |
|
---|
766 | /** @def DBGF_IS_EVENT_ENABLED
|
---|
767 | * Checks if a selectable debug event is enabled or not (fast).
|
---|
768 | *
|
---|
769 | * @returns true/false.
|
---|
770 | * @param a_pVM Pointer to the cross context VM structure.
|
---|
771 | * @param a_enmEvent The selectable event to check.
|
---|
772 | * @remarks Only for use internally in the VMM. Use DBGFR3EventIsEnabled elsewhere.
|
---|
773 | */
|
---|
774 | #if defined(VBOX_STRICT) && defined(RT_COMPILER_SUPPORTS_LAMBDA)
|
---|
775 | # define DBGF_IS_EVENT_ENABLED(a_pVM, a_enmEvent) \
|
---|
776 | ([](PVM a_pLambdaVM, DBGFEVENTTYPE a_enmLambdaEvent) -> bool { \
|
---|
777 | Assert( a_enmLambdaEvent >= DBGFEVENT_FIRST_SELECTABLE \
|
---|
778 | || a_enmLambdaEvent == DBGFEVENT_INTERRUPT_HARDWARE \
|
---|
779 | || a_enmLambdaEvent == DBGFEVENT_INTERRUPT_SOFTWARE); \
|
---|
780 | Assert(a_enmLambdaEvent < DBGFEVENT_END); \
|
---|
781 | return ASMBitTest(&a_pLambdaVM->dbgf.ro.bmSelectedEvents, a_enmLambdaEvent); \
|
---|
782 | }(a_pVM, a_enmEvent))
|
---|
783 | #elif defined(VBOX_STRICT) && defined(__GNUC__)
|
---|
784 | # define DBGF_IS_EVENT_ENABLED(a_pVM, a_enmEvent) \
|
---|
785 | __extension__ ({ \
|
---|
786 | Assert( (a_enmEvent) >= DBGFEVENT_FIRST_SELECTABLE \
|
---|
787 | || (a_enmEvent) == DBGFEVENT_INTERRUPT_HARDWARE \
|
---|
788 | || (a_enmEvent) == DBGFEVENT_INTERRUPT_SOFTWARE); \
|
---|
789 | Assert((a_enmEvent) < DBGFEVENT_END); \
|
---|
790 | ASMBitTest(&(a_pVM)->dbgf.ro.bmSelectedEvents, (a_enmEvent)); \
|
---|
791 | })
|
---|
792 | #else
|
---|
793 | # define DBGF_IS_EVENT_ENABLED(a_pVM, a_enmEvent) \
|
---|
794 | ASMBitTest(&(a_pVM)->dbgf.ro.bmSelectedEvents, (a_enmEvent))
|
---|
795 | #endif
|
---|
796 |
|
---|
797 |
|
---|
798 | /** @def DBGF_IS_HARDWARE_INT_ENABLED
|
---|
799 | * Checks if hardware interrupt interception is enabled or not for an interrupt.
|
---|
800 | *
|
---|
801 | * @returns true/false.
|
---|
802 | * @param a_pVM Pointer to the cross context VM structure.
|
---|
803 | * @param a_iInterrupt Interrupt to check.
|
---|
804 | * @remarks Only for use internally in the VMM. Use
|
---|
805 | * DBGFR3InterruptHardwareIsEnabled elsewhere.
|
---|
806 | */
|
---|
807 | #define DBGF_IS_HARDWARE_INT_ENABLED(a_pVM, a_iInterrupt) \
|
---|
808 | ASMBitTest(&(a_pVM)->dbgf.ro.bmHardIntBreakpoints, (uint8_t)(a_iInterrupt))
|
---|
809 |
|
---|
810 | /** @def DBGF_IS_SOFTWARE_INT_ENABLED
|
---|
811 | * Checks if software interrupt interception is enabled or not for an interrupt.
|
---|
812 | *
|
---|
813 | * @returns true/false.
|
---|
814 | * @param a_pVM Pointer to the cross context VM structure.
|
---|
815 | * @param a_iInterrupt Interrupt to check.
|
---|
816 | * @remarks Only for use internally in the VMM. Use
|
---|
817 | * DBGFR3InterruptSoftwareIsEnabled elsewhere.
|
---|
818 | */
|
---|
819 | #define DBGF_IS_SOFTWARE_INT_ENABLED(a_pVM, a_iInterrupt) \
|
---|
820 | ASMBitTest(&(a_pVM)->dbgf.ro.bmSoftIntBreakpoints, (uint8_t)(a_iInterrupt))
|
---|
821 |
|
---|
822 |
|
---|
823 |
|
---|
824 | /** Breakpoint type. */
|
---|
825 | typedef enum DBGFBPTYPE
|
---|
826 | {
|
---|
827 | /** Invalid breakpoint type. */
|
---|
828 | DBGFBPTYPE_INVALID = 0,
|
---|
829 | /** Debug register. */
|
---|
830 | DBGFBPTYPE_REG,
|
---|
831 | /** INT 3 instruction. */
|
---|
832 | DBGFBPTYPE_INT3,
|
---|
833 | /** Port I/O breakpoint. */
|
---|
834 | DBGFBPTYPE_PORT_IO,
|
---|
835 | /** Memory mapped I/O breakpoint. */
|
---|
836 | DBGFBPTYPE_MMIO,
|
---|
837 | /** ensure 32-bit size. */
|
---|
838 | DBGFBPTYPE_32BIT_HACK = 0x7fffffff
|
---|
839 | } DBGFBPTYPE;
|
---|
840 |
|
---|
841 |
|
---|
842 | /** @name DBGFBPIOACCESS_XXX - I/O (port + mmio) access types.
|
---|
843 | * @{ */
|
---|
844 | /** Byte sized read accesses. */
|
---|
845 | #define DBGFBPIOACCESS_READ_BYTE UINT32_C(0x00000001)
|
---|
846 | /** Word sized accesses. */
|
---|
847 | #define DBGFBPIOACCESS_READ_WORD UINT32_C(0x00000002)
|
---|
848 | /** Double word sized accesses. */
|
---|
849 | #define DBGFBPIOACCESS_READ_DWORD UINT32_C(0x00000004)
|
---|
850 | /** Quad word sized accesses - not available for I/O ports. */
|
---|
851 | #define DBGFBPIOACCESS_READ_QWORD UINT32_C(0x00000008)
|
---|
852 | /** Other sized accesses - not available for I/O ports. */
|
---|
853 | #define DBGFBPIOACCESS_READ_OTHER UINT32_C(0x00000010)
|
---|
854 | /** Read mask. */
|
---|
855 | #define DBGFBPIOACCESS_READ_MASK UINT32_C(0x0000001f)
|
---|
856 |
|
---|
857 | /** Byte sized write accesses. */
|
---|
858 | #define DBGFBPIOACCESS_WRITE_BYTE UINT32_C(0x00000100)
|
---|
859 | /** Word sized write accesses. */
|
---|
860 | #define DBGFBPIOACCESS_WRITE_WORD UINT32_C(0x00000200)
|
---|
861 | /** Double word sized write accesses. */
|
---|
862 | #define DBGFBPIOACCESS_WRITE_DWORD UINT32_C(0x00000400)
|
---|
863 | /** Quad word sized write accesses - not available for I/O ports. */
|
---|
864 | #define DBGFBPIOACCESS_WRITE_QWORD UINT32_C(0x00000800)
|
---|
865 | /** Other sized write accesses - not available for I/O ports. */
|
---|
866 | #define DBGFBPIOACCESS_WRITE_OTHER UINT32_C(0x00001000)
|
---|
867 | /** Write mask. */
|
---|
868 | #define DBGFBPIOACCESS_WRITE_MASK UINT32_C(0x00001f00)
|
---|
869 |
|
---|
870 | /** All kind of access (read, write, all sizes). */
|
---|
871 | #define DBGFBPIOACCESS_ALL UINT32_C(0x00001f1f)
|
---|
872 | /** All kind of access for MMIO (read, write, all sizes). */
|
---|
873 | #define DBGFBPIOACCESS_ALL_MMIO DBGFBPIOACCESS_ALL
|
---|
874 | /** All kind of access (read, write, all sizes). */
|
---|
875 | #define DBGFBPIOACCESS_ALL_PORT_IO UINT32_C(0x00000303)
|
---|
876 |
|
---|
877 | /** The acceptable mask for I/O ports. */
|
---|
878 | #define DBGFBPIOACCESS_VALID_MASK_PORT_IO UINT32_C(0x00000303)
|
---|
879 | /** The acceptable mask for MMIO. */
|
---|
880 | #define DBGFBPIOACCESS_VALID_MASK_MMIO UINT32_C(0x00001f1f)
|
---|
881 | /** @} */
|
---|
882 |
|
---|
883 | /**
|
---|
884 | * The visible breakpoint state (read-only).
|
---|
885 | */
|
---|
886 | typedef struct DBGFBPPUB
|
---|
887 | {
|
---|
888 | /** The number of breakpoint hits. */
|
---|
889 | uint64_t cHits;
|
---|
890 | /** The hit number which starts to trigger the breakpoint. */
|
---|
891 | uint64_t iHitTrigger;
|
---|
892 | /** The hit number which stops triggering the breakpoint (disables it).
|
---|
893 | * Use ~(uint64_t)0 if it should never stop. */
|
---|
894 | uint64_t iHitDisable;
|
---|
895 | /** The breakpoint owner handle (a nil owner defers the breakpoint to the
|
---|
896 | * debugger). */
|
---|
897 | DBGFBPOWNER hOwner;
|
---|
898 | /** Breakpoint type stored as a 16bit integer to stay within size limits. */
|
---|
899 | uint16_t u16Type;
|
---|
900 | /** Breakpoint flags. */
|
---|
901 | uint16_t fFlags;
|
---|
902 |
|
---|
903 | /** Union of type specific data. */
|
---|
904 | union
|
---|
905 | {
|
---|
906 | /** The flat GC address breakpoint address for REG and INT3 breakpoints. */
|
---|
907 | RTGCUINTPTR GCPtr;
|
---|
908 |
|
---|
909 | /** Debug register data. */
|
---|
910 | struct DBGFBPREG
|
---|
911 | {
|
---|
912 | /** The flat GC address of the breakpoint. */
|
---|
913 | RTGCUINTPTR GCPtr;
|
---|
914 | /** The debug register number. */
|
---|
915 | uint8_t iReg;
|
---|
916 | /** The access type (one of the X86_DR7_RW_* value). */
|
---|
917 | uint8_t fType;
|
---|
918 | /** The access size. */
|
---|
919 | uint8_t cb;
|
---|
920 | } Reg;
|
---|
921 |
|
---|
922 | /** INT3 breakpoint data. */
|
---|
923 | struct DBGFBPINT3
|
---|
924 | {
|
---|
925 | /** The flat GC address of the breakpoint. */
|
---|
926 | RTGCUINTPTR GCPtr;
|
---|
927 | /** The physical address of the breakpoint. */
|
---|
928 | RTGCPHYS PhysAddr;
|
---|
929 | /** The byte value we replaced by the INT 3 instruction. */
|
---|
930 | uint8_t bOrg;
|
---|
931 | } Int3;
|
---|
932 |
|
---|
933 | /** I/O port breakpoint data. */
|
---|
934 | struct DBGFBPPORTIO
|
---|
935 | {
|
---|
936 | /** The first port. */
|
---|
937 | RTIOPORT uPort;
|
---|
938 | /** The number of ports. */
|
---|
939 | RTIOPORT cPorts;
|
---|
940 | /** Valid DBGFBPIOACCESS_XXX selection, max DWORD size. */
|
---|
941 | uint32_t fAccess;
|
---|
942 | } PortIo;
|
---|
943 |
|
---|
944 | /** Memory mapped I/O breakpoint data. */
|
---|
945 | struct DBGFBPMMIO
|
---|
946 | {
|
---|
947 | /** The first MMIO address. */
|
---|
948 | RTGCPHYS PhysAddr;
|
---|
949 | /** The size of the MMIO range in bytes. */
|
---|
950 | uint32_t cb;
|
---|
951 | /** Valid DBGFBPIOACCESS_XXX selection, max QWORD size. */
|
---|
952 | uint32_t fAccess;
|
---|
953 | } Mmio;
|
---|
954 |
|
---|
955 | /** Padding to the anticipated size. */
|
---|
956 | uint64_t u64Padding[3];
|
---|
957 | } u;
|
---|
958 | } DBGFBPPUB;
|
---|
959 | AssertCompileSize(DBGFBPPUB, 64 - 8);
|
---|
960 | AssertCompileMembersAtSameOffset(DBGFBPPUB, u.GCPtr, DBGFBPPUB, u.Reg.GCPtr);
|
---|
961 | AssertCompileMembersAtSameOffset(DBGFBPPUB, u.GCPtr, DBGFBPPUB, u.Int3.GCPtr);
|
---|
962 |
|
---|
963 | /** Pointer to the visible breakpoint state. */
|
---|
964 | typedef DBGFBPPUB *PDBGFBPPUB;
|
---|
965 | /** Pointer to a const visible breakpoint state. */
|
---|
966 | typedef const DBGFBPPUB *PCDBGFBPPUB;
|
---|
967 |
|
---|
968 | /** Sets the DBGFPUB::u16Type member. */
|
---|
969 | #define DBGF_BP_PUB_MAKE_TYPE(a_enmType) ((uint16_t)(a_enmType))
|
---|
970 | /** Returns the type of the DBGFPUB::u16Type member. */
|
---|
971 | #define DBGF_BP_PUB_GET_TYPE(a_pBp) ((DBGFBPTYPE)((a_pBp)->u16Type))
|
---|
972 | /** Returns the enabled status of DBGFPUB::fFlags member. */
|
---|
973 | #define DBGF_BP_PUB_IS_ENABLED(a_pBp) RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_ENABLED)
|
---|
974 | /** Returns whether DBGF_BP_F_HIT_EXEC_BEFORE is set for DBGFPUB::fFlags. */
|
---|
975 | #define DBGF_BP_PUB_IS_EXEC_BEFORE(a_pBp) RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_HIT_EXEC_BEFORE)
|
---|
976 | /** Returns whether DBGF_BP_F_HIT_EXEC_AFTER is set for DBGFPUB::fFlags. */
|
---|
977 | #define DBGF_BP_PUB_IS_EXEC_AFTER(a_pBp) RT_BOOL((a_pBp)->fFlags & DBGF_BP_F_HIT_EXEC_AFTER)
|
---|
978 |
|
---|
979 |
|
---|
980 | /** @name Possible DBGFBPPUB::fFlags flags.
|
---|
981 | * @{ */
|
---|
982 | /** Default flags, breakpoint is enabled and hits before the instruction is executed. */
|
---|
983 | #define DBGF_BP_F_DEFAULT (DBGF_BP_F_ENABLED | DBGF_BP_F_HIT_EXEC_BEFORE)
|
---|
984 | /** Flag whether the breakpoint is enabled currently. */
|
---|
985 | #define DBGF_BP_F_ENABLED RT_BIT(0)
|
---|
986 | /** Flag indicating whether the action assoicated with the breakpoint should be carried out
|
---|
987 | * before the instruction causing the breakpoint to hit was executed. */
|
---|
988 | #define DBGF_BP_F_HIT_EXEC_BEFORE RT_BIT(1)
|
---|
989 | /** Flag indicating whether the action assoicated with the breakpoint should be carried out
|
---|
990 | * after the instruction causing the breakpoint to hit was executed. */
|
---|
991 | #define DBGF_BP_F_HIT_EXEC_AFTER RT_BIT(2)
|
---|
992 | /** The acceptable flags mask. */
|
---|
993 | #define DBGF_BP_F_VALID_MASK UINT32_C(0x00000007)
|
---|
994 | /** @} */
|
---|
995 |
|
---|
996 |
|
---|
997 | /**
|
---|
998 | * Breakpoint hit handler.
|
---|
999 | *
|
---|
1000 | * @returns Strict VBox status code.
|
---|
1001 | * @retval VINF_SUCCESS if the breakpoint was handled and guest execution can resume.
|
---|
1002 | * @retval VINF_DBGF_BP_HALT if guest execution should be stopped and the debugger should be invoked.
|
---|
1003 | * @retval VINF_DBGF_R3_BP_OWNER_DEFER return to ring-3 and invoke the owner callback there again.
|
---|
1004 | *
|
---|
1005 | * @param pVM The cross-context VM structure pointer.
|
---|
1006 | * @param idCpu ID of the vCPU triggering the breakpoint.
|
---|
1007 | * @param pvUserBp User argument of the set breakpoint.
|
---|
1008 | * @param hBp The breakpoint handle.
|
---|
1009 | * @param pBpPub Pointer to the readonly public state of the breakpoint.
|
---|
1010 | * @param fFlags Flags indicating when the handler was called (DBGF_BP_F_HIT_EXEC_BEFORE vs DBGF_BP_F_HIT_EXEC_AFTER).
|
---|
1011 | *
|
---|
1012 | * @remarks The handler is called on the EMT of vCPU triggering the breakpoint and no locks are held.
|
---|
1013 | * @remarks Any status code returned other than the ones mentioned will send the VM straight into a
|
---|
1014 | * guru meditation.
|
---|
1015 | */
|
---|
1016 | typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNDBGFBPHIT,(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub,
|
---|
1017 | uint16_t fFlags));
|
---|
1018 | /** Pointer to a FNDBGFBPHIT(). */
|
---|
1019 | typedef FNDBGFBPHIT *PFNDBGFBPHIT;
|
---|
1020 |
|
---|
1021 |
|
---|
1022 | /**
|
---|
1023 | * I/O breakpoint hit handler.
|
---|
1024 | *
|
---|
1025 | * @returns Strict VBox status code.
|
---|
1026 | * @retval VINF_SUCCESS if the breakpoint was handled and guest execution can resume.
|
---|
1027 | * @retval VINF_DBGF_BP_HALT if guest execution should be stopped and the debugger should be invoked.
|
---|
1028 | * @retval VINF_DBGF_R3_BP_OWNER_DEFER return to ring-3 and invoke the owner callback there again.
|
---|
1029 | *
|
---|
1030 | * @param pVM The cross-context VM structure pointer.
|
---|
1031 | * @param idCpu ID of the vCPU triggering the breakpoint.
|
---|
1032 | * @param pvUserBp User argument of the set breakpoint.
|
---|
1033 | * @param hBp The breakpoint handle.
|
---|
1034 | * @param pBpPub Pointer to the readonly public state of the breakpoint.
|
---|
1035 | * @param fFlags Flags indicating when the handler was called (DBGF_BP_F_HIT_EXEC_BEFORE vs DBGF_BP_F_HIT_EXEC_AFTER).
|
---|
1036 | * @param fAccess Access flags, see DBGFBPIOACCESS_XXX.
|
---|
1037 | * @param uAddr The address of the access, for port I/O this will hold the port number.
|
---|
1038 | * @param uValue The value read or written (the value for reads is only valid when DBGF_BP_F_HIT_EXEC_AFTER is set).
|
---|
1039 | *
|
---|
1040 | * @remarks The handler is called on the EMT of vCPU triggering the breakpoint and no locks are held.
|
---|
1041 | * @remarks Any status code returned other than the ones mentioned will send the VM straight into a
|
---|
1042 | * guru meditation.
|
---|
1043 | */
|
---|
1044 | typedef DECLCALLBACKTYPE(VBOXSTRICTRC, FNDBGFBPIOHIT,(PVM pVM, VMCPUID idCpu, void *pvUserBp, DBGFBP hBp, PCDBGFBPPUB pBpPub,
|
---|
1045 | uint16_t fFlags, uint32_t fAccess, uint64_t uAddr, uint64_t uValue));
|
---|
1046 | /** Pointer to a FNDBGFBPIOHIT(). */
|
---|
1047 | typedef FNDBGFBPIOHIT *PFNDBGFBPIOHIT;
|
---|
1048 |
|
---|
1049 |
|
---|
1050 | #ifdef IN_RING3
|
---|
1051 | /** @defgroup grp_dbgf_bp_r3 The DBGF Breakpoint Host Context Ring-3 API
|
---|
1052 | * @{ */
|
---|
1053 | VMMR3DECL(int) DBGFR3BpOwnerCreate(PUVM pUVM, PFNDBGFBPHIT pfnBpHit, PFNDBGFBPIOHIT pfnBpIoHit, PDBGFBPOWNER phBpOwner);
|
---|
1054 | VMMR3DECL(int) DBGFR3BpOwnerDestroy(PUVM pUVM, DBGFBPOWNER hBpOwner);
|
---|
1055 |
|
---|
1056 | VMMR3DECL(int) DBGFR3BpSetInt3(PUVM pUVM, VMCPUID idSrcCpu, PCDBGFADDRESS pAddress,
|
---|
1057 | uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
|
---|
1058 | VMMR3DECL(int) DBGFR3BpSetInt3Ex(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
|
---|
1059 | VMCPUID idSrcCpu, PCDBGFADDRESS pAddress, uint16_t fFlags,
|
---|
1060 | uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
|
---|
1061 | VMMR3DECL(int) DBGFR3BpSetReg(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger,
|
---|
1062 | uint64_t iHitDisable, uint8_t fType, uint8_t cb, PDBGFBP phBp);
|
---|
1063 | VMMR3DECL(int) DBGFR3BpSetRegEx(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
|
---|
1064 | PCDBGFADDRESS pAddress, uint16_t fFlags,
|
---|
1065 | uint64_t iHitTrigger, uint64_t iHitDisable,
|
---|
1066 | uint8_t fType, uint8_t cb, PDBGFBP phBp);
|
---|
1067 | VMMR3DECL(int) DBGFR3BpSetREM(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger,
|
---|
1068 | uint64_t iHitDisable, PDBGFBP phBp);
|
---|
1069 | VMMR3DECL(int) DBGFR3BpSetPortIo(PUVM pUVM, RTIOPORT uPort, RTIOPORT cPorts, uint32_t fAccess,
|
---|
1070 | uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
|
---|
1071 | VMMR3DECL(int) DBGFR3BpSetPortIoEx(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
|
---|
1072 | RTIOPORT uPort, RTIOPORT cPorts, uint32_t fAccess,
|
---|
1073 | uint32_t fFlags, uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
|
---|
1074 | VMMR3DECL(int) DBGFR3BpSetMmio(PUVM pUVM, RTGCPHYS GCPhys, uint32_t cb, uint32_t fAccess,
|
---|
1075 | uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
|
---|
1076 | VMMR3DECL(int) DBGFR3BpSetMmioEx(PUVM pUVM, DBGFBPOWNER hOwner, void *pvUser,
|
---|
1077 | RTGCPHYS GCPhys, uint32_t cb, uint32_t fAccess,
|
---|
1078 | uint32_t fFlags, uint64_t iHitTrigger, uint64_t iHitDisable, PDBGFBP phBp);
|
---|
1079 | VMMR3DECL(int) DBGFR3BpClear(PUVM pUVM, DBGFBP hBp);
|
---|
1080 | VMMR3DECL(int) DBGFR3BpEnable(PUVM pUVM, DBGFBP hBp);
|
---|
1081 | VMMR3DECL(int) DBGFR3BpDisable(PUVM pUVM, DBGFBP hBp);
|
---|
1082 |
|
---|
1083 | /**
|
---|
1084 | * Breakpoint enumeration callback function.
|
---|
1085 | *
|
---|
1086 | * @returns VBox status code.
|
---|
1087 | * The enumeration stops on failure status and VINF_CALLBACK_RETURN.
|
---|
1088 | * @param pUVM The user mode VM handle.
|
---|
1089 | * @param pvUser The user argument.
|
---|
1090 | * @param hBp The breakpoint handle.
|
---|
1091 | * @param pBpPub Pointer to the public breakpoint information. (readonly)
|
---|
1092 | */
|
---|
1093 | typedef DECLCALLBACKTYPE(int, FNDBGFBPENUM,(PUVM pUVM, void *pvUser, DBGFBP hBp, PCDBGFBPPUB pBpPub));
|
---|
1094 | /** Pointer to a breakpoint enumeration callback function. */
|
---|
1095 | typedef FNDBGFBPENUM *PFNDBGFBPENUM;
|
---|
1096 |
|
---|
1097 | VMMR3DECL(int) DBGFR3BpEnum(PUVM pUVM, PFNDBGFBPENUM pfnCallback, void *pvUser);
|
---|
1098 |
|
---|
1099 | VMMR3_INT_DECL(int) DBGFR3BpHit(PVM pVM, PVMCPU pVCpu);
|
---|
1100 | /** @} */
|
---|
1101 | #endif /* !IN_RING3 */
|
---|
1102 |
|
---|
1103 |
|
---|
1104 | #if defined(IN_RING0) || defined(DOXYGEN_RUNNING)
|
---|
1105 | /** @defgroup grp_dbgf_bp_r0 The DBGF Breakpoint Host Context Ring-0 API
|
---|
1106 | * @{ */
|
---|
1107 | VMMR0_INT_DECL(int) DBGFR0BpOwnerSetUpContext(PGVM pGVM, DBGFBPOWNER hBpOwner, PFNDBGFBPHIT pfnBpHit, PFNDBGFBPIOHIT pfnBpIoHit);
|
---|
1108 | VMMR0_INT_DECL(int) DBGFR0BpOwnerDestroyContext(PGVM pGVM, DBGFBPOWNER hBpOwner);
|
---|
1109 |
|
---|
1110 | VMMR0_INT_DECL(int) DBGFR0BpSetUpContext(PGVM pGVM, DBGFBP hBp, void *pvUser);
|
---|
1111 | VMMR0_INT_DECL(int) DBGFR0BpDestroyContext(PGVM pGVM, DBGFBP hBp);
|
---|
1112 | /** @} */
|
---|
1113 | #endif /* IN_RING0 || DOXYGEN_RUNNING */
|
---|
1114 |
|
---|
1115 | VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR7(PVM pVM);
|
---|
1116 | VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR0(PVM pVM);
|
---|
1117 | VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR1(PVM pVM);
|
---|
1118 | VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR2(PVM pVM);
|
---|
1119 | VMM_INT_DECL(RTGCUINTREG) DBGFBpGetDR3(PVM pVM);
|
---|
1120 | VMM_INT_DECL(bool) DBGFBpIsHwArmed(PVM pVM);
|
---|
1121 | VMM_INT_DECL(bool) DBGFBpIsHwIoArmed(PVM pVM);
|
---|
1122 | VMM_INT_DECL(bool) DBGFBpIsInt3Armed(PVM pVM);
|
---|
1123 | VMM_INT_DECL(bool) DBGFIsStepping(PVMCPU pVCpu);
|
---|
1124 | VMM_INT_DECL(VBOXSTRICTRC) DBGFBpCheckIo(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTIOPORT uIoPort, uint8_t cbValue);
|
---|
1125 | VMM_INT_DECL(VBOXSTRICTRC) DBGFBpCheckPortIo(PVMCC pVM, PVMCPU pVCpu, RTIOPORT uIoPort,
|
---|
1126 | uint32_t fAccess, uint32_t uValue, bool fBefore);
|
---|
1127 | VMM_INT_DECL(VBOXSTRICTRC) DBGFEventGenericWithArgs(PVM pVM, PVMCPU pVCpu, DBGFEVENTTYPE enmEvent, DBGFEVENTCTX enmCtx,
|
---|
1128 | unsigned cArgs, ...);
|
---|
1129 | VMM_INT_DECL(int) DBGFTrap01Handler(PVM pVM, PVMCPU pVCpu, PCPUMCTXCORE pRegFrame, RTGCUINTREG uDr6, bool fAltStepping);
|
---|
1130 | VMM_INT_DECL(VBOXSTRICTRC) DBGFTrap03Handler(PVMCC pVM, PVMCPUCC pVCpu, PCPUMCTXCORE pRegFrame);
|
---|
1131 |
|
---|
1132 |
|
---|
1133 | #ifdef IN_RING3 /* The CPU mode API only works in ring-3. */
|
---|
1134 | VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PUVM pUVM, VMCPUID idCpu);
|
---|
1135 | VMMR3DECL(VMCPUID) DBGFR3CpuGetCount(PUVM pUVM);
|
---|
1136 | VMMR3DECL(bool) DBGFR3CpuIsIn64BitCode(PUVM pUVM, VMCPUID idCpu);
|
---|
1137 | VMMR3DECL(bool) DBGFR3CpuIsInV86Code(PUVM pUVM, VMCPUID idCpu);
|
---|
1138 | VMMR3DECL(const char *) DBGFR3CpuGetState(PUVM pUVM, VMCPUID idCpu);
|
---|
1139 | #endif
|
---|
1140 |
|
---|
1141 |
|
---|
1142 |
|
---|
1143 | #ifdef IN_RING3 /* The info callbacks API only works in ring-3. */
|
---|
1144 |
|
---|
1145 | struct RTGETOPTSTATE;
|
---|
1146 | union RTGETOPTUNION;
|
---|
1147 |
|
---|
1148 | /**
|
---|
1149 | * Info helper callback structure.
|
---|
1150 | */
|
---|
1151 | typedef struct DBGFINFOHLP
|
---|
1152 | {
|
---|
1153 | /**
|
---|
1154 | * Print formatted string.
|
---|
1155 | *
|
---|
1156 | * @param pHlp Pointer to this structure.
|
---|
1157 | * @param pszFormat The format string.
|
---|
1158 | * @param ... Arguments.
|
---|
1159 | */
|
---|
1160 | DECLCALLBACKMEMBER(void, pfnPrintf,(PCDBGFINFOHLP pHlp, const char *pszFormat, ...)) RT_IPRT_FORMAT_ATTR(2, 3);
|
---|
1161 |
|
---|
1162 | /**
|
---|
1163 | * Print formatted string.
|
---|
1164 | *
|
---|
1165 | * @param pHlp Pointer to this structure.
|
---|
1166 | * @param pszFormat The format string.
|
---|
1167 | * @param args Argument list.
|
---|
1168 | */
|
---|
1169 | DECLCALLBACKMEMBER(void, pfnPrintfV,(PCDBGFINFOHLP pHlp, const char *pszFormat, va_list args)) RT_IPRT_FORMAT_ATTR(2, 0);
|
---|
1170 |
|
---|
1171 | /**
|
---|
1172 | * Report getopt parsing trouble
|
---|
1173 | *
|
---|
1174 | * @param pHlp Pointer to this structure.
|
---|
1175 | * @param rc The RTGetOpt return value.
|
---|
1176 | * @param pValueUnion The value union.
|
---|
1177 | * @param pState The getopt state.
|
---|
1178 | */
|
---|
1179 | DECLCALLBACKMEMBER(void, pfnGetOptError,(PCDBGFINFOHLP pHlp, int rc, union RTGETOPTUNION *pValueUnion,
|
---|
1180 | struct RTGETOPTSTATE *pState));
|
---|
1181 | } DBGFINFOHLP;
|
---|
1182 |
|
---|
1183 |
|
---|
1184 | /**
|
---|
1185 | * Info handler, device version.
|
---|
1186 | *
|
---|
1187 | * @param pDevIns The device instance which registered the info.
|
---|
1188 | * @param pHlp Callback functions for doing output.
|
---|
1189 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
1190 | */
|
---|
1191 | typedef DECLCALLBACKTYPE(void, FNDBGFHANDLERDEV,(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs));
|
---|
1192 | /** Pointer to a FNDBGFHANDLERDEV function. */
|
---|
1193 | typedef FNDBGFHANDLERDEV *PFNDBGFHANDLERDEV;
|
---|
1194 |
|
---|
1195 | /**
|
---|
1196 | * Info handler, driver version.
|
---|
1197 | *
|
---|
1198 | * @param pDrvIns The driver instance which registered the info.
|
---|
1199 | * @param pHlp Callback functions for doing output.
|
---|
1200 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
1201 | */
|
---|
1202 | typedef DECLCALLBACKTYPE(void, FNDBGFHANDLERDRV,(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, const char *pszArgs));
|
---|
1203 | /** Pointer to a FNDBGFHANDLERDRV function. */
|
---|
1204 | typedef FNDBGFHANDLERDRV *PFNDBGFHANDLERDRV;
|
---|
1205 |
|
---|
1206 | /**
|
---|
1207 | * Info handler, internal version.
|
---|
1208 | *
|
---|
1209 | * @param pVM The cross context VM structure.
|
---|
1210 | * @param pHlp Callback functions for doing output.
|
---|
1211 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
1212 | */
|
---|
1213 | typedef DECLCALLBACKTYPE(void, FNDBGFHANDLERINT,(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs));
|
---|
1214 | /** Pointer to a FNDBGFHANDLERINT function. */
|
---|
1215 | typedef FNDBGFHANDLERINT *PFNDBGFHANDLERINT;
|
---|
1216 |
|
---|
1217 | /**
|
---|
1218 | * Info handler, external version.
|
---|
1219 | *
|
---|
1220 | * @param pvUser User argument.
|
---|
1221 | * @param pHlp Callback functions for doing output.
|
---|
1222 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
1223 | */
|
---|
1224 | typedef DECLCALLBACKTYPE(void, FNDBGFHANDLEREXT,(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs));
|
---|
1225 | /** Pointer to a FNDBGFHANDLEREXT function. */
|
---|
1226 | typedef FNDBGFHANDLEREXT *PFNDBGFHANDLEREXT;
|
---|
1227 |
|
---|
1228 | /**
|
---|
1229 | * Info handler, device version with argv.
|
---|
1230 | *
|
---|
1231 | * @param pDevIns The device instance which registered the info.
|
---|
1232 | * @param pHlp Callback functions for doing output.
|
---|
1233 | * @param cArgs Number of arguments.
|
---|
1234 | * @param papszArgs Argument vector.
|
---|
1235 | */
|
---|
1236 | typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVDEV,(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
|
---|
1237 | /** Pointer to a FNDBGFINFOARGVDEV function. */
|
---|
1238 | typedef FNDBGFINFOARGVDEV *PFNDBGFINFOARGVDEV;
|
---|
1239 |
|
---|
1240 | /**
|
---|
1241 | * Info handler, USB device version with argv.
|
---|
1242 | *
|
---|
1243 | * @param pUsbIns The USB device instance which registered the info.
|
---|
1244 | * @param pHlp Callback functions for doing output.
|
---|
1245 | * @param cArgs Number of arguments.
|
---|
1246 | * @param papszArgs Argument vector.
|
---|
1247 | */
|
---|
1248 | typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVUSB,(PPDMUSBINS pUsbIns, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
|
---|
1249 | /** Pointer to a FNDBGFINFOARGVUSB function. */
|
---|
1250 | typedef FNDBGFINFOARGVUSB *PFNDBGFINFOARGVUSB;
|
---|
1251 |
|
---|
1252 | /**
|
---|
1253 | * Info handler, driver version with argv.
|
---|
1254 | *
|
---|
1255 | * @param pDrvIns The driver instance which registered the info.
|
---|
1256 | * @param pHlp Callback functions for doing output.
|
---|
1257 | * @param cArgs Number of arguments.
|
---|
1258 | * @param papszArgs Argument vector.
|
---|
1259 | */
|
---|
1260 | typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVDRV,(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
|
---|
1261 | /** Pointer to a FNDBGFINFOARGVDRV function. */
|
---|
1262 | typedef FNDBGFINFOARGVDRV *PFNDBGFINFOARGVDRV;
|
---|
1263 |
|
---|
1264 | /**
|
---|
1265 | * Info handler, internal version with argv.
|
---|
1266 | *
|
---|
1267 | * @param pVM The cross context VM structure.
|
---|
1268 | * @param pHlp Callback functions for doing output.
|
---|
1269 | * @param cArgs Number of arguments.
|
---|
1270 | * @param papszArgs Argument vector.
|
---|
1271 | */
|
---|
1272 | typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVINT,(PVM pVM, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
|
---|
1273 | /** Pointer to a FNDBGFINFOARGVINT function. */
|
---|
1274 | typedef FNDBGFINFOARGVINT *PFNDBGFINFOARGVINT;
|
---|
1275 |
|
---|
1276 | /**
|
---|
1277 | * Info handler, external version with argv.
|
---|
1278 | *
|
---|
1279 | * @param pvUser User argument.
|
---|
1280 | * @param pHlp Callback functions for doing output.
|
---|
1281 | * @param cArgs Number of arguments.
|
---|
1282 | * @param papszArgs Argument vector.
|
---|
1283 | */
|
---|
1284 | typedef DECLCALLBACKTYPE(void, FNDBGFINFOARGVEXT,(void *pvUser, PCDBGFINFOHLP pHlp, int cArgs, char **papszArgs));
|
---|
1285 | /** Pointer to a FNDBGFINFOARGVEXT function. */
|
---|
1286 | typedef FNDBGFINFOARGVEXT *PFNDBGFINFOARGVEXT;
|
---|
1287 |
|
---|
1288 |
|
---|
1289 | /** @name Flags for the info registration functions.
|
---|
1290 | * @{ */
|
---|
1291 | /** The handler must run on the EMT. */
|
---|
1292 | #define DBGFINFO_FLAGS_RUN_ON_EMT RT_BIT(0)
|
---|
1293 | /** Call on all EMTs when a specific isn't specified. */
|
---|
1294 | #define DBGFINFO_FLAGS_ALL_EMTS RT_BIT(1)
|
---|
1295 | /** @} */
|
---|
1296 |
|
---|
1297 | VMMR3_INT_DECL(int) DBGFR3InfoRegisterDevice(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler, PPDMDEVINS pDevIns);
|
---|
1298 | VMMR3_INT_DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns);
|
---|
1299 | VMMR3_INT_DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler);
|
---|
1300 | VMMR3_INT_DECL(int) DBGFR3InfoRegisterInternalEx(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler, uint32_t fFlags);
|
---|
1301 | VMMR3DECL(int) DBGFR3InfoRegisterExternal(PUVM pUVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser);
|
---|
1302 |
|
---|
1303 | VMMR3_INT_DECL(int) DBGFR3InfoRegisterDeviceArgv(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVDEV pfnHandler, PPDMDEVINS pDevIns);
|
---|
1304 | VMMR3_INT_DECL(int) DBGFR3InfoRegisterDriverArgv(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVDRV pfnHandler, PPDMDRVINS pDrvIns);
|
---|
1305 | VMMR3_INT_DECL(int) DBGFR3InfoRegisterUsbArgv(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVUSB pfnHandler, PPDMUSBINS pUsbIns);
|
---|
1306 | VMMR3_INT_DECL(int) DBGFR3InfoRegisterInternalArgv(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVINT pfnHandler, uint32_t fFlags);
|
---|
1307 | VMMR3DECL(int) DBGFR3InfoRegisterExternalArgv(PUVM pUVM, const char *pszName, const char *pszDesc, PFNDBGFINFOARGVEXT pfnHandler, void *pvUser);
|
---|
1308 |
|
---|
1309 | VMMR3_INT_DECL(int) DBGFR3InfoDeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName);
|
---|
1310 | VMMR3_INT_DECL(int) DBGFR3InfoDeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName);
|
---|
1311 | VMMR3_INT_DECL(int) DBGFR3InfoDeregisterUsb(PVM pVM, PPDMUSBINS pDrvIns, const char *pszName);
|
---|
1312 | VMMR3_INT_DECL(int) DBGFR3InfoDeregisterInternal(PVM pVM, const char *pszName);
|
---|
1313 | VMMR3DECL(int) DBGFR3InfoDeregisterExternal(PUVM pUVM, const char *pszName);
|
---|
1314 |
|
---|
1315 | VMMR3DECL(int) DBGFR3Info(PUVM pUVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
|
---|
1316 | VMMR3DECL(int) DBGFR3InfoEx(PUVM pUVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
|
---|
1317 | VMMR3DECL(int) DBGFR3InfoLogRel(PUVM pUVM, const char *pszName, const char *pszArgs);
|
---|
1318 | VMMR3DECL(int) DBGFR3InfoStdErr(PUVM pUVM, const char *pszName, const char *pszArgs);
|
---|
1319 | VMMR3_INT_DECL(int) DBGFR3InfoMulti(PVM pVM, const char *pszIncludePat, const char *pszExcludePat,
|
---|
1320 | const char *pszSepFmt, PCDBGFINFOHLP pHlp);
|
---|
1321 |
|
---|
1322 | /** @def DBGFR3_INFO_LOG
|
---|
1323 | * Display a piece of info writing to the log if enabled.
|
---|
1324 | *
|
---|
1325 | * This is for execution on EMTs and will only show the items on the calling
|
---|
1326 | * EMT. This is to avoid deadlocking against other CPUs if a rendezvous is
|
---|
1327 | * initiated in parallel to this call. (Besides, nobody really wants or need
|
---|
1328 | * info for the other EMTs when using this macro.)
|
---|
1329 | *
|
---|
1330 | * @param a_pVM The shared VM handle.
|
---|
1331 | * @param a_pVCpu The cross context per CPU structure of the calling EMT.
|
---|
1332 | * @param a_pszName The identifier of the info to display.
|
---|
1333 | * @param a_pszArgs Arguments to the info handler.
|
---|
1334 | */
|
---|
1335 | #ifdef LOG_ENABLED
|
---|
1336 | # define DBGFR3_INFO_LOG(a_pVM, a_pVCpu, a_pszName, a_pszArgs) \
|
---|
1337 | do { \
|
---|
1338 | if (LogIsEnabled()) \
|
---|
1339 | DBGFR3InfoEx((a_pVM)->pUVM, (a_pVCpu)->idCpu, a_pszName, a_pszArgs, NULL); \
|
---|
1340 | } while (0)
|
---|
1341 | #else
|
---|
1342 | # define DBGFR3_INFO_LOG(a_pVM, a_pVCpu, a_pszName, a_pszArgs) do { } while (0)
|
---|
1343 | #endif
|
---|
1344 |
|
---|
1345 | /** @def DBGFR3_INFO_LOG_SAFE
|
---|
1346 | * Display a piece of info (rendezvous safe) writing to the log if enabled.
|
---|
1347 | *
|
---|
1348 | * @param a_pVM The shared VM handle.
|
---|
1349 | * @param a_pszName The identifier of the info to display.
|
---|
1350 | * @param a_pszArgs Arguments to the info handler.
|
---|
1351 | *
|
---|
1352 | * @remarks Use DBGFR3_INFO_LOG where ever possible!
|
---|
1353 | */
|
---|
1354 | #ifdef LOG_ENABLED
|
---|
1355 | # define DBGFR3_INFO_LOG_SAFE(a_pVM, a_pszName, a_pszArgs) \
|
---|
1356 | do { \
|
---|
1357 | if (LogIsEnabled()) \
|
---|
1358 | DBGFR3Info((a_pVM)->pUVM, a_pszName, a_pszArgs, NULL); \
|
---|
1359 | } while (0)
|
---|
1360 | #else
|
---|
1361 | # define DBGFR3_INFO_LOG_SAFE(a_pVM, a_pszName, a_pszArgs) do { } while (0)
|
---|
1362 | #endif
|
---|
1363 |
|
---|
1364 | /**
|
---|
1365 | * Enumeration callback for use with DBGFR3InfoEnum.
|
---|
1366 | *
|
---|
1367 | * @returns VBox status code.
|
---|
1368 | * A status code indicating failure will end the enumeration
|
---|
1369 | * and DBGFR3InfoEnum will return with that status code.
|
---|
1370 | * @param pUVM The user mode VM handle.
|
---|
1371 | * @param pszName Info identifier name.
|
---|
1372 | * @param pszDesc The description.
|
---|
1373 | * @param pvUser User parameter.
|
---|
1374 | */
|
---|
1375 | typedef DECLCALLBACKTYPE(int, FNDBGFINFOENUM,(PUVM pUVM, const char *pszName, const char *pszDesc, void *pvUser));
|
---|
1376 | /** Pointer to a FNDBGFINFOENUM function. */
|
---|
1377 | typedef FNDBGFINFOENUM *PFNDBGFINFOENUM;
|
---|
1378 |
|
---|
1379 | VMMR3DECL(int) DBGFR3InfoEnum(PUVM pUVM, PFNDBGFINFOENUM pfnCallback, void *pvUser);
|
---|
1380 | VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogHlp(void);
|
---|
1381 | VMMR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogRelHlp(void);
|
---|
1382 | VMMR3DECL(void) DBGFR3InfoGenericGetOptError(PCDBGFINFOHLP pHlp, int rc, union RTGETOPTUNION *pValueUnion,
|
---|
1383 | struct RTGETOPTSTATE *pState);
|
---|
1384 |
|
---|
1385 | #endif /* IN_RING3 */
|
---|
1386 |
|
---|
1387 |
|
---|
1388 | #ifdef IN_RING3 /* The log contrl API only works in ring-3. */
|
---|
1389 | VMMR3DECL(int) DBGFR3LogModifyGroups(PUVM pUVM, const char *pszGroupSettings);
|
---|
1390 | VMMR3DECL(int) DBGFR3LogModifyFlags(PUVM pUVM, const char *pszFlagSettings);
|
---|
1391 | VMMR3DECL(int) DBGFR3LogModifyDestinations(PUVM pUVM, const char *pszDestSettings);
|
---|
1392 | #endif /* IN_RING3 */
|
---|
1393 |
|
---|
1394 | #ifdef IN_RING3 /* The debug information management APIs only works in ring-3. */
|
---|
1395 |
|
---|
1396 | /** Max length (including '\\0') of a symbol name. */
|
---|
1397 | #define DBGF_SYMBOL_NAME_LENGTH 512
|
---|
1398 |
|
---|
1399 | /**
|
---|
1400 | * Debug symbol.
|
---|
1401 | */
|
---|
1402 | typedef struct DBGFSYMBOL
|
---|
1403 | {
|
---|
1404 | /** Symbol value (address). */
|
---|
1405 | RTGCUINTPTR Value;
|
---|
1406 | /** Symbol size. */
|
---|
1407 | uint32_t cb;
|
---|
1408 | /** Symbol Flags. (reserved). */
|
---|
1409 | uint32_t fFlags;
|
---|
1410 | /** Symbol name. */
|
---|
1411 | char szName[DBGF_SYMBOL_NAME_LENGTH];
|
---|
1412 | } DBGFSYMBOL;
|
---|
1413 | /** Pointer to debug symbol. */
|
---|
1414 | typedef DBGFSYMBOL *PDBGFSYMBOL;
|
---|
1415 | /** Pointer to const debug symbol. */
|
---|
1416 | typedef const DBGFSYMBOL *PCDBGFSYMBOL;
|
---|
1417 |
|
---|
1418 | /**
|
---|
1419 | * Debug line number information.
|
---|
1420 | */
|
---|
1421 | typedef struct DBGFLINE
|
---|
1422 | {
|
---|
1423 | /** Address. */
|
---|
1424 | RTGCUINTPTR Address;
|
---|
1425 | /** Line number. */
|
---|
1426 | uint32_t uLineNo;
|
---|
1427 | /** Filename. */
|
---|
1428 | char szFilename[260];
|
---|
1429 | } DBGFLINE;
|
---|
1430 | /** Pointer to debug line number. */
|
---|
1431 | typedef DBGFLINE *PDBGFLINE;
|
---|
1432 | /** Pointer to const debug line number. */
|
---|
1433 | typedef const DBGFLINE *PCDBGFLINE;
|
---|
1434 |
|
---|
1435 | /** @name Address spaces aliases.
|
---|
1436 | * @{ */
|
---|
1437 | /** The guest global address space. */
|
---|
1438 | #define DBGF_AS_GLOBAL ((RTDBGAS)-1)
|
---|
1439 | /** The guest kernel address space.
|
---|
1440 | * This is usually resolves to the same as DBGF_AS_GLOBAL. */
|
---|
1441 | #define DBGF_AS_KERNEL ((RTDBGAS)-2)
|
---|
1442 | /** The physical address space. */
|
---|
1443 | #define DBGF_AS_PHYS ((RTDBGAS)-3)
|
---|
1444 | /** Raw-mode context. */
|
---|
1445 | #define DBGF_AS_RC ((RTDBGAS)-4)
|
---|
1446 | /** Ring-0 context. */
|
---|
1447 | #define DBGF_AS_R0 ((RTDBGAS)-5)
|
---|
1448 | /** Raw-mode context and then global guest context.
|
---|
1449 | * When used for looking up information, it works as if the call was first made
|
---|
1450 | * with DBGF_AS_RC and then on failure with DBGF_AS_GLOBAL. When called for
|
---|
1451 | * making address space changes, it works as if DBGF_AS_RC was used. */
|
---|
1452 | #define DBGF_AS_RC_AND_GC_GLOBAL ((RTDBGAS)-6)
|
---|
1453 |
|
---|
1454 | /** The first special one. */
|
---|
1455 | #define DBGF_AS_FIRST DBGF_AS_RC_AND_GC_GLOBAL
|
---|
1456 | /** The last special one. */
|
---|
1457 | #define DBGF_AS_LAST DBGF_AS_GLOBAL
|
---|
1458 | #endif
|
---|
1459 | /** The number of special address space handles. */
|
---|
1460 | #define DBGF_AS_COUNT (6U)
|
---|
1461 | #ifdef IN_RING3
|
---|
1462 | /** Converts an alias handle to an array index. */
|
---|
1463 | #define DBGF_AS_ALIAS_2_INDEX(hAlias) \
|
---|
1464 | ( (uintptr_t)(hAlias) - (uintptr_t)DBGF_AS_FIRST )
|
---|
1465 | /** Predicat macro that check if the specified handle is an alias. */
|
---|
1466 | #define DBGF_AS_IS_ALIAS(hAlias) \
|
---|
1467 | ( DBGF_AS_ALIAS_2_INDEX(hAlias) < DBGF_AS_COUNT )
|
---|
1468 | /** Predicat macro that check if the specified alias is a fixed one or not. */
|
---|
1469 | #define DBGF_AS_IS_FIXED_ALIAS(hAlias) \
|
---|
1470 | ( DBGF_AS_ALIAS_2_INDEX(hAlias) < (uintptr_t)DBGF_AS_PHYS - (uintptr_t)DBGF_AS_FIRST + 1U )
|
---|
1471 |
|
---|
1472 | /** @} */
|
---|
1473 |
|
---|
1474 | VMMR3DECL(RTDBGCFG) DBGFR3AsGetConfig(PUVM pUVM);
|
---|
1475 |
|
---|
1476 | VMMR3DECL(int) DBGFR3AsAdd(PUVM pUVM, RTDBGAS hDbgAs, RTPROCESS ProcId);
|
---|
1477 | VMMR3DECL(int) DBGFR3AsDelete(PUVM pUVM, RTDBGAS hDbgAs);
|
---|
1478 | VMMR3DECL(int) DBGFR3AsSetAlias(PUVM pUVM, RTDBGAS hAlias, RTDBGAS hAliasFor);
|
---|
1479 | VMMR3DECL(RTDBGAS) DBGFR3AsResolve(PUVM pUVM, RTDBGAS hAlias);
|
---|
1480 | VMMR3DECL(RTDBGAS) DBGFR3AsResolveAndRetain(PUVM pUVM, RTDBGAS hAlias);
|
---|
1481 | VMMR3DECL(RTDBGAS) DBGFR3AsQueryByName(PUVM pUVM, const char *pszName);
|
---|
1482 | VMMR3DECL(RTDBGAS) DBGFR3AsQueryByPid(PUVM pUVM, RTPROCESS ProcId);
|
---|
1483 |
|
---|
1484 | VMMR3DECL(int) DBGFR3AsLoadImage(PUVM pUVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName,
|
---|
1485 | RTLDRARCH enmArch, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
|
---|
1486 | VMMR3DECL(int) DBGFR3AsLoadMap(PUVM pUVM, RTDBGAS hDbgAs, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags);
|
---|
1487 | VMMR3DECL(int) DBGFR3AsLinkModule(PUVM pUVM, RTDBGAS hDbgAs, RTDBGMOD hMod, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags);
|
---|
1488 | VMMR3DECL(int) DBGFR3AsUnlinkModuleByName(PUVM pUVM, RTDBGAS hDbgAs, const char *pszModName);
|
---|
1489 |
|
---|
1490 | VMMR3DECL(int) DBGFR3AsSymbolByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, uint32_t fFlags,
|
---|
1491 | PRTGCINTPTR poffDisp, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
|
---|
1492 | VMMR3DECL(PRTDBGSYMBOL) DBGFR3AsSymbolByAddrA(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, uint32_t Flags,
|
---|
1493 | PRTGCINTPTR poffDisp, PRTDBGMOD phMod);
|
---|
1494 | VMMR3DECL(int) DBGFR3AsSymbolByName(PUVM pUVM, RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
|
---|
1495 |
|
---|
1496 | VMMR3DECL(int) DBGFR3AsLineByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress,
|
---|
1497 | PRTGCINTPTR poffDisp, PRTDBGLINE pLine, PRTDBGMOD phMod);
|
---|
1498 | VMMR3DECL(PRTDBGLINE) DBGFR3AsLineByAddrA(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress,
|
---|
1499 | PRTGCINTPTR poffDisp, PRTDBGMOD phMod);
|
---|
1500 |
|
---|
1501 | /** @name DBGFMOD_PE_F_XXX - flags for
|
---|
1502 | * @{ */
|
---|
1503 | /** NT 3.1 images were a little different, so make allowances for that. */
|
---|
1504 | #define DBGFMODINMEM_F_PE_NT31 RT_BIT_32(0)
|
---|
1505 | /** No container fallback. */
|
---|
1506 | #define DBGFMODINMEM_F_NO_CONTAINER_FALLBACK RT_BIT_32(1)
|
---|
1507 | /** No in-memory reader fallback. */
|
---|
1508 | #define DBGFMODINMEM_F_NO_READER_FALLBACK RT_BIT_32(2)
|
---|
1509 | /** Valid flags. */
|
---|
1510 | #define DBGFMODINMEM_F_VALID_MASK UINT32_C(0x00000007)
|
---|
1511 | /** @} */
|
---|
1512 | VMMR3DECL(int) DBGFR3ModInMem(PUVM pUVM, PCDBGFADDRESS pImageAddr, uint32_t fFlags, const char *pszName,
|
---|
1513 | const char *pszFilename, RTLDRARCH enmArch, uint32_t cbImage,
|
---|
1514 | PRTDBGMOD phDbgMod, PRTERRINFO pErrInfo);
|
---|
1515 |
|
---|
1516 | #endif /* IN_RING3 */
|
---|
1517 |
|
---|
1518 | #ifdef IN_RING3 /* The stack API only works in ring-3. */
|
---|
1519 |
|
---|
1520 | /** Pointer to stack frame info. */
|
---|
1521 | typedef struct DBGFSTACKFRAME *PDBGFSTACKFRAME;
|
---|
1522 | /** Pointer to const stack frame info. */
|
---|
1523 | typedef struct DBGFSTACKFRAME const *PCDBGFSTACKFRAME;
|
---|
1524 | /**
|
---|
1525 | * Info about a stack frame.
|
---|
1526 | */
|
---|
1527 | typedef struct DBGFSTACKFRAME
|
---|
1528 | {
|
---|
1529 | /** Frame number. */
|
---|
1530 | uint32_t iFrame;
|
---|
1531 | /** Frame flags (DBGFSTACKFRAME_FLAGS_XXX). */
|
---|
1532 | uint32_t fFlags;
|
---|
1533 | /** The stack address of the frame.
|
---|
1534 | * The off member is [e|r]sp and the Sel member is ss. */
|
---|
1535 | DBGFADDRESS AddrStack;
|
---|
1536 | /** The program counter (PC) address of the frame.
|
---|
1537 | * The off member is [e|r]ip and the Sel member is cs. */
|
---|
1538 | DBGFADDRESS AddrPC;
|
---|
1539 | /** Pointer to the symbol nearest the program counter (PC). NULL if not found. */
|
---|
1540 | PRTDBGSYMBOL pSymPC;
|
---|
1541 | /** Pointer to the linenumber nearest the program counter (PC). NULL if not found. */
|
---|
1542 | PRTDBGLINE pLinePC;
|
---|
1543 | /** The frame address.
|
---|
1544 | * The off member is [e|r]bp and the Sel member is ss. */
|
---|
1545 | DBGFADDRESS AddrFrame;
|
---|
1546 | /** The way this frame returns to the next one. */
|
---|
1547 | RTDBGRETURNTYPE enmReturnType;
|
---|
1548 |
|
---|
1549 | /** The way the next frame returns.
|
---|
1550 | * Only valid when DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET is set. */
|
---|
1551 | RTDBGRETURNTYPE enmReturnFrameReturnType;
|
---|
1552 | /** The return frame address.
|
---|
1553 | * The off member is [e|r]bp and the Sel member is ss. */
|
---|
1554 | DBGFADDRESS AddrReturnFrame;
|
---|
1555 | /** The return stack address.
|
---|
1556 | * The off member is [e|r]sp and the Sel member is ss. */
|
---|
1557 | DBGFADDRESS AddrReturnStack;
|
---|
1558 |
|
---|
1559 | /** The program counter (PC) address which the frame returns to.
|
---|
1560 | * The off member is [e|r]ip and the Sel member is cs. */
|
---|
1561 | DBGFADDRESS AddrReturnPC;
|
---|
1562 | /** Pointer to the symbol nearest the return PC. NULL if not found. */
|
---|
1563 | PRTDBGSYMBOL pSymReturnPC;
|
---|
1564 | /** Pointer to the linenumber nearest the return PC. NULL if not found. */
|
---|
1565 | PRTDBGLINE pLineReturnPC;
|
---|
1566 |
|
---|
1567 | /** 32-bytes of stack arguments. */
|
---|
1568 | union
|
---|
1569 | {
|
---|
1570 | /** 64-bit view */
|
---|
1571 | uint64_t au64[4];
|
---|
1572 | /** 32-bit view */
|
---|
1573 | uint32_t au32[8];
|
---|
1574 | /** 16-bit view */
|
---|
1575 | uint16_t au16[16];
|
---|
1576 | /** 8-bit view */
|
---|
1577 | uint8_t au8[32];
|
---|
1578 | } Args;
|
---|
1579 |
|
---|
1580 | /** Number of registers values we can be sure about.
|
---|
1581 | * @note This is generally zero in the first frame. */
|
---|
1582 | uint32_t cSureRegs;
|
---|
1583 | /** Registers we can be sure about (length given by cSureRegs). */
|
---|
1584 | struct DBGFREGVALEX *paSureRegs;
|
---|
1585 |
|
---|
1586 | /** Pointer to the next frame.
|
---|
1587 | * Might not be used in some cases, so consider it internal. */
|
---|
1588 | PCDBGFSTACKFRAME pNextInternal;
|
---|
1589 | /** Pointer to the first frame.
|
---|
1590 | * Might not be used in some cases, so consider it internal. */
|
---|
1591 | PCDBGFSTACKFRAME pFirstInternal;
|
---|
1592 | } DBGFSTACKFRAME;
|
---|
1593 |
|
---|
1594 | /** @name DBGFSTACKFRAME_FLAGS_XXX - DBGFSTACKFRAME Flags.
|
---|
1595 | * @{ */
|
---|
1596 | /** This is the last stack frame we can read.
|
---|
1597 | * This flag is not set if the walk stop because of max dept or recursion. */
|
---|
1598 | # define DBGFSTACKFRAME_FLAGS_LAST RT_BIT(1)
|
---|
1599 | /** This is the last record because we detected a loop. */
|
---|
1600 | # define DBGFSTACKFRAME_FLAGS_LOOP RT_BIT(2)
|
---|
1601 | /** This is the last record because we reached the maximum depth. */
|
---|
1602 | # define DBGFSTACKFRAME_FLAGS_MAX_DEPTH RT_BIT(3)
|
---|
1603 | /** 16-bit frame. */
|
---|
1604 | # define DBGFSTACKFRAME_FLAGS_16BIT RT_BIT(4)
|
---|
1605 | /** 32-bit frame. */
|
---|
1606 | # define DBGFSTACKFRAME_FLAGS_32BIT RT_BIT(5)
|
---|
1607 | /** 64-bit frame. */
|
---|
1608 | # define DBGFSTACKFRAME_FLAGS_64BIT RT_BIT(6)
|
---|
1609 | /** Real mode or V86 frame. */
|
---|
1610 | # define DBGFSTACKFRAME_FLAGS_REAL_V86 RT_BIT(7)
|
---|
1611 | /** Is a trap frame (NT term). */
|
---|
1612 | # define DBGFSTACKFRAME_FLAGS_TRAP_FRAME RT_BIT(8)
|
---|
1613 |
|
---|
1614 | /** Used Odd/even heuristics for far/near return. */
|
---|
1615 | # define DBGFSTACKFRAME_FLAGS_USED_ODD_EVEN RT_BIT(29)
|
---|
1616 | /** Set if we used unwind info to construct the frame. (Kind of internal.) */
|
---|
1617 | # define DBGFSTACKFRAME_FLAGS_USED_UNWIND_INFO RT_BIT(30)
|
---|
1618 | /** Internal: Unwind info used for the return frame. */
|
---|
1619 | # define DBGFSTACKFRAME_FLAGS_UNWIND_INFO_RET RT_BIT(31)
|
---|
1620 | /** @} */
|
---|
1621 |
|
---|
1622 | /** @name DBGFCODETYPE
|
---|
1623 | * @{ */
|
---|
1624 | typedef enum DBGFCODETYPE
|
---|
1625 | {
|
---|
1626 | /** The usual invalid 0 value. */
|
---|
1627 | DBGFCODETYPE_INVALID = 0,
|
---|
1628 | /** Stack walk for guest code. */
|
---|
1629 | DBGFCODETYPE_GUEST,
|
---|
1630 | /** Stack walk for hypervisor code. */
|
---|
1631 | DBGFCODETYPE_HYPER,
|
---|
1632 | /** Stack walk for ring 0 code. */
|
---|
1633 | DBGFCODETYPE_RING0,
|
---|
1634 | /** The usual 32-bit blowup. */
|
---|
1635 | DBGFCODETYPE_32BIT_HACK = 0x7fffffff
|
---|
1636 | } DBGFCODETYPE;
|
---|
1637 | /** @} */
|
---|
1638 |
|
---|
1639 | VMMR3DECL(int) DBGFR3StackWalkBegin(PUVM pUVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType,
|
---|
1640 | PCDBGFSTACKFRAME *ppFirstFrame);
|
---|
1641 | VMMR3DECL(int) DBGFR3StackWalkBeginEx(PUVM pUVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFADDRESS pAddrFrame,
|
---|
1642 | PCDBGFADDRESS pAddrStack,PCDBGFADDRESS pAddrPC,
|
---|
1643 | RTDBGRETURNTYPE enmReturnType, PCDBGFSTACKFRAME *ppFirstFrame);
|
---|
1644 | VMMR3DECL(PCDBGFSTACKFRAME) DBGFR3StackWalkNext(PCDBGFSTACKFRAME pCurrent);
|
---|
1645 | VMMR3DECL(void) DBGFR3StackWalkEnd(PCDBGFSTACKFRAME pFirstFrame);
|
---|
1646 |
|
---|
1647 | #endif /* IN_RING3 */
|
---|
1648 |
|
---|
1649 |
|
---|
1650 | #ifdef IN_RING3 /* The disassembly API only works in ring-3. */
|
---|
1651 |
|
---|
1652 | /** @name Flags to pass to DBGFR3DisasInstrEx().
|
---|
1653 | * @{ */
|
---|
1654 | /** Disassemble the current guest instruction, with annotations. */
|
---|
1655 | #define DBGF_DISAS_FLAGS_CURRENT_GUEST RT_BIT(0)
|
---|
1656 | /** No annotations for current context. */
|
---|
1657 | #define DBGF_DISAS_FLAGS_NO_ANNOTATION RT_BIT(2)
|
---|
1658 | /** No symbol lookup. */
|
---|
1659 | #define DBGF_DISAS_FLAGS_NO_SYMBOLS RT_BIT(3)
|
---|
1660 | /** No instruction bytes. */
|
---|
1661 | #define DBGF_DISAS_FLAGS_NO_BYTES RT_BIT(4)
|
---|
1662 | /** No address in the output. */
|
---|
1663 | #define DBGF_DISAS_FLAGS_NO_ADDRESS RT_BIT(5)
|
---|
1664 | /** Disassemble original unpatched bytes (PATM). */
|
---|
1665 | #define DBGF_DISAS_FLAGS_UNPATCHED_BYTES RT_BIT(7)
|
---|
1666 | /** Annotate patched instructions. */
|
---|
1667 | #define DBGF_DISAS_FLAGS_ANNOTATE_PATCHED RT_BIT(8)
|
---|
1668 | /** Disassemble in the default mode of the specific context. */
|
---|
1669 | #define DBGF_DISAS_FLAGS_DEFAULT_MODE UINT32_C(0x00000000)
|
---|
1670 | /** Disassemble in 16-bit mode. */
|
---|
1671 | #define DBGF_DISAS_FLAGS_16BIT_MODE UINT32_C(0x10000000)
|
---|
1672 | /** Disassemble in 16-bit mode with real mode address translation. */
|
---|
1673 | #define DBGF_DISAS_FLAGS_16BIT_REAL_MODE UINT32_C(0x20000000)
|
---|
1674 | /** Disassemble in 32-bit mode. */
|
---|
1675 | #define DBGF_DISAS_FLAGS_32BIT_MODE UINT32_C(0x30000000)
|
---|
1676 | /** Disassemble in 64-bit mode. */
|
---|
1677 | #define DBGF_DISAS_FLAGS_64BIT_MODE UINT32_C(0x40000000)
|
---|
1678 | /** The disassembly mode mask. */
|
---|
1679 | #define DBGF_DISAS_FLAGS_MODE_MASK UINT32_C(0x70000000)
|
---|
1680 | /** Mask containing the valid flags. */
|
---|
1681 | #define DBGF_DISAS_FLAGS_VALID_MASK UINT32_C(0x700001ff)
|
---|
1682 | /** @} */
|
---|
1683 |
|
---|
1684 | /** Special flat selector. */
|
---|
1685 | #define DBGF_SEL_FLAT 1
|
---|
1686 |
|
---|
1687 | VMMR3DECL(int) DBGFR3DisasInstrEx(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, RTGCPTR GCPtr, uint32_t fFlags,
|
---|
1688 | char *pszOutput, uint32_t cbOutput, uint32_t *pcbInstr);
|
---|
1689 | VMMR3_INT_DECL(int) DBGFR3DisasInstrCurrent(PVMCPU pVCpu, char *pszOutput, uint32_t cbOutput);
|
---|
1690 | VMMR3DECL(int) DBGFR3DisasInstrCurrentLogInternal(PVMCPU pVCpu, const char *pszPrefix);
|
---|
1691 |
|
---|
1692 | /** @def DBGFR3_DISAS_INSTR_CUR_LOG
|
---|
1693 | * Disassembles the current guest context instruction and writes it to the log.
|
---|
1694 | * All registers and data will be displayed. Addresses will be attempted resolved to symbols.
|
---|
1695 | */
|
---|
1696 | #ifdef LOG_ENABLED
|
---|
1697 | # define DBGFR3_DISAS_INSTR_CUR_LOG(pVCpu, pszPrefix) \
|
---|
1698 | do { \
|
---|
1699 | if (LogIsEnabled()) \
|
---|
1700 | DBGFR3DisasInstrCurrentLogInternal(pVCpu, pszPrefix); \
|
---|
1701 | } while (0)
|
---|
1702 | #else
|
---|
1703 | # define DBGFR3_DISAS_INSTR_CUR_LOG(pVCpu, pszPrefix) do { } while (0)
|
---|
1704 | #endif
|
---|
1705 |
|
---|
1706 | VMMR3DECL(int) DBGFR3DisasInstrLogInternal(PVMCPU pVCpu, RTSEL Sel, RTGCPTR GCPtr, const char *pszPrefix);
|
---|
1707 |
|
---|
1708 | /** @def DBGFR3_DISAS_INSTR_LOG
|
---|
1709 | * Disassembles the specified guest context instruction and writes it to the log.
|
---|
1710 | * Addresses will be attempted resolved to symbols.
|
---|
1711 | * @thread Any EMT.
|
---|
1712 | */
|
---|
1713 | # ifdef LOG_ENABLED
|
---|
1714 | # define DBGFR3_DISAS_INSTR_LOG(pVCpu, Sel, GCPtr, pszPrefix) \
|
---|
1715 | do { \
|
---|
1716 | if (LogIsEnabled()) \
|
---|
1717 | DBGFR3DisasInstrLogInternal(pVCpu, Sel, GCPtr, pszPrefix); \
|
---|
1718 | } while (0)
|
---|
1719 | # else
|
---|
1720 | # define DBGFR3_DISAS_INSTR_LOG(pVCpu, Sel, GCPtr, pszPrefix) do { } while (0)
|
---|
1721 | # endif
|
---|
1722 | #endif
|
---|
1723 |
|
---|
1724 |
|
---|
1725 | #ifdef IN_RING3
|
---|
1726 | VMMR3DECL(int) DBGFR3MemScan(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, RTGCUINTPTR uAlign,
|
---|
1727 | const void *pvNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress);
|
---|
1728 | VMMR3DECL(int) DBGFR3MemRead(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead);
|
---|
1729 | VMMR3DECL(int) DBGFR3MemReadString(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cbBuf);
|
---|
1730 | VMMR3DECL(int) DBGFR3MemWrite(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void const *pvBuf, size_t cbRead);
|
---|
1731 | #endif
|
---|
1732 |
|
---|
1733 |
|
---|
1734 | /** @name Flags for DBGFR3PagingDumpEx, PGMR3DumpHierarchyHCEx and
|
---|
1735 | * PGMR3DumpHierarchyGCEx
|
---|
1736 | * @{ */
|
---|
1737 | /** The CR3 from the current CPU state. */
|
---|
1738 | #define DBGFPGDMP_FLAGS_CURRENT_CR3 RT_BIT_32(0)
|
---|
1739 | /** The current CPU paging mode (PSE, PAE, LM, EPT, NX). */
|
---|
1740 | #define DBGFPGDMP_FLAGS_CURRENT_MODE RT_BIT_32(1)
|
---|
1741 | /** Whether PSE is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
|
---|
1742 | * Same value as X86_CR4_PSE. */
|
---|
1743 | #define DBGFPGDMP_FLAGS_PSE RT_BIT_32(4) /* */
|
---|
1744 | /** Whether PAE is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
|
---|
1745 | * Same value as X86_CR4_PAE. */
|
---|
1746 | #define DBGFPGDMP_FLAGS_PAE RT_BIT_32(5) /* */
|
---|
1747 | /** Whether LME is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
|
---|
1748 | * Same value as MSR_K6_EFER_LME. */
|
---|
1749 | #define DBGFPGDMP_FLAGS_LME RT_BIT_32(8)
|
---|
1750 | /** Whether nested paging is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE). */
|
---|
1751 | #define DBGFPGDMP_FLAGS_NP RT_BIT_32(9)
|
---|
1752 | /** Whether extended nested page tables are enabled
|
---|
1753 | * (!DBGFPGDMP_FLAGS_CURRENT_STATE). */
|
---|
1754 | #define DBGFPGDMP_FLAGS_EPT RT_BIT_32(10)
|
---|
1755 | /** Whether no-execution is enabled (!DBGFPGDMP_FLAGS_CURRENT_STATE).
|
---|
1756 | * Same value as MSR_K6_EFER_NXE. */
|
---|
1757 | #define DBGFPGDMP_FLAGS_NXE RT_BIT_32(11)
|
---|
1758 | /** Whether to print the CR3. */
|
---|
1759 | #define DBGFPGDMP_FLAGS_PRINT_CR3 RT_BIT_32(27)
|
---|
1760 | /** Whether to print the header. */
|
---|
1761 | #define DBGFPGDMP_FLAGS_HEADER RT_BIT_32(28)
|
---|
1762 | /** Whether to dump additional page information. */
|
---|
1763 | #define DBGFPGDMP_FLAGS_PAGE_INFO RT_BIT_32(29)
|
---|
1764 | /** Dump the shadow tables if set.
|
---|
1765 | * Cannot be used together with DBGFPGDMP_FLAGS_GUEST. */
|
---|
1766 | #define DBGFPGDMP_FLAGS_SHADOW RT_BIT_32(30)
|
---|
1767 | /** Dump the guest tables if set.
|
---|
1768 | * Cannot be used together with DBGFPGDMP_FLAGS_SHADOW. */
|
---|
1769 | #define DBGFPGDMP_FLAGS_GUEST RT_BIT_32(31)
|
---|
1770 | /** Mask of valid bits. */
|
---|
1771 | #define DBGFPGDMP_FLAGS_VALID_MASK UINT32_C(0xf8000f33)
|
---|
1772 | /** The mask of bits controlling the paging mode. */
|
---|
1773 | #define DBGFPGDMP_FLAGS_MODE_MASK UINT32_C(0x00000f32)
|
---|
1774 | /** @} */
|
---|
1775 | VMMDECL(int) DBGFR3PagingDumpEx(PUVM pUVM, VMCPUID idCpu, uint32_t fFlags, uint64_t cr3, uint64_t u64FirstAddr,
|
---|
1776 | uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp);
|
---|
1777 |
|
---|
1778 |
|
---|
1779 | /** @name DBGFR3SelQueryInfo flags.
|
---|
1780 | * @{ */
|
---|
1781 | /** Get the info from the guest descriptor table.
|
---|
1782 | * @note This is more or less a given now when raw-mode was kicked out. */
|
---|
1783 | #define DBGFSELQI_FLAGS_DT_GUEST UINT32_C(0)
|
---|
1784 | /** If currently executing in in 64-bit mode, blow up data selectors. */
|
---|
1785 | #define DBGFSELQI_FLAGS_DT_ADJ_64BIT_MODE UINT32_C(2)
|
---|
1786 | /** @} */
|
---|
1787 | VMMR3DECL(int) DBGFR3SelQueryInfo(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo);
|
---|
1788 |
|
---|
1789 |
|
---|
1790 | /**
|
---|
1791 | * Register identifiers.
|
---|
1792 | */
|
---|
1793 | typedef enum DBGFREG
|
---|
1794 | {
|
---|
1795 | /* General purpose registers: */
|
---|
1796 | DBGFREG_AL = 0,
|
---|
1797 | DBGFREG_AX = DBGFREG_AL,
|
---|
1798 | DBGFREG_EAX = DBGFREG_AL,
|
---|
1799 | DBGFREG_RAX = DBGFREG_AL,
|
---|
1800 |
|
---|
1801 | DBGFREG_CL,
|
---|
1802 | DBGFREG_CX = DBGFREG_CL,
|
---|
1803 | DBGFREG_ECX = DBGFREG_CL,
|
---|
1804 | DBGFREG_RCX = DBGFREG_CL,
|
---|
1805 |
|
---|
1806 | DBGFREG_DL,
|
---|
1807 | DBGFREG_DX = DBGFREG_DL,
|
---|
1808 | DBGFREG_EDX = DBGFREG_DL,
|
---|
1809 | DBGFREG_RDX = DBGFREG_DL,
|
---|
1810 |
|
---|
1811 | DBGFREG_BL,
|
---|
1812 | DBGFREG_BX = DBGFREG_BL,
|
---|
1813 | DBGFREG_EBX = DBGFREG_BL,
|
---|
1814 | DBGFREG_RBX = DBGFREG_BL,
|
---|
1815 |
|
---|
1816 | DBGFREG_SPL,
|
---|
1817 | DBGFREG_SP = DBGFREG_SPL,
|
---|
1818 | DBGFREG_ESP = DBGFREG_SPL,
|
---|
1819 | DBGFREG_RSP = DBGFREG_SPL,
|
---|
1820 |
|
---|
1821 | DBGFREG_BPL,
|
---|
1822 | DBGFREG_BP = DBGFREG_BPL,
|
---|
1823 | DBGFREG_EBP = DBGFREG_BPL,
|
---|
1824 | DBGFREG_RBP = DBGFREG_BPL,
|
---|
1825 |
|
---|
1826 | DBGFREG_SIL,
|
---|
1827 | DBGFREG_SI = DBGFREG_SIL,
|
---|
1828 | DBGFREG_ESI = DBGFREG_SIL,
|
---|
1829 | DBGFREG_RSI = DBGFREG_SIL,
|
---|
1830 |
|
---|
1831 | DBGFREG_DIL,
|
---|
1832 | DBGFREG_DI = DBGFREG_DIL,
|
---|
1833 | DBGFREG_EDI = DBGFREG_DIL,
|
---|
1834 | DBGFREG_RDI = DBGFREG_DIL,
|
---|
1835 |
|
---|
1836 | DBGFREG_R8,
|
---|
1837 | DBGFREG_R8B = DBGFREG_R8,
|
---|
1838 | DBGFREG_R8W = DBGFREG_R8,
|
---|
1839 | DBGFREG_R8D = DBGFREG_R8,
|
---|
1840 |
|
---|
1841 | DBGFREG_R9,
|
---|
1842 | DBGFREG_R9B = DBGFREG_R9,
|
---|
1843 | DBGFREG_R9W = DBGFREG_R9,
|
---|
1844 | DBGFREG_R9D = DBGFREG_R9,
|
---|
1845 |
|
---|
1846 | DBGFREG_R10,
|
---|
1847 | DBGFREG_R10B = DBGFREG_R10,
|
---|
1848 | DBGFREG_R10W = DBGFREG_R10,
|
---|
1849 | DBGFREG_R10D = DBGFREG_R10,
|
---|
1850 |
|
---|
1851 | DBGFREG_R11,
|
---|
1852 | DBGFREG_R11B = DBGFREG_R11,
|
---|
1853 | DBGFREG_R11W = DBGFREG_R11,
|
---|
1854 | DBGFREG_R11D = DBGFREG_R11,
|
---|
1855 |
|
---|
1856 | DBGFREG_R12,
|
---|
1857 | DBGFREG_R12B = DBGFREG_R12,
|
---|
1858 | DBGFREG_R12W = DBGFREG_R12,
|
---|
1859 | DBGFREG_R12D = DBGFREG_R12,
|
---|
1860 |
|
---|
1861 | DBGFREG_R13,
|
---|
1862 | DBGFREG_R13B = DBGFREG_R13,
|
---|
1863 | DBGFREG_R13W = DBGFREG_R13,
|
---|
1864 | DBGFREG_R13D = DBGFREG_R13,
|
---|
1865 |
|
---|
1866 | DBGFREG_R14,
|
---|
1867 | DBGFREG_R14B = DBGFREG_R14,
|
---|
1868 | DBGFREG_R14W = DBGFREG_R14,
|
---|
1869 | DBGFREG_R14D = DBGFREG_R14,
|
---|
1870 |
|
---|
1871 | DBGFREG_R15,
|
---|
1872 | DBGFREG_R15B = DBGFREG_R15,
|
---|
1873 | DBGFREG_R15W = DBGFREG_R15,
|
---|
1874 | DBGFREG_R15D = DBGFREG_R15,
|
---|
1875 |
|
---|
1876 | /* Segments and other special registers: */
|
---|
1877 | DBGFREG_CS,
|
---|
1878 | DBGFREG_CS_ATTR,
|
---|
1879 | DBGFREG_CS_BASE,
|
---|
1880 | DBGFREG_CS_LIMIT,
|
---|
1881 |
|
---|
1882 | DBGFREG_DS,
|
---|
1883 | DBGFREG_DS_ATTR,
|
---|
1884 | DBGFREG_DS_BASE,
|
---|
1885 | DBGFREG_DS_LIMIT,
|
---|
1886 |
|
---|
1887 | DBGFREG_ES,
|
---|
1888 | DBGFREG_ES_ATTR,
|
---|
1889 | DBGFREG_ES_BASE,
|
---|
1890 | DBGFREG_ES_LIMIT,
|
---|
1891 |
|
---|
1892 | DBGFREG_FS,
|
---|
1893 | DBGFREG_FS_ATTR,
|
---|
1894 | DBGFREG_FS_BASE,
|
---|
1895 | DBGFREG_FS_LIMIT,
|
---|
1896 |
|
---|
1897 | DBGFREG_GS,
|
---|
1898 | DBGFREG_GS_ATTR,
|
---|
1899 | DBGFREG_GS_BASE,
|
---|
1900 | DBGFREG_GS_LIMIT,
|
---|
1901 |
|
---|
1902 | DBGFREG_SS,
|
---|
1903 | DBGFREG_SS_ATTR,
|
---|
1904 | DBGFREG_SS_BASE,
|
---|
1905 | DBGFREG_SS_LIMIT,
|
---|
1906 |
|
---|
1907 | DBGFREG_IP,
|
---|
1908 | DBGFREG_EIP = DBGFREG_IP,
|
---|
1909 | DBGFREG_RIP = DBGFREG_IP,
|
---|
1910 |
|
---|
1911 | DBGFREG_FLAGS,
|
---|
1912 | DBGFREG_EFLAGS = DBGFREG_FLAGS,
|
---|
1913 | DBGFREG_RFLAGS = DBGFREG_FLAGS,
|
---|
1914 |
|
---|
1915 | /* FPU: */
|
---|
1916 | DBGFREG_FCW,
|
---|
1917 | DBGFREG_FSW,
|
---|
1918 | DBGFREG_FTW,
|
---|
1919 | DBGFREG_FOP,
|
---|
1920 | DBGFREG_FPUIP,
|
---|
1921 | DBGFREG_FPUCS,
|
---|
1922 | DBGFREG_FPUDP,
|
---|
1923 | DBGFREG_FPUDS,
|
---|
1924 | DBGFREG_MXCSR,
|
---|
1925 | DBGFREG_MXCSR_MASK,
|
---|
1926 |
|
---|
1927 | DBGFREG_ST0,
|
---|
1928 | DBGFREG_ST1,
|
---|
1929 | DBGFREG_ST2,
|
---|
1930 | DBGFREG_ST3,
|
---|
1931 | DBGFREG_ST4,
|
---|
1932 | DBGFREG_ST5,
|
---|
1933 | DBGFREG_ST6,
|
---|
1934 | DBGFREG_ST7,
|
---|
1935 |
|
---|
1936 | DBGFREG_MM0,
|
---|
1937 | DBGFREG_MM1,
|
---|
1938 | DBGFREG_MM2,
|
---|
1939 | DBGFREG_MM3,
|
---|
1940 | DBGFREG_MM4,
|
---|
1941 | DBGFREG_MM5,
|
---|
1942 | DBGFREG_MM6,
|
---|
1943 | DBGFREG_MM7,
|
---|
1944 |
|
---|
1945 | /* SSE: */
|
---|
1946 | DBGFREG_XMM0,
|
---|
1947 | DBGFREG_XMM1,
|
---|
1948 | DBGFREG_XMM2,
|
---|
1949 | DBGFREG_XMM3,
|
---|
1950 | DBGFREG_XMM4,
|
---|
1951 | DBGFREG_XMM5,
|
---|
1952 | DBGFREG_XMM6,
|
---|
1953 | DBGFREG_XMM7,
|
---|
1954 | DBGFREG_XMM8,
|
---|
1955 | DBGFREG_XMM9,
|
---|
1956 | DBGFREG_XMM10,
|
---|
1957 | DBGFREG_XMM11,
|
---|
1958 | DBGFREG_XMM12,
|
---|
1959 | DBGFREG_XMM13,
|
---|
1960 | DBGFREG_XMM14,
|
---|
1961 | DBGFREG_XMM15,
|
---|
1962 | /** @todo add XMM aliases. */
|
---|
1963 |
|
---|
1964 | /* AVX: */
|
---|
1965 | DBGFREG_YMM0,
|
---|
1966 | DBGFREG_YMM1,
|
---|
1967 | DBGFREG_YMM2,
|
---|
1968 | DBGFREG_YMM3,
|
---|
1969 | DBGFREG_YMM4,
|
---|
1970 | DBGFREG_YMM5,
|
---|
1971 | DBGFREG_YMM6,
|
---|
1972 | DBGFREG_YMM7,
|
---|
1973 | DBGFREG_YMM8,
|
---|
1974 | DBGFREG_YMM9,
|
---|
1975 | DBGFREG_YMM10,
|
---|
1976 | DBGFREG_YMM11,
|
---|
1977 | DBGFREG_YMM12,
|
---|
1978 | DBGFREG_YMM13,
|
---|
1979 | DBGFREG_YMM14,
|
---|
1980 | DBGFREG_YMM15,
|
---|
1981 |
|
---|
1982 | /* System registers: */
|
---|
1983 | DBGFREG_GDTR_BASE,
|
---|
1984 | DBGFREG_GDTR_LIMIT,
|
---|
1985 | DBGFREG_IDTR_BASE,
|
---|
1986 | DBGFREG_IDTR_LIMIT,
|
---|
1987 | DBGFREG_LDTR,
|
---|
1988 | DBGFREG_LDTR_ATTR,
|
---|
1989 | DBGFREG_LDTR_BASE,
|
---|
1990 | DBGFREG_LDTR_LIMIT,
|
---|
1991 | DBGFREG_TR,
|
---|
1992 | DBGFREG_TR_ATTR,
|
---|
1993 | DBGFREG_TR_BASE,
|
---|
1994 | DBGFREG_TR_LIMIT,
|
---|
1995 |
|
---|
1996 | DBGFREG_CR0,
|
---|
1997 | DBGFREG_CR2,
|
---|
1998 | DBGFREG_CR3,
|
---|
1999 | DBGFREG_CR4,
|
---|
2000 | DBGFREG_CR8,
|
---|
2001 |
|
---|
2002 | DBGFREG_DR0,
|
---|
2003 | DBGFREG_DR1,
|
---|
2004 | DBGFREG_DR2,
|
---|
2005 | DBGFREG_DR3,
|
---|
2006 | DBGFREG_DR6,
|
---|
2007 | DBGFREG_DR7,
|
---|
2008 |
|
---|
2009 | /* MSRs: */
|
---|
2010 | DBGFREG_MSR_IA32_APICBASE,
|
---|
2011 | DBGFREG_MSR_IA32_CR_PAT,
|
---|
2012 | DBGFREG_MSR_IA32_PERF_STATUS,
|
---|
2013 | DBGFREG_MSR_IA32_SYSENTER_CS,
|
---|
2014 | DBGFREG_MSR_IA32_SYSENTER_EIP,
|
---|
2015 | DBGFREG_MSR_IA32_SYSENTER_ESP,
|
---|
2016 | DBGFREG_MSR_IA32_TSC,
|
---|
2017 | DBGFREG_MSR_K6_EFER,
|
---|
2018 | DBGFREG_MSR_K6_STAR,
|
---|
2019 | DBGFREG_MSR_K8_CSTAR,
|
---|
2020 | DBGFREG_MSR_K8_FS_BASE,
|
---|
2021 | DBGFREG_MSR_K8_GS_BASE,
|
---|
2022 | DBGFREG_MSR_K8_KERNEL_GS_BASE,
|
---|
2023 | DBGFREG_MSR_K8_LSTAR,
|
---|
2024 | DBGFREG_MSR_K8_SF_MASK,
|
---|
2025 | DBGFREG_MSR_K8_TSC_AUX,
|
---|
2026 |
|
---|
2027 | /** The number of registers to pass to DBGFR3RegQueryAll. */
|
---|
2028 | DBGFREG_ALL_COUNT,
|
---|
2029 |
|
---|
2030 | /* Misc aliases that doesn't need be part of the 'all' query: */
|
---|
2031 | DBGFREG_AH = DBGFREG_ALL_COUNT,
|
---|
2032 | DBGFREG_CH,
|
---|
2033 | DBGFREG_DH,
|
---|
2034 | DBGFREG_BH,
|
---|
2035 | DBGFREG_GDTR,
|
---|
2036 | DBGFREG_IDTR,
|
---|
2037 |
|
---|
2038 | /** The end of the registers. */
|
---|
2039 | DBGFREG_END,
|
---|
2040 | /** The usual 32-bit type hack. */
|
---|
2041 | DBGFREG_32BIT_HACK = 0x7fffffff
|
---|
2042 | } DBGFREG;
|
---|
2043 | /** Pointer to a register identifier. */
|
---|
2044 | typedef DBGFREG *PDBGFREG;
|
---|
2045 | /** Pointer to a const register identifier. */
|
---|
2046 | typedef DBGFREG const *PCDBGFREG;
|
---|
2047 |
|
---|
2048 | /**
|
---|
2049 | * Register value type.
|
---|
2050 | */
|
---|
2051 | typedef enum DBGFREGVALTYPE
|
---|
2052 | {
|
---|
2053 | DBGFREGVALTYPE_INVALID = 0,
|
---|
2054 | /** Unsigned 8-bit register value. */
|
---|
2055 | DBGFREGVALTYPE_U8,
|
---|
2056 | /** Unsigned 16-bit register value. */
|
---|
2057 | DBGFREGVALTYPE_U16,
|
---|
2058 | /** Unsigned 32-bit register value. */
|
---|
2059 | DBGFREGVALTYPE_U32,
|
---|
2060 | /** Unsigned 64-bit register value. */
|
---|
2061 | DBGFREGVALTYPE_U64,
|
---|
2062 | /** Unsigned 128-bit register value. */
|
---|
2063 | DBGFREGVALTYPE_U128,
|
---|
2064 | /** Unsigned 256-bit register value. */
|
---|
2065 | DBGFREGVALTYPE_U256,
|
---|
2066 | /** Unsigned 512-bit register value. */
|
---|
2067 | DBGFREGVALTYPE_U512,
|
---|
2068 | /** Long double register value. */
|
---|
2069 | DBGFREGVALTYPE_R80,
|
---|
2070 | /** Descriptor table register value. */
|
---|
2071 | DBGFREGVALTYPE_DTR,
|
---|
2072 | /** End of the valid register value types. */
|
---|
2073 | DBGFREGVALTYPE_END,
|
---|
2074 | /** The usual 32-bit type hack. */
|
---|
2075 | DBGFREGVALTYPE_32BIT_HACK = 0x7fffffff
|
---|
2076 | } DBGFREGVALTYPE;
|
---|
2077 | /** Pointer to a register value type. */
|
---|
2078 | typedef DBGFREGVALTYPE *PDBGFREGVALTYPE;
|
---|
2079 |
|
---|
2080 | /**
|
---|
2081 | * A generic register value type.
|
---|
2082 | */
|
---|
2083 | typedef union DBGFREGVAL
|
---|
2084 | {
|
---|
2085 | uint64_t au64[8]; /**< The 64-bit array view. First because of the initializer. */
|
---|
2086 | uint32_t au32[16]; /**< The 32-bit array view. */
|
---|
2087 | uint16_t au16[32]; /**< The 16-bit array view. */
|
---|
2088 | uint8_t au8[64]; /**< The 8-bit array view. */
|
---|
2089 |
|
---|
2090 | uint8_t u8; /**< The 8-bit view. */
|
---|
2091 | uint16_t u16; /**< The 16-bit view. */
|
---|
2092 | uint32_t u32; /**< The 32-bit view. */
|
---|
2093 | uint64_t u64; /**< The 64-bit view. */
|
---|
2094 | RTUINT128U u128; /**< The 128-bit view. */
|
---|
2095 | RTUINT256U u256; /**< The 256-bit view. */
|
---|
2096 | RTUINT512U u512; /**< The 512-bit view. */
|
---|
2097 | RTFLOAT80U r80; /**< The 80-bit floating point view. */
|
---|
2098 | RTFLOAT80U2 r80Ex; /**< The 80-bit floating point view v2. */
|
---|
2099 | /** GDTR or LDTR (DBGFREGVALTYPE_DTR). */
|
---|
2100 | struct
|
---|
2101 | {
|
---|
2102 | /** The table address. */
|
---|
2103 | uint64_t u64Base;
|
---|
2104 | /** The table limit (length minus 1). */
|
---|
2105 | uint32_t u32Limit; /**< @todo Limit should be uint16_t */
|
---|
2106 | } dtr;
|
---|
2107 | } DBGFREGVAL;
|
---|
2108 | /** Pointer to a generic register value type. */
|
---|
2109 | typedef DBGFREGVAL *PDBGFREGVAL;
|
---|
2110 | /** Pointer to a const generic register value type. */
|
---|
2111 | typedef DBGFREGVAL const *PCDBGFREGVAL;
|
---|
2112 |
|
---|
2113 | /** Initialize a DBGFREGVAL variable to all zeros. */
|
---|
2114 | #define DBGFREGVAL_INITIALIZE_ZERO { { 0, 0, 0, 0, 0, 0, 0, 0 } }
|
---|
2115 | /** Initialize a DBGFREGVAL variable to all bits set . */
|
---|
2116 | #define DBGFREGVAL_INITIALIZE_FFFF { { UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX, UINT64_MAX } }
|
---|
2117 |
|
---|
2118 | /**
|
---|
2119 | * Extended register value, including register ID and type.
|
---|
2120 | *
|
---|
2121 | * This is currently only used by the stack walker.
|
---|
2122 | */
|
---|
2123 | typedef struct DBGFREGVALEX
|
---|
2124 | {
|
---|
2125 | /** The register value. */
|
---|
2126 | DBGFREGVAL Value;
|
---|
2127 | /** The register value type. */
|
---|
2128 | DBGFREGVALTYPE enmType;
|
---|
2129 | /** The register ID, DBGFREG_END if not applicable. */
|
---|
2130 | DBGFREG enmReg;
|
---|
2131 | /** Pointer to read-only register name string if no register ID could be found. */
|
---|
2132 | const char *pszName;
|
---|
2133 | } DBGFREGVALEX;
|
---|
2134 | /** Pointer to an extended register value struct. */
|
---|
2135 | typedef DBGFREGVALEX *PDBGFREGVALEX;
|
---|
2136 | /** Pointer to a const extended register value struct. */
|
---|
2137 | typedef DBGFREGVALEX const *PCDBGFREGVALEX;
|
---|
2138 |
|
---|
2139 |
|
---|
2140 | VMMDECL(ssize_t) DBGFR3RegFormatValue(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, bool fSpecial);
|
---|
2141 | VMMDECL(ssize_t) DBGFR3RegFormatValueEx(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType,
|
---|
2142 | unsigned uBase, signed int cchWidth, signed int cchPrecision, uint32_t fFlags);
|
---|
2143 |
|
---|
2144 | /**
|
---|
2145 | * Register sub-field descriptor.
|
---|
2146 | */
|
---|
2147 | typedef struct DBGFREGSUBFIELD
|
---|
2148 | {
|
---|
2149 | /** The name of the sub-field. NULL is used to terminate the array. */
|
---|
2150 | const char *pszName;
|
---|
2151 | /** The index of the first bit. Ignored if pfnGet is set. */
|
---|
2152 | uint8_t iFirstBit;
|
---|
2153 | /** The number of bits. Mandatory. */
|
---|
2154 | uint8_t cBits;
|
---|
2155 | /** The shift count. Not applied when pfnGet is set, but used to
|
---|
2156 | * calculate the minimum type. */
|
---|
2157 | int8_t cShift;
|
---|
2158 | /** Sub-field flags, DBGFREGSUBFIELD_FLAGS_XXX. */
|
---|
2159 | uint8_t fFlags;
|
---|
2160 | /** Getter (optional).
|
---|
2161 | * @remarks Does not take the device lock or anything like that.
|
---|
2162 | */
|
---|
2163 | DECLCALLBACKMEMBER(int, pfnGet,(void *pvUser, struct DBGFREGSUBFIELD const *pSubField, PRTUINT128U puValue));
|
---|
2164 | /** Setter (optional).
|
---|
2165 | * @remarks Does not take the device lock or anything like that.
|
---|
2166 | */
|
---|
2167 | DECLCALLBACKMEMBER(int, pfnSet,(void *pvUser, struct DBGFREGSUBFIELD const *pSubField, RTUINT128U uValue, RTUINT128U fMask));
|
---|
2168 | } DBGFREGSUBFIELD;
|
---|
2169 | /** Pointer to a const register sub-field descriptor. */
|
---|
2170 | typedef DBGFREGSUBFIELD const *PCDBGFREGSUBFIELD;
|
---|
2171 |
|
---|
2172 | /** @name DBGFREGSUBFIELD_FLAGS_XXX
|
---|
2173 | * @{ */
|
---|
2174 | /** The sub-field is read-only. */
|
---|
2175 | #define DBGFREGSUBFIELD_FLAGS_READ_ONLY UINT8_C(0x01)
|
---|
2176 | /** @} */
|
---|
2177 |
|
---|
2178 | /** Macro for creating a read-write sub-field entry without getters. */
|
---|
2179 | #define DBGFREGSUBFIELD_RW(a_szName, a_iFirstBit, a_cBits, a_cShift) \
|
---|
2180 | { a_szName, a_iFirstBit, a_cBits, a_cShift, 0 /*fFlags*/, NULL /*pfnGet*/, NULL /*pfnSet*/ }
|
---|
2181 | /** Macro for creating a read-write sub-field entry with getters. */
|
---|
2182 | #define DBGFREGSUBFIELD_RW_SG(a_szName, a_cBits, a_cShift, a_pfnGet, a_pfnSet) \
|
---|
2183 | { a_szName, 0 /*iFirstBit*/, a_cBits, a_cShift, 0 /*fFlags*/, a_pfnGet, a_pfnSet }
|
---|
2184 | /** Macro for creating a read-only sub-field entry without getters. */
|
---|
2185 | #define DBGFREGSUBFIELD_RO(a_szName, a_iFirstBit, a_cBits, a_cShift) \
|
---|
2186 | { a_szName, a_iFirstBit, a_cBits, a_cShift, DBGFREGSUBFIELD_FLAGS_READ_ONLY, NULL /*pfnGet*/, NULL /*pfnSet*/ }
|
---|
2187 | /** Macro for creating a terminator sub-field entry. */
|
---|
2188 | #define DBGFREGSUBFIELD_TERMINATOR() \
|
---|
2189 | { NULL, 0, 0, 0, 0, NULL, NULL }
|
---|
2190 |
|
---|
2191 | /**
|
---|
2192 | * Register alias descriptor.
|
---|
2193 | */
|
---|
2194 | typedef struct DBGFREGALIAS
|
---|
2195 | {
|
---|
2196 | /** The alias name. NULL is used to terminate the array. */
|
---|
2197 | const char *pszName;
|
---|
2198 | /** Set to a valid type if the alias has a different type. */
|
---|
2199 | DBGFREGVALTYPE enmType;
|
---|
2200 | } DBGFREGALIAS;
|
---|
2201 | /** Pointer to a const register alias descriptor. */
|
---|
2202 | typedef DBGFREGALIAS const *PCDBGFREGALIAS;
|
---|
2203 |
|
---|
2204 | /**
|
---|
2205 | * Register descriptor.
|
---|
2206 | */
|
---|
2207 | typedef struct DBGFREGDESC
|
---|
2208 | {
|
---|
2209 | /** The normal register name. */
|
---|
2210 | const char *pszName;
|
---|
2211 | /** The register identifier if this is a CPU register. */
|
---|
2212 | DBGFREG enmReg;
|
---|
2213 | /** The default register type. */
|
---|
2214 | DBGFREGVALTYPE enmType;
|
---|
2215 | /** Flags, see DBGFREG_FLAGS_XXX. */
|
---|
2216 | uint32_t fFlags;
|
---|
2217 | /** The internal register indicator.
|
---|
2218 | * For CPU registers this is the offset into the CPUMCTX structure,
|
---|
2219 | * thuse the 'off' prefix. */
|
---|
2220 | uint32_t offRegister;
|
---|
2221 | /** Getter.
|
---|
2222 | * @remarks Does not take the device lock or anything like that.
|
---|
2223 | */
|
---|
2224 | DECLCALLBACKMEMBER(int, pfnGet,(void *pvUser, struct DBGFREGDESC const *pDesc, PDBGFREGVAL pValue));
|
---|
2225 | /** Setter.
|
---|
2226 | * @remarks Does not take the device lock or anything like that.
|
---|
2227 | */
|
---|
2228 | DECLCALLBACKMEMBER(int, pfnSet,(void *pvUser, struct DBGFREGDESC const *pDesc, PCDBGFREGVAL pValue, PCDBGFREGVAL pfMask));
|
---|
2229 | /** Aliases (optional). */
|
---|
2230 | PCDBGFREGALIAS paAliases;
|
---|
2231 | /** Sub fields (optional). */
|
---|
2232 | PCDBGFREGSUBFIELD paSubFields;
|
---|
2233 | } DBGFREGDESC;
|
---|
2234 |
|
---|
2235 | /** @name Macros for constructing DBGFREGDESC arrays.
|
---|
2236 | * @{ */
|
---|
2237 | #define DBGFREGDESC_RW(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet) \
|
---|
2238 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, NULL /*paAlises*/, NULL /*paSubFields*/ }
|
---|
2239 | #define DBGFREGDESC_RO(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet) \
|
---|
2240 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, NULL /*paAlises*/, NULL /*paSubFields*/ }
|
---|
2241 | #define DBGFREGDESC_RW_A(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases) \
|
---|
2242 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, NULL /*paSubFields*/ }
|
---|
2243 | #define DBGFREGDESC_RO_A(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases) \
|
---|
2244 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, NULL /*paSubFields*/ }
|
---|
2245 | #define DBGFREGDESC_RW_S(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paSubFields) \
|
---|
2246 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, /*paAliases*/, a_paSubFields }
|
---|
2247 | #define DBGFREGDESC_RO_S(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paSubFields) \
|
---|
2248 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, /*paAliases*/, a_paSubFields }
|
---|
2249 | #define DBGFREGDESC_RW_AS(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
|
---|
2250 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, 0 /*fFlags*/, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
|
---|
2251 | #define DBGFREGDESC_RO_AS(a_szName, a_TypeSuff, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields) \
|
---|
2252 | { a_szName, DBGFREG_END, DBGFREGVALTYPE_##a_TypeSuff, DBGFREG_FLAGS_READ_ONLY, a_offRegister, a_pfnGet, a_pfnSet, a_paAliases, a_paSubFields }
|
---|
2253 | #define DBGFREGDESC_TERMINATOR() \
|
---|
2254 | { NULL, DBGFREG_END, DBGFREGVALTYPE_INVALID, 0, 0, NULL, NULL, NULL, NULL }
|
---|
2255 | /** @} */
|
---|
2256 |
|
---|
2257 |
|
---|
2258 | /** @name DBGFREG_FLAGS_XXX
|
---|
2259 | * @{ */
|
---|
2260 | /** The register is read-only. */
|
---|
2261 | #define DBGFREG_FLAGS_READ_ONLY RT_BIT_32(0)
|
---|
2262 | /** @} */
|
---|
2263 |
|
---|
2264 | /**
|
---|
2265 | * Entry in a batch query or set operation.
|
---|
2266 | */
|
---|
2267 | typedef struct DBGFREGENTRY
|
---|
2268 | {
|
---|
2269 | /** The register identifier. */
|
---|
2270 | DBGFREG enmReg;
|
---|
2271 | /** The size of the value in bytes. */
|
---|
2272 | DBGFREGVALTYPE enmType;
|
---|
2273 | /** The register value. The valid view is indicated by enmType. */
|
---|
2274 | DBGFREGVAL Val;
|
---|
2275 | } DBGFREGENTRY;
|
---|
2276 | /** Pointer to a register entry in a batch operation. */
|
---|
2277 | typedef DBGFREGENTRY *PDBGFREGENTRY;
|
---|
2278 | /** Pointer to a const register entry in a batch operation. */
|
---|
2279 | typedef DBGFREGENTRY const *PCDBGFREGENTRY;
|
---|
2280 |
|
---|
2281 | /** Used with DBGFR3Reg* to indicate the hypervisor register set instead of the
|
---|
2282 | * guest. */
|
---|
2283 | #define DBGFREG_HYPER_VMCPUID UINT32_C(0x01000000)
|
---|
2284 |
|
---|
2285 | VMMR3DECL(int) DBGFR3RegCpuQueryU8( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t *pu8);
|
---|
2286 | VMMR3DECL(int) DBGFR3RegCpuQueryU16( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t *pu16);
|
---|
2287 | VMMR3DECL(int) DBGFR3RegCpuQueryU32( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t *pu32);
|
---|
2288 | VMMR3DECL(int) DBGFR3RegCpuQueryU64( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64);
|
---|
2289 | VMMR3DECL(int) DBGFR3RegCpuQueryU128(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint128_t *pu128);
|
---|
2290 | /*VMMR3DECL(int) DBGFR3RegCpuQueryLrd( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, long double *plrd);*/
|
---|
2291 | VMMR3DECL(int) DBGFR3RegCpuQueryXdtr(PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64Base, uint16_t *pu16Limit);
|
---|
2292 | #if 0
|
---|
2293 | VMMR3DECL(int) DBGFR3RegCpuQueryBatch(PUVM pUVM,VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs);
|
---|
2294 | VMMR3DECL(int) DBGFR3RegCpuQueryAll( PUVM pUVM, VMCPUID idCpu, PDBGFREGENTRY paRegs, size_t cRegs);
|
---|
2295 |
|
---|
2296 | VMMR3DECL(int) DBGFR3RegCpuSetU8( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t u8);
|
---|
2297 | VMMR3DECL(int) DBGFR3RegCpuSetU16( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t u16);
|
---|
2298 | VMMR3DECL(int) DBGFR3RegCpuSetU32( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t u32);
|
---|
2299 | VMMR3DECL(int) DBGFR3RegCpuSetU64( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t u64);
|
---|
2300 | VMMR3DECL(int) DBGFR3RegCpuSetU128( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint128_t u128);
|
---|
2301 | VMMR3DECL(int) DBGFR3RegCpuSetLrd( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, long double lrd);
|
---|
2302 | VMMR3DECL(int) DBGFR3RegCpuSetBatch( PUVM pUVM, VMCPUID idCpu, PCDBGFREGENTRY paRegs, size_t cRegs);
|
---|
2303 | #endif
|
---|
2304 |
|
---|
2305 | VMMR3DECL(const char *) DBGFR3RegCpuName(PUVM pUVM, DBGFREG enmReg, DBGFREGVALTYPE enmType);
|
---|
2306 |
|
---|
2307 | VMMR3_INT_DECL(int) DBGFR3RegRegisterCpu(PVM pVM, PVMCPU pVCpu, PCDBGFREGDESC paRegisters, bool fGuestRegs);
|
---|
2308 | VMMR3_INT_DECL(int) DBGFR3RegRegisterDevice(PVM pVM, PCDBGFREGDESC paRegisters, PPDMDEVINS pDevIns,
|
---|
2309 | const char *pszPrefix, uint32_t iInstance);
|
---|
2310 |
|
---|
2311 | /**
|
---|
2312 | * Entry in a named batch query or set operation.
|
---|
2313 | */
|
---|
2314 | typedef struct DBGFREGENTRYNM
|
---|
2315 | {
|
---|
2316 | /** The register name. */
|
---|
2317 | const char *pszName;
|
---|
2318 | /** The size of the value in bytes. */
|
---|
2319 | DBGFREGVALTYPE enmType;
|
---|
2320 | /** The register value. The valid view is indicated by enmType. */
|
---|
2321 | DBGFREGVAL Val;
|
---|
2322 | } DBGFREGENTRYNM;
|
---|
2323 | /** Pointer to a named register entry in a batch operation. */
|
---|
2324 | typedef DBGFREGENTRYNM *PDBGFREGENTRYNM;
|
---|
2325 | /** Pointer to a const named register entry in a batch operation. */
|
---|
2326 | typedef DBGFREGENTRYNM const *PCDBGFREGENTRYNM;
|
---|
2327 |
|
---|
2328 | VMMR3DECL(int) DBGFR3RegNmValidate( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg);
|
---|
2329 |
|
---|
2330 | VMMR3DECL(int) DBGFR3RegNmQuery( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType);
|
---|
2331 | VMMR3DECL(int) DBGFR3RegNmQueryU8( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint8_t *pu8);
|
---|
2332 | VMMR3DECL(int) DBGFR3RegNmQueryU16( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint16_t *pu16);
|
---|
2333 | VMMR3DECL(int) DBGFR3RegNmQueryU32( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint32_t *pu32);
|
---|
2334 | VMMR3DECL(int) DBGFR3RegNmQueryU64( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64);
|
---|
2335 | VMMR3DECL(int) DBGFR3RegNmQueryU128(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PRTUINT128U pu128);
|
---|
2336 | /*VMMR3DECL(int) DBGFR3RegNmQueryLrd( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, long double *plrd);*/
|
---|
2337 | VMMR3DECL(int) DBGFR3RegNmQueryXdtr(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint64_t *pu64Base, uint16_t *pu16Limit);
|
---|
2338 | VMMR3DECL(int) DBGFR3RegNmQueryBatch(PUVM pUVM,VMCPUID idDefCpu, PDBGFREGENTRYNM paRegs, size_t cRegs);
|
---|
2339 | VMMR3DECL(int) DBGFR3RegNmQueryAllCount(PUVM pUVM, size_t *pcRegs);
|
---|
2340 | VMMR3DECL(int) DBGFR3RegNmQueryAll( PUVM pUVM, PDBGFREGENTRYNM paRegs, size_t cRegs);
|
---|
2341 |
|
---|
2342 | VMMR3DECL(int) DBGFR3RegNmSet( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType);
|
---|
2343 | VMMR3DECL(int) DBGFR3RegNmSetU8( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint8_t u8);
|
---|
2344 | VMMR3DECL(int) DBGFR3RegNmSetU16( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint16_t u16);
|
---|
2345 | VMMR3DECL(int) DBGFR3RegNmSetU32( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint32_t u32);
|
---|
2346 | VMMR3DECL(int) DBGFR3RegNmSetU64( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, uint64_t u64);
|
---|
2347 | VMMR3DECL(int) DBGFR3RegNmSetU128( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, RTUINT128U u128);
|
---|
2348 | VMMR3DECL(int) DBGFR3RegNmSetLrd( PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, long double lrd);
|
---|
2349 | VMMR3DECL(int) DBGFR3RegNmSetBatch( PUVM pUVM, VMCPUID idDefCpu, PCDBGFREGENTRYNM paRegs, size_t cRegs);
|
---|
2350 |
|
---|
2351 | /** @todo add enumeration methods. */
|
---|
2352 |
|
---|
2353 | VMMR3DECL(int) DBGFR3RegPrintf( PUVM pUVM, VMCPUID idDefCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, ...);
|
---|
2354 | VMMR3DECL(int) DBGFR3RegPrintfV(PUVM pUVM, VMCPUID idDefCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, va_list va);
|
---|
2355 |
|
---|
2356 |
|
---|
2357 | #ifdef IN_RING3
|
---|
2358 |
|
---|
2359 | /**
|
---|
2360 | * Guest OS digger interface identifier.
|
---|
2361 | *
|
---|
2362 | * This is for use together with PDBGFR3QueryInterface and is used to
|
---|
2363 | * obtain access to optional interfaces.
|
---|
2364 | */
|
---|
2365 | typedef enum DBGFOSINTERFACE
|
---|
2366 | {
|
---|
2367 | /** The usual invalid entry. */
|
---|
2368 | DBGFOSINTERFACE_INVALID = 0,
|
---|
2369 | /** Process info. */
|
---|
2370 | DBGFOSINTERFACE_PROCESS,
|
---|
2371 | /** Thread info. */
|
---|
2372 | DBGFOSINTERFACE_THREAD,
|
---|
2373 | /** Kernel message log - DBGFOSIDMESG. */
|
---|
2374 | DBGFOSINTERFACE_DMESG,
|
---|
2375 | /** Windows NT specifics (for the communication with the KD debugger stub). */
|
---|
2376 | DBGFOSINTERFACE_WINNT,
|
---|
2377 | /** The end of the valid entries. */
|
---|
2378 | DBGFOSINTERFACE_END,
|
---|
2379 | /** The usual 32-bit type blowup. */
|
---|
2380 | DBGFOSINTERFACE_32BIT_HACK = 0x7fffffff
|
---|
2381 | } DBGFOSINTERFACE;
|
---|
2382 | /** Pointer to a Guest OS digger interface identifier. */
|
---|
2383 | typedef DBGFOSINTERFACE *PDBGFOSINTERFACE;
|
---|
2384 | /** Pointer to a const Guest OS digger interface identifier. */
|
---|
2385 | typedef DBGFOSINTERFACE const *PCDBGFOSINTERFACE;
|
---|
2386 |
|
---|
2387 |
|
---|
2388 | /**
|
---|
2389 | * Guest OS Digger Registration Record.
|
---|
2390 | *
|
---|
2391 | * This is used with the DBGFR3OSRegister() API.
|
---|
2392 | */
|
---|
2393 | typedef struct DBGFOSREG
|
---|
2394 | {
|
---|
2395 | /** Magic value (DBGFOSREG_MAGIC). */
|
---|
2396 | uint32_t u32Magic;
|
---|
2397 | /** Flags. Reserved. */
|
---|
2398 | uint32_t fFlags;
|
---|
2399 | /** The size of the instance data. */
|
---|
2400 | uint32_t cbData;
|
---|
2401 | /** Operative System name. */
|
---|
2402 | char szName[24];
|
---|
2403 |
|
---|
2404 | /**
|
---|
2405 | * Constructs the instance.
|
---|
2406 | *
|
---|
2407 | * @returns VBox status code.
|
---|
2408 | * @param pUVM The user mode VM handle.
|
---|
2409 | * @param pVMM The VMM function table.
|
---|
2410 | * @param pvData Pointer to the instance data.
|
---|
2411 | */
|
---|
2412 | DECLCALLBACKMEMBER(int, pfnConstruct,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData));
|
---|
2413 |
|
---|
2414 | /**
|
---|
2415 | * Destroys the instance.
|
---|
2416 | *
|
---|
2417 | * @param pUVM The user mode VM handle.
|
---|
2418 | * @param pVMM The VMM function table.
|
---|
2419 | * @param pvData Pointer to the instance data.
|
---|
2420 | */
|
---|
2421 | DECLCALLBACKMEMBER(void, pfnDestruct,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData));
|
---|
2422 |
|
---|
2423 | /**
|
---|
2424 | * Probes the guest memory for OS finger prints.
|
---|
2425 | *
|
---|
2426 | * No setup or so is performed, it will be followed by a call to pfnInit
|
---|
2427 | * or pfnRefresh that should take care of that.
|
---|
2428 | *
|
---|
2429 | * @returns true if is an OS handled by this module, otherwise false.
|
---|
2430 | * @param pUVM The user mode VM handle.
|
---|
2431 | * @param pVMM The VMM function table.
|
---|
2432 | * @param pvData Pointer to the instance data.
|
---|
2433 | */
|
---|
2434 | DECLCALLBACKMEMBER(bool, pfnProbe,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData));
|
---|
2435 |
|
---|
2436 | /**
|
---|
2437 | * Initializes a fresly detected guest, loading symbols and such useful stuff.
|
---|
2438 | *
|
---|
2439 | * This is called after pfnProbe.
|
---|
2440 | *
|
---|
2441 | * @returns VBox status code.
|
---|
2442 | * @param pUVM The user mode VM handle.
|
---|
2443 | * @param pVMM The VMM function table.
|
---|
2444 | * @param pvData Pointer to the instance data.
|
---|
2445 | */
|
---|
2446 | DECLCALLBACKMEMBER(int, pfnInit,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData));
|
---|
2447 |
|
---|
2448 | /**
|
---|
2449 | * Refreshes symbols and stuff following a redetection of the same OS.
|
---|
2450 | *
|
---|
2451 | * This is called after pfnProbe.
|
---|
2452 | *
|
---|
2453 | * @returns VBox status code.
|
---|
2454 | * @param pUVM The user mode VM handle.
|
---|
2455 | * @param pVMM The VMM function table.
|
---|
2456 | * @param pvData Pointer to the instance data.
|
---|
2457 | */
|
---|
2458 | DECLCALLBACKMEMBER(int, pfnRefresh,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData));
|
---|
2459 |
|
---|
2460 | /**
|
---|
2461 | * Terminates an OS when a new (or none) OS has been detected,
|
---|
2462 | * and before destruction.
|
---|
2463 | *
|
---|
2464 | * This is called after pfnProbe and if needed before pfnDestruct.
|
---|
2465 | *
|
---|
2466 | * @param pUVM The user mode VM handle.
|
---|
2467 | * @param pVMM The VMM function table.
|
---|
2468 | * @param pvData Pointer to the instance data.
|
---|
2469 | */
|
---|
2470 | DECLCALLBACKMEMBER(void, pfnTerm,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData));
|
---|
2471 |
|
---|
2472 | /**
|
---|
2473 | * Queries the version of the running OS.
|
---|
2474 | *
|
---|
2475 | * This is only called after pfnInit().
|
---|
2476 | *
|
---|
2477 | * @returns VBox status code.
|
---|
2478 | * @param pUVM The user mode VM handle.
|
---|
2479 | * @param pVMM The VMM function table.
|
---|
2480 | * @param pvData Pointer to the instance data.
|
---|
2481 | * @param pszVersion Where to store the version string.
|
---|
2482 | * @param cchVersion The size of the version string buffer.
|
---|
2483 | */
|
---|
2484 | DECLCALLBACKMEMBER(int, pfnQueryVersion,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData, char *pszVersion, size_t cchVersion));
|
---|
2485 |
|
---|
2486 | /**
|
---|
2487 | * Queries the pointer to a interface.
|
---|
2488 | *
|
---|
2489 | * This is called after pfnProbe.
|
---|
2490 | *
|
---|
2491 | * The returned interface must be valid until pfnDestruct is called. Two calls
|
---|
2492 | * to this method with the same @a enmIf value must return the same pointer.
|
---|
2493 | *
|
---|
2494 | * @returns Pointer to the interface if available, NULL if not available.
|
---|
2495 | * @param pUVM The user mode VM handle.
|
---|
2496 | * @param pVMM The VMM function table.
|
---|
2497 | * @param pvData Pointer to the instance data.
|
---|
2498 | * @param enmIf The interface identifier.
|
---|
2499 | */
|
---|
2500 | DECLCALLBACKMEMBER(void *, pfnQueryInterface,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData, DBGFOSINTERFACE enmIf));
|
---|
2501 |
|
---|
2502 | /**
|
---|
2503 | * Stack unwind assist callback.
|
---|
2504 | *
|
---|
2505 | * This is only called after pfnInit().
|
---|
2506 | *
|
---|
2507 | * @returns VBox status code (allocation error or something of similar fatality).
|
---|
2508 | * @param pUVM The user mode VM handle.
|
---|
2509 | * @param pVMM The VMM function table.
|
---|
2510 | * @param pvData Pointer to the instance data.
|
---|
2511 | * @param idCpu The CPU that's unwinding it's stack.
|
---|
2512 | * @param pFrame The current frame. Okay to modify it a little.
|
---|
2513 | * @param pState The unwind state. Okay to modify it.
|
---|
2514 | * @param pInitialCtx The initial register context.
|
---|
2515 | * @param hAs The address space being used for the unwind.
|
---|
2516 | * @param puScratch Scratch area (initialized to zero, no dtor).
|
---|
2517 | */
|
---|
2518 | DECLCALLBACKMEMBER(int, pfnStackUnwindAssist,(PUVM pUVM, PCVMMR3VTABLE pVMM, void *pvData, VMCPUID idCpu, PDBGFSTACKFRAME pFrame,
|
---|
2519 | PRTDBGUNWINDSTATE pState, PCCPUMCTX pInitialCtx, RTDBGAS hAs,
|
---|
2520 | uint64_t *puScratch));
|
---|
2521 |
|
---|
2522 | /** Trailing magic (DBGFOSREG_MAGIC). */
|
---|
2523 | uint32_t u32EndMagic;
|
---|
2524 | } DBGFOSREG;
|
---|
2525 | /** Pointer to a Guest OS digger registration record. */
|
---|
2526 | typedef DBGFOSREG *PDBGFOSREG;
|
---|
2527 | /** Pointer to a const Guest OS digger registration record. */
|
---|
2528 | typedef DBGFOSREG const *PCDBGFOSREG;
|
---|
2529 |
|
---|
2530 | /** Magic value for DBGFOSREG::u32Magic and DBGFOSREG::u32EndMagic. (Hitomi Kanehara) */
|
---|
2531 | #define DBGFOSREG_MAGIC 0x19830808
|
---|
2532 |
|
---|
2533 |
|
---|
2534 | /**
|
---|
2535 | * Interface for querying kernel log messages (DBGFOSINTERFACE_DMESG).
|
---|
2536 | */
|
---|
2537 | typedef struct DBGFOSIDMESG
|
---|
2538 | {
|
---|
2539 | /** Trailing magic (DBGFOSIDMESG_MAGIC). */
|
---|
2540 | uint32_t u32Magic;
|
---|
2541 |
|
---|
2542 | /**
|
---|
2543 | * Query the kernel log.
|
---|
2544 | *
|
---|
2545 | * @returns VBox status code.
|
---|
2546 | * @retval VERR_NOT_FOUND if the messages could not be located.
|
---|
2547 | * @retval VERR_INVALID_STATE if the messages was found to have unknown/invalid
|
---|
2548 | * format.
|
---|
2549 | * @retval VERR_BUFFER_OVERFLOW if the buffer isn't large enough, pcbActual
|
---|
2550 | * will be set to the required buffer size. The buffer, however, will
|
---|
2551 | * be filled with as much data as it can hold (properly zero terminated
|
---|
2552 | * of course).
|
---|
2553 | *
|
---|
2554 | * @param pThis Pointer to the interface structure.
|
---|
2555 | * @param pUVM The user mode VM handle.
|
---|
2556 | * @param pVMM The VMM function table.
|
---|
2557 | * @param fFlags Flags reserved for future use, MBZ.
|
---|
2558 | * @param cMessages The number of messages to retrieve, counting from the
|
---|
2559 | * end of the log (i.e. like tail), use UINT32_MAX for all.
|
---|
2560 | * @param pszBuf The output buffer.
|
---|
2561 | * @param cbBuf The buffer size.
|
---|
2562 | * @param pcbActual Where to store the number of bytes actually returned,
|
---|
2563 | * including zero terminator. On VERR_BUFFER_OVERFLOW this
|
---|
2564 | * holds the necessary buffer size. Optional.
|
---|
2565 | */
|
---|
2566 | DECLCALLBACKMEMBER(int, pfnQueryKernelLog,(struct DBGFOSIDMESG *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, uint32_t fFlags,
|
---|
2567 | uint32_t cMessages, char *pszBuf, size_t cbBuf, size_t *pcbActual));
|
---|
2568 | /** Trailing magic (DBGFOSIDMESG_MAGIC). */
|
---|
2569 | uint32_t u32EndMagic;
|
---|
2570 | } DBGFOSIDMESG;
|
---|
2571 | /** Pointer to the interface for query kernel log messages (DBGFOSINTERFACE_DMESG). */
|
---|
2572 | typedef DBGFOSIDMESG *PDBGFOSIDMESG;
|
---|
2573 | /** Magic value for DBGFOSIDMESG::32Magic and DBGFOSIDMESG::u32EndMagic. (Kenazburo Oe) */
|
---|
2574 | #define DBGFOSIDMESG_MAGIC UINT32_C(0x19350131)
|
---|
2575 |
|
---|
2576 |
|
---|
2577 | /**
|
---|
2578 | * Interface for querying Windows NT guest specifics (DBGFOSINTERFACE_WINNT).
|
---|
2579 | */
|
---|
2580 | typedef struct DBGFOSIWINNT
|
---|
2581 | {
|
---|
2582 | /** Trailing magic (DBGFOSIWINNT_MAGIC). */
|
---|
2583 | uint32_t u32Magic;
|
---|
2584 |
|
---|
2585 | /**
|
---|
2586 | * Queries version information.
|
---|
2587 | *
|
---|
2588 | * @returns VBox status code.
|
---|
2589 | * @param pThis Pointer to the interface structure.
|
---|
2590 | * @param pUVM The user mode VM handle.
|
---|
2591 | * @param pVMM The VMM function table.
|
---|
2592 | * @param puVersMajor Where to store the major version part, optional.
|
---|
2593 | * @param puVersMinor Where to store the minor version part, optional.
|
---|
2594 | * @param puBuildNumber Where to store the build number, optional.
|
---|
2595 | * @param pf32Bit Where to store the flag whether this is a 32bit Windows NT, optional.
|
---|
2596 | */
|
---|
2597 | DECLCALLBACKMEMBER(int, pfnQueryVersion,(struct DBGFOSIWINNT *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM,
|
---|
2598 | uint32_t *puVersMajor, uint32_t *puVersMinor,
|
---|
2599 | uint32_t *puBuildNumber, bool *pf32Bit));
|
---|
2600 |
|
---|
2601 | /**
|
---|
2602 | * Queries some base kernel pointers.
|
---|
2603 | *
|
---|
2604 | * @returns VBox status code.
|
---|
2605 | * @param pThis Pointer to the interface structure.
|
---|
2606 | * @param pUVM The user mode VM handle.
|
---|
2607 | * @param pVMM The VMM function table.
|
---|
2608 | * @param pGCPtrKernBase Where to store the kernel base on success.
|
---|
2609 | * @param pGCPtrPsLoadedModuleList Where to store the pointer to the laoded module list head on success.
|
---|
2610 | */
|
---|
2611 | DECLCALLBACKMEMBER(int, pfnQueryKernelPtrs,(struct DBGFOSIWINNT *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM,
|
---|
2612 | PRTGCUINTPTR pGCPtrKernBase, PRTGCUINTPTR pGCPtrPsLoadedModuleList));
|
---|
2613 |
|
---|
2614 | /**
|
---|
2615 | * Queries KPCR and KPCRB pointers for the given vCPU.
|
---|
2616 | *
|
---|
2617 | * @returns VBox status code.
|
---|
2618 | * @param pThis Pointer to the interface structure.
|
---|
2619 | * @param pUVM The user mode VM handle.
|
---|
2620 | * @param pVMM The VMM function table.
|
---|
2621 | * @param idCpu The vCPU to query the KPCR/KPCRB for.
|
---|
2622 | * @param pKpcr Where to store the KPCR pointer on success, optional.
|
---|
2623 | * @param pKpcrb Where to store the KPCR pointer on success, optional.
|
---|
2624 | */
|
---|
2625 | DECLCALLBACKMEMBER(int, pfnQueryKpcrForVCpu,(struct DBGFOSIWINNT *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, VMCPUID idCpu,
|
---|
2626 | PRTGCUINTPTR pKpcr, PRTGCUINTPTR pKpcrb));
|
---|
2627 |
|
---|
2628 | /**
|
---|
2629 | * Queries the current thread for the given vCPU.
|
---|
2630 | *
|
---|
2631 | * @returns VBox status code.
|
---|
2632 | * @param pThis Pointer to the interface structure.
|
---|
2633 | * @param pUVM The user mode VM handle.
|
---|
2634 | * @param pVMM The VMM function table.
|
---|
2635 | * @param idCpu The vCPU to query the KPCR/KPCRB for.
|
---|
2636 | * @param pCurThrd Where to store the CurrentThread pointer on success.
|
---|
2637 | */
|
---|
2638 | DECLCALLBACKMEMBER(int, pfnQueryCurThrdForVCpu,(struct DBGFOSIWINNT *pThis, PUVM pUVM, PCVMMR3VTABLE pVMM, VMCPUID idCpu,
|
---|
2639 | PRTGCUINTPTR pCurThrd));
|
---|
2640 |
|
---|
2641 | /** Trailing magic (DBGFOSIWINNT_MAGIC). */
|
---|
2642 | uint32_t u32EndMagic;
|
---|
2643 | } DBGFOSIWINNT;
|
---|
2644 | /** Pointer to the interface for query kernel log messages (DBGFOSINTERFACE_WINNT). */
|
---|
2645 | typedef DBGFOSIWINNT *PDBGFOSIWINNT;
|
---|
2646 | /** Magic value for DBGFOSIWINNT::32Magic and DBGFOSIWINNT::u32EndMagic. (Dave Cutler) */
|
---|
2647 | #define DBGFOSIWINNT_MAGIC UINT32_C(0x19420313)
|
---|
2648 |
|
---|
2649 |
|
---|
2650 | VMMR3DECL(int) DBGFR3OSRegister(PUVM pUVM, PCDBGFOSREG pReg);
|
---|
2651 | VMMR3DECL(int) DBGFR3OSDeregister(PUVM pUVM, PCDBGFOSREG pReg);
|
---|
2652 | VMMR3DECL(int) DBGFR3OSDetect(PUVM pUVM, char *pszName, size_t cchName);
|
---|
2653 | VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion);
|
---|
2654 | VMMR3DECL(void *) DBGFR3OSQueryInterface(PUVM pUVM, DBGFOSINTERFACE enmIf);
|
---|
2655 |
|
---|
2656 |
|
---|
2657 | VMMR3DECL(int) DBGFR3CoreWrite(PUVM pUVM, const char *pszFilename, bool fReplaceFile);
|
---|
2658 |
|
---|
2659 |
|
---|
2660 |
|
---|
2661 | /** @defgroup grp_dbgf_plug_in The DBGF Plug-in Interface
|
---|
2662 | * @{
|
---|
2663 | */
|
---|
2664 |
|
---|
2665 | /** The plug-in module name prefix. */
|
---|
2666 | # define DBGF_PLUG_IN_PREFIX "DbgPlugIn"
|
---|
2667 |
|
---|
2668 | /** The name of the plug-in entry point (FNDBGFPLUGIN) */
|
---|
2669 | # define DBGF_PLUG_IN_ENTRYPOINT "DbgPlugInEntry"
|
---|
2670 |
|
---|
2671 | /**
|
---|
2672 | * DBGF plug-in operations.
|
---|
2673 | */
|
---|
2674 | typedef enum DBGFPLUGINOP
|
---|
2675 | {
|
---|
2676 | /** The usual invalid first value. */
|
---|
2677 | DBGFPLUGINOP_INVALID,
|
---|
2678 | /** Initialize the plug-in for a VM, register all the stuff.
|
---|
2679 | * The plug-in will be unloaded on failure.
|
---|
2680 | * uArg: The full VirtualBox version, see VBox/version.h. */
|
---|
2681 | DBGFPLUGINOP_INIT,
|
---|
2682 | /** Terminate the plug-ing for a VM, deregister all the stuff.
|
---|
2683 | * The plug-in will be unloaded after this call regardless of the return
|
---|
2684 | * code. */
|
---|
2685 | DBGFPLUGINOP_TERM,
|
---|
2686 | /** The usual 32-bit hack. */
|
---|
2687 | DBGFPLUGINOP_32BIT_HACK = 0x7fffffff
|
---|
2688 | } DBGFPLUGINOP;
|
---|
2689 |
|
---|
2690 | /**
|
---|
2691 | * DBGF plug-in main entry point.
|
---|
2692 | *
|
---|
2693 | * @returns VBox status code.
|
---|
2694 | *
|
---|
2695 | * @param enmOperation The operation.
|
---|
2696 | * @param pUVM The user mode VM handle. This may be NULL.
|
---|
2697 | * @param pVMM The VMM function table.
|
---|
2698 | * @param uArg Extra argument.
|
---|
2699 | */
|
---|
2700 | typedef DECLCALLBACKTYPE(int, FNDBGFPLUGIN,(DBGFPLUGINOP enmOperation, PUVM pUVM, PCVMMR3VTABLE pVMM, uintptr_t uArg));
|
---|
2701 | /** Pointer to a FNDBGFPLUGIN. */
|
---|
2702 | typedef FNDBGFPLUGIN *PFNDBGFPLUGIN;
|
---|
2703 |
|
---|
2704 | /** @copydoc FNDBGFPLUGIN */
|
---|
2705 | DECLEXPORT(int) DbgPlugInEntry(DBGFPLUGINOP enmOperation, PUVM pUVM, PCVMMR3VTABLE pVMM, uintptr_t uArg);
|
---|
2706 |
|
---|
2707 | VMMR3DECL(int) DBGFR3PlugInLoad(PUVM pUVM, const char *pszPlugIn, char *pszActual, size_t cbActual, PRTERRINFO pErrInfo);
|
---|
2708 | VMMR3DECL(int) DBGFR3PlugInUnload(PUVM pUVM, const char *pszName);
|
---|
2709 | VMMR3DECL(void) DBGFR3PlugInLoadAll(PUVM pUVM);
|
---|
2710 | VMMR3DECL(void) DBGFR3PlugInUnloadAll(PUVM pUVM);
|
---|
2711 |
|
---|
2712 | /** @} */
|
---|
2713 |
|
---|
2714 |
|
---|
2715 | /** @defgroup grp_dbgf_types The DBGF type system Interface.
|
---|
2716 | * @{
|
---|
2717 | */
|
---|
2718 |
|
---|
2719 | /** A few forward declarations. */
|
---|
2720 | /** Pointer to a type registration structure. */
|
---|
2721 | typedef struct DBGFTYPEREG *PDBGFTYPEREG;
|
---|
2722 | /** Pointer to a const type registration structure. */
|
---|
2723 | typedef const struct DBGFTYPEREG *PCDBGFTYPEREG;
|
---|
2724 | /** Pointer to a typed buffer. */
|
---|
2725 | typedef struct DBGFTYPEVAL *PDBGFTYPEVAL;
|
---|
2726 |
|
---|
2727 | /**
|
---|
2728 | * DBGF built-in types.
|
---|
2729 | */
|
---|
2730 | typedef enum DBGFTYPEBUILTIN
|
---|
2731 | {
|
---|
2732 | /** The usual invalid first value. */
|
---|
2733 | DBGFTYPEBUILTIN_INVALID,
|
---|
2734 | /** Unsigned 8bit integer. */
|
---|
2735 | DBGFTYPEBUILTIN_UINT8,
|
---|
2736 | /** Signed 8bit integer. */
|
---|
2737 | DBGFTYPEBUILTIN_INT8,
|
---|
2738 | /** Unsigned 16bit integer. */
|
---|
2739 | DBGFTYPEBUILTIN_UINT16,
|
---|
2740 | /** Signed 16bit integer. */
|
---|
2741 | DBGFTYPEBUILTIN_INT16,
|
---|
2742 | /** Unsigned 32bit integer. */
|
---|
2743 | DBGFTYPEBUILTIN_UINT32,
|
---|
2744 | /** Signed 32bit integer. */
|
---|
2745 | DBGFTYPEBUILTIN_INT32,
|
---|
2746 | /** Unsigned 64bit integer. */
|
---|
2747 | DBGFTYPEBUILTIN_UINT64,
|
---|
2748 | /** Signed 64bit integer. */
|
---|
2749 | DBGFTYPEBUILTIN_INT64,
|
---|
2750 | /** 32bit Guest pointer */
|
---|
2751 | DBGFTYPEBUILTIN_PTR32,
|
---|
2752 | /** 64bit Guest pointer */
|
---|
2753 | DBGFTYPEBUILTIN_PTR64,
|
---|
2754 | /** Guest pointer - size depends on the guest bitness */
|
---|
2755 | DBGFTYPEBUILTIN_PTR,
|
---|
2756 | /** Type indicating a size, like size_t this can have different sizes
|
---|
2757 | * on 32bit and 64bit systems */
|
---|
2758 | DBGFTYPEBUILTIN_SIZE,
|
---|
2759 | /** 32bit float. */
|
---|
2760 | DBGFTYPEBUILTIN_FLOAT32,
|
---|
2761 | /** 64bit float (also known as double). */
|
---|
2762 | DBGFTYPEBUILTIN_FLOAT64,
|
---|
2763 | /** Compund types like structs and unions. */
|
---|
2764 | DBGFTYPEBUILTIN_COMPOUND,
|
---|
2765 | /** The usual 32-bit hack. */
|
---|
2766 | DBGFTYPEBUILTIN_32BIT_HACK = 0x7fffffff
|
---|
2767 | } DBGFTYPEBUILTIN;
|
---|
2768 | /** Pointer to a built-in type. */
|
---|
2769 | typedef DBGFTYPEBUILTIN *PDBGFTYPEBUILTIN;
|
---|
2770 | /** Pointer to a const built-in type. */
|
---|
2771 | typedef const DBGFTYPEBUILTIN *PCDBGFTYPEBUILTIN;
|
---|
2772 |
|
---|
2773 | /**
|
---|
2774 | * DBGF type value buffer.
|
---|
2775 | */
|
---|
2776 | typedef union DBGFTYPEVALBUF
|
---|
2777 | {
|
---|
2778 | uint8_t u8;
|
---|
2779 | int8_t i8;
|
---|
2780 | uint16_t u16;
|
---|
2781 | int16_t i16;
|
---|
2782 | uint32_t u32;
|
---|
2783 | int32_t i32;
|
---|
2784 | uint64_t u64;
|
---|
2785 | int64_t i64;
|
---|
2786 | float f32;
|
---|
2787 | double f64;
|
---|
2788 | uint64_t size; /* For the built-in size_t which can be either 32-bit or 64-bit. */
|
---|
2789 | RTGCPTR GCPtr;
|
---|
2790 | /** For embedded structs. */
|
---|
2791 | PDBGFTYPEVAL pVal;
|
---|
2792 | } DBGFTYPEVALBUF;
|
---|
2793 | /** Pointer to a value. */
|
---|
2794 | typedef DBGFTYPEVALBUF *PDBGFTYPEVALBUF;
|
---|
2795 |
|
---|
2796 | /**
|
---|
2797 | * DBGF type value entry.
|
---|
2798 | */
|
---|
2799 | typedef struct DBGFTYPEVALENTRY
|
---|
2800 | {
|
---|
2801 | /** DBGF built-in type. */
|
---|
2802 | DBGFTYPEBUILTIN enmType;
|
---|
2803 | /** Size of the type. */
|
---|
2804 | size_t cbType;
|
---|
2805 | /** Number of entries, for arrays this can be > 1. */
|
---|
2806 | uint32_t cEntries;
|
---|
2807 | /** Value buffer, depends on whether this is an array. */
|
---|
2808 | union
|
---|
2809 | {
|
---|
2810 | /** Single value. */
|
---|
2811 | DBGFTYPEVALBUF Val;
|
---|
2812 | /** Pointer to the array of values. */
|
---|
2813 | PDBGFTYPEVALBUF pVal;
|
---|
2814 | } Buf;
|
---|
2815 | } DBGFTYPEVALENTRY;
|
---|
2816 | /** Pointer to a type value entry. */
|
---|
2817 | typedef DBGFTYPEVALENTRY *PDBGFTYPEVALENTRY;
|
---|
2818 | /** Pointer to a const type value entry. */
|
---|
2819 | typedef const DBGFTYPEVALENTRY *PCDBGFTYPEVALENTRY;
|
---|
2820 |
|
---|
2821 | /**
|
---|
2822 | * DBGF typed value.
|
---|
2823 | */
|
---|
2824 | typedef struct DBGFTYPEVAL
|
---|
2825 | {
|
---|
2826 | /** Pointer to the registration structure for this type. */
|
---|
2827 | PCDBGFTYPEREG pTypeReg;
|
---|
2828 | /** Number of value entries. */
|
---|
2829 | uint32_t cEntries;
|
---|
2830 | /** Variable sized array of value entries. */
|
---|
2831 | DBGFTYPEVALENTRY aEntries[1];
|
---|
2832 | } DBGFTYPEVAL;
|
---|
2833 |
|
---|
2834 | /**
|
---|
2835 | * DBGF type variant.
|
---|
2836 | */
|
---|
2837 | typedef enum DBGFTYPEVARIANT
|
---|
2838 | {
|
---|
2839 | /** The usual invalid first value. */
|
---|
2840 | DBGFTYPEVARIANT_INVALID,
|
---|
2841 | /** A struct. */
|
---|
2842 | DBGFTYPEVARIANT_STRUCT,
|
---|
2843 | /** Union. */
|
---|
2844 | DBGFTYPEVARIANT_UNION,
|
---|
2845 | /** Alias for an existing type. */
|
---|
2846 | DBGFTYPEVARIANT_ALIAS,
|
---|
2847 | /** The usual 32-bit hack. */
|
---|
2848 | DBGFTYPEVARIANT_32BIT_HACK = 0x7fffffff
|
---|
2849 | } DBGFTYPEVARIANT;
|
---|
2850 |
|
---|
2851 | /** @name DBGFTYPEREGMEMBER Flags.
|
---|
2852 | * @{ */
|
---|
2853 | /** The member is an array with a fixed size. */
|
---|
2854 | # define DBGFTYPEREGMEMBER_F_ARRAY RT_BIT_32(0)
|
---|
2855 | /** The member denotes a pointer. */
|
---|
2856 | # define DBGFTYPEREGMEMBER_F_POINTER RT_BIT_32(1)
|
---|
2857 | /** @} */
|
---|
2858 |
|
---|
2859 | /**
|
---|
2860 | * DBGF type member.
|
---|
2861 | */
|
---|
2862 | typedef struct DBGFTYPEREGMEMBER
|
---|
2863 | {
|
---|
2864 | /** Name of the member. */
|
---|
2865 | const char *pszName;
|
---|
2866 | /** Flags for this member, see DBGFTYPEREGMEMBER_F_XXX. */
|
---|
2867 | uint32_t fFlags;
|
---|
2868 | /** Type identifier. */
|
---|
2869 | const char *pszType;
|
---|
2870 | /** The number of elements in the array, only valid for arrays. */
|
---|
2871 | uint32_t cElements;
|
---|
2872 | } DBGFTYPEREGMEMBER;
|
---|
2873 | /** Pointer to a member. */
|
---|
2874 | typedef DBGFTYPEREGMEMBER *PDBGFTYPEREGMEMBER;
|
---|
2875 | /** Pointer to a const member. */
|
---|
2876 | typedef const DBGFTYPEREGMEMBER *PCDBGFTYPEREGMEMBER;
|
---|
2877 |
|
---|
2878 | /** @name DBGFTYPEREG Flags.
|
---|
2879 | * @{ */
|
---|
2880 | /** The type is a packed structure. */
|
---|
2881 | # define DBGFTYPEREG_F_PACKED RT_BIT_32(0)
|
---|
2882 | /** @} */
|
---|
2883 |
|
---|
2884 | /**
|
---|
2885 | * New type registration structure.
|
---|
2886 | */
|
---|
2887 | typedef struct DBGFTYPEREG
|
---|
2888 | {
|
---|
2889 | /** Name of the type. */
|
---|
2890 | const char *pszType;
|
---|
2891 | /** The type variant. */
|
---|
2892 | DBGFTYPEVARIANT enmVariant;
|
---|
2893 | /** Some registration flags, see DBGFTYPEREG_F_XXX. */
|
---|
2894 | uint32_t fFlags;
|
---|
2895 | /** Number of members this type has, only valid for structs or unions. */
|
---|
2896 | uint32_t cMembers;
|
---|
2897 | /** Pointer to the member fields, only valid for structs or unions. */
|
---|
2898 | PCDBGFTYPEREGMEMBER paMembers;
|
---|
2899 | /** Name of the aliased type for aliases. */
|
---|
2900 | const char *pszAliasedType;
|
---|
2901 | } DBGFTYPEREG;
|
---|
2902 |
|
---|
2903 | /**
|
---|
2904 | * DBGF typed value dumper callback.
|
---|
2905 | *
|
---|
2906 | * @returns VBox status code. Any non VINF_SUCCESS status code will abort the dumping.
|
---|
2907 | *
|
---|
2908 | * @param off The byte offset of the entry from the start of the type.
|
---|
2909 | * @param pszField The name of the field for the value.
|
---|
2910 | * @param iLvl The current level.
|
---|
2911 | * @param enmType The type enum.
|
---|
2912 | * @param cbType Size of the type.
|
---|
2913 | * @param pValBuf Pointer to the value buffer.
|
---|
2914 | * @param cValBufs Number of value buffers (for arrays).
|
---|
2915 | * @param pvUser Opaque user data.
|
---|
2916 | */
|
---|
2917 | typedef DECLCALLBACKTYPE(int, FNDBGFR3TYPEVALDUMP,(uint32_t off, const char *pszField, uint32_t iLvl,
|
---|
2918 | DBGFTYPEBUILTIN enmType, size_t cbType,
|
---|
2919 | PDBGFTYPEVALBUF pValBuf, uint32_t cValBufs, void *pvUser));
|
---|
2920 | /** Pointer to a FNDBGFR3TYPEVALDUMP. */
|
---|
2921 | typedef FNDBGFR3TYPEVALDUMP *PFNDBGFR3TYPEVALDUMP;
|
---|
2922 |
|
---|
2923 | /**
|
---|
2924 | * DBGF type information dumper callback.
|
---|
2925 | *
|
---|
2926 | * @returns VBox status code. Any non VINF_SUCCESS status code will abort the dumping.
|
---|
2927 | *
|
---|
2928 | * @param off The byte offset of the entry from the start of the type.
|
---|
2929 | * @param pszField The name of the field for the value.
|
---|
2930 | * @param iLvl The current level.
|
---|
2931 | * @param pszType The type of the field.
|
---|
2932 | * @param fTypeFlags Flags for this type, see DBGFTYPEREGMEMBER_F_XXX.
|
---|
2933 | * @param cElements Number of for the field ( > 0 for arrays).
|
---|
2934 | * @param pvUser Opaque user data.
|
---|
2935 | */
|
---|
2936 | typedef DECLCALLBACKTYPE(int, FNDBGFR3TYPEDUMP,(uint32_t off, const char *pszField, uint32_t iLvl,
|
---|
2937 | const char *pszType, uint32_t fTypeFlags,
|
---|
2938 | uint32_t cElements, void *pvUser));
|
---|
2939 | /** Pointer to a FNDBGFR3TYPEDUMP. */
|
---|
2940 | typedef FNDBGFR3TYPEDUMP *PFNDBGFR3TYPEDUMP;
|
---|
2941 |
|
---|
2942 | VMMR3DECL(int) DBGFR3TypeRegister( PUVM pUVM, uint32_t cTypes, PCDBGFTYPEREG paTypes);
|
---|
2943 | VMMR3DECL(int) DBGFR3TypeDeregister(PUVM pUVM, const char *pszType);
|
---|
2944 | VMMR3DECL(int) DBGFR3TypeQueryReg( PUVM pUVM, const char *pszType, PCDBGFTYPEREG *ppTypeReg);
|
---|
2945 |
|
---|
2946 | VMMR3DECL(int) DBGFR3TypeQuerySize( PUVM pUVM, const char *pszType, size_t *pcbType);
|
---|
2947 | VMMR3DECL(int) DBGFR3TypeSetSize( PUVM pUVM, const char *pszType, size_t cbType);
|
---|
2948 | VMMR3DECL(int) DBGFR3TypeDumpEx( PUVM pUVM, const char *pszType, uint32_t fFlags,
|
---|
2949 | uint32_t cLvlMax, PFNDBGFR3TYPEDUMP pfnDump, void *pvUser);
|
---|
2950 | VMMR3DECL(int) DBGFR3TypeQueryValByType(PUVM pUVM, PCDBGFADDRESS pAddress, const char *pszType,
|
---|
2951 | PDBGFTYPEVAL *ppVal);
|
---|
2952 | VMMR3DECL(void) DBGFR3TypeValFree(PDBGFTYPEVAL pVal);
|
---|
2953 | VMMR3DECL(int) DBGFR3TypeValDumpEx(PUVM pUVM, PCDBGFADDRESS pAddress, const char *pszType, uint32_t fFlags,
|
---|
2954 | uint32_t cLvlMax, FNDBGFR3TYPEVALDUMP pfnDump, void *pvUser);
|
---|
2955 |
|
---|
2956 | /** @} */
|
---|
2957 |
|
---|
2958 |
|
---|
2959 | /** @defgroup grp_dbgf_flow The DBGF control flow graph Interface.
|
---|
2960 | * @{
|
---|
2961 | */
|
---|
2962 |
|
---|
2963 | /** A DBGF control flow graph handle. */
|
---|
2964 | typedef struct DBGFFLOWINT *DBGFFLOW;
|
---|
2965 | /** Pointer to a DBGF control flow graph handle. */
|
---|
2966 | typedef DBGFFLOW *PDBGFFLOW;
|
---|
2967 | /** A DBGF control flow graph basic block handle. */
|
---|
2968 | typedef struct DBGFFLOWBBINT *DBGFFLOWBB;
|
---|
2969 | /** Pointer to a DBGF control flow graph basic block handle. */
|
---|
2970 | typedef DBGFFLOWBB *PDBGFFLOWBB;
|
---|
2971 | /** A DBGF control flow graph branch table handle. */
|
---|
2972 | typedef struct DBGFFLOWBRANCHTBLINT *DBGFFLOWBRANCHTBL;
|
---|
2973 | /** Pointer to a DBGF flow control graph branch table handle. */
|
---|
2974 | typedef DBGFFLOWBRANCHTBL *PDBGFFLOWBRANCHTBL;
|
---|
2975 | /** A DBGF control flow graph iterator. */
|
---|
2976 | typedef struct DBGFFLOWITINT *DBGFFLOWIT;
|
---|
2977 | /** Pointer to a control flow graph iterator. */
|
---|
2978 | typedef DBGFFLOWIT *PDBGFFLOWIT;
|
---|
2979 | /** A DBGF control flow graph branch table iterator. */
|
---|
2980 | typedef struct DBGFFLOWBRANCHTBLITINT *DBGFFLOWBRANCHTBLIT;
|
---|
2981 | /** Pointer to a control flow graph branch table iterator. */
|
---|
2982 | typedef DBGFFLOWBRANCHTBLIT *PDBGFFLOWBRANCHTBLIT;
|
---|
2983 |
|
---|
2984 | /** @name DBGFFLOWBB Flags.
|
---|
2985 | * @{ */
|
---|
2986 | /** The basic block is the entry into the owning control flow graph. */
|
---|
2987 | #define DBGF_FLOW_BB_F_ENTRY RT_BIT_32(0)
|
---|
2988 | /** The basic block was not populated because the limit was reached. */
|
---|
2989 | #define DBGF_FLOW_BB_F_EMPTY RT_BIT_32(1)
|
---|
2990 | /** The basic block is not complete because an error happened during disassembly. */
|
---|
2991 | #define DBGF_FLOW_BB_F_INCOMPLETE_ERR RT_BIT_32(2)
|
---|
2992 | /** The basic block is reached through a branch table. */
|
---|
2993 | #define DBGF_FLOW_BB_F_BRANCH_TABLE RT_BIT_32(3)
|
---|
2994 | /** The basic block consists only of a single call instruction because
|
---|
2995 | * DBGF_FLOW_CREATE_F_CALL_INSN_SEPARATE_BB was given. */
|
---|
2996 | #define DBGF_FLOW_BB_F_CALL_INSN RT_BIT_32(4)
|
---|
2997 | /** The branch target of the call instruction could be deduced and can be queried with
|
---|
2998 | * DBGFR3FlowBbGetBranchAddress(). May only be available when DBGF_FLOW_BB_F_CALL_INSN
|
---|
2999 | * is set. */
|
---|
3000 | #define DBGF_FLOW_BB_F_CALL_INSN_TARGET_KNOWN RT_BIT_32(5)
|
---|
3001 | /** @} */
|
---|
3002 |
|
---|
3003 | /** @name Flags controlling the creating of a control flow graph.
|
---|
3004 | * @{ */
|
---|
3005 | /** Default options. */
|
---|
3006 | #define DBGF_FLOW_CREATE_F_DEFAULT 0
|
---|
3007 | /** Tries to resolve indirect branches, useful for code using
|
---|
3008 | * jump tables generated for large switch statements by some compilers. */
|
---|
3009 | #define DBGF_FLOW_CREATE_F_TRY_RESOLVE_INDIRECT_BRANCHES RT_BIT_32(0)
|
---|
3010 | /** Call instructions are placed in a separate basic block. */
|
---|
3011 | #define DBGF_FLOW_CREATE_F_CALL_INSN_SEPARATE_BB RT_BIT_32(1)
|
---|
3012 | /** @} */
|
---|
3013 |
|
---|
3014 | /**
|
---|
3015 | * DBGF control graph basic block end type.
|
---|
3016 | */
|
---|
3017 | typedef enum DBGFFLOWBBENDTYPE
|
---|
3018 | {
|
---|
3019 | /** Invalid type. */
|
---|
3020 | DBGFFLOWBBENDTYPE_INVALID = 0,
|
---|
3021 | /** Basic block is the exit block and has no successor. */
|
---|
3022 | DBGFFLOWBBENDTYPE_EXIT,
|
---|
3023 | /** Basic block is the last disassembled block because the
|
---|
3024 | * maximum amount to disassemble was reached but is not an
|
---|
3025 | * exit block - no successors.
|
---|
3026 | */
|
---|
3027 | DBGFFLOWBBENDTYPE_LAST_DISASSEMBLED,
|
---|
3028 | /** Unconditional control flow change because the successor is referenced by multiple
|
---|
3029 | * basic blocks. - 1 successor. */
|
---|
3030 | DBGFFLOWBBENDTYPE_UNCOND,
|
---|
3031 | /** Unconditional control flow change because of an direct branch - 1 successor. */
|
---|
3032 | DBGFFLOWBBENDTYPE_UNCOND_JMP,
|
---|
3033 | /** Unconditional control flow change because of an indirect branch - n successors. */
|
---|
3034 | DBGFFLOWBBENDTYPE_UNCOND_INDIRECT_JMP,
|
---|
3035 | /** Conditional control flow change - 2 successors. */
|
---|
3036 | DBGFFLOWBBENDTYPE_COND,
|
---|
3037 | /** 32bit hack. */
|
---|
3038 | DBGFFLOWBBENDTYPE_32BIT_HACK = 0x7fffffff
|
---|
3039 | } DBGFFLOWBBENDTYPE;
|
---|
3040 |
|
---|
3041 | /**
|
---|
3042 | * DBGF control flow graph iteration order.
|
---|
3043 | */
|
---|
3044 | typedef enum DBGFFLOWITORDER
|
---|
3045 | {
|
---|
3046 | /** Invalid order. */
|
---|
3047 | DBGFFLOWITORDER_INVALID = 0,
|
---|
3048 | /** From lowest to highest basic block start address. */
|
---|
3049 | DBGFFLOWITORDER_BY_ADDR_LOWEST_FIRST,
|
---|
3050 | /** From highest to lowest basic block start address. */
|
---|
3051 | DBGFFLOWITORDER_BY_ADDR_HIGHEST_FIRST,
|
---|
3052 | /** Depth first traversing starting from the entry block. */
|
---|
3053 | DBGFFLOWITORDER_DEPTH_FRIST,
|
---|
3054 | /** Breadth first traversing starting from the entry block. */
|
---|
3055 | DBGFFLOWITORDER_BREADTH_FIRST,
|
---|
3056 | /** Usual 32bit hack. */
|
---|
3057 | DBGFFLOWITORDER_32BIT_HACK = 0x7fffffff
|
---|
3058 | } DBGFFLOWITORDER;
|
---|
3059 | /** Pointer to a iteration order enum. */
|
---|
3060 | typedef DBGFFLOWITORDER *PDBGFFLOWITORDER;
|
---|
3061 |
|
---|
3062 |
|
---|
3063 | VMMR3DECL(int) DBGFR3FlowCreate(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddressStart, uint32_t cbDisasmMax,
|
---|
3064 | uint32_t fFlagsFlow, uint32_t fFlagsDisasm, PDBGFFLOW phFlow);
|
---|
3065 | VMMR3DECL(uint32_t) DBGFR3FlowRetain(DBGFFLOW hFlow);
|
---|
3066 | VMMR3DECL(uint32_t) DBGFR3FlowRelease(DBGFFLOW hFlow);
|
---|
3067 | VMMR3DECL(int) DBGFR3FlowQueryStartBb(DBGFFLOW hFlow, PDBGFFLOWBB phFlowBb);
|
---|
3068 | VMMR3DECL(int) DBGFR3FlowQueryBbByAddress(DBGFFLOW hFlow, PDBGFADDRESS pAddr, PDBGFFLOWBB phFlowBb);
|
---|
3069 | VMMR3DECL(int) DBGFR3FlowQueryBranchTblByAddress(DBGFFLOW hFlow, PDBGFADDRESS pAddr, PDBGFFLOWBRANCHTBL phFlowBranchTbl);
|
---|
3070 | VMMR3DECL(uint32_t) DBGFR3FlowGetBbCount(DBGFFLOW hFlow);
|
---|
3071 | VMMR3DECL(uint32_t) DBGFR3FlowGetBranchTblCount(DBGFFLOW hFlow);
|
---|
3072 | VMMR3DECL(uint32_t) DBGFR3FlowGetCallInsnCount(DBGFFLOW hFlow);
|
---|
3073 |
|
---|
3074 | VMMR3DECL(uint32_t) DBGFR3FlowBbRetain(DBGFFLOWBB hFlowBb);
|
---|
3075 | VMMR3DECL(uint32_t) DBGFR3FlowBbRelease(DBGFFLOWBB hFlowBb);
|
---|
3076 | VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBbGetStartAddress(DBGFFLOWBB hFlowBb, PDBGFADDRESS pAddrStart);
|
---|
3077 | VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBbGetEndAddress(DBGFFLOWBB hFlowBb, PDBGFADDRESS pAddrEnd);
|
---|
3078 | VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBbGetBranchAddress(DBGFFLOWBB hFlowBb, PDBGFADDRESS pAddrTarget);
|
---|
3079 | VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBbGetFollowingAddress(DBGFFLOWBB hFlowBb, PDBGFADDRESS pAddrFollow);
|
---|
3080 | VMMR3DECL(DBGFFLOWBBENDTYPE) DBGFR3FlowBbGetType(DBGFFLOWBB hFlowBb);
|
---|
3081 | VMMR3DECL(uint32_t) DBGFR3FlowBbGetInstrCount(DBGFFLOWBB hFlowBb);
|
---|
3082 | VMMR3DECL(uint32_t) DBGFR3FlowBbGetFlags(DBGFFLOWBB hFlowBb);
|
---|
3083 | VMMR3DECL(int) DBGFR3FlowBbQueryBranchTbl(DBGFFLOWBB hFlowBb, PDBGFFLOWBRANCHTBL phBranchTbl);
|
---|
3084 | VMMR3DECL(int) DBGFR3FlowBbQueryError(DBGFFLOWBB hFlowBb, const char **ppszErr);
|
---|
3085 | VMMR3DECL(int) DBGFR3FlowBbQueryInstr(DBGFFLOWBB hFlowBb, uint32_t idxInstr, PDBGFADDRESS pAddrInstr,
|
---|
3086 | uint32_t *pcbInstr, const char **ppszInstr);
|
---|
3087 | VMMR3DECL(int) DBGFR3FlowBbQuerySuccessors(DBGFFLOWBB hFlowBb, PDBGFFLOWBB phFlowBbFollow,
|
---|
3088 | PDBGFFLOWBB phFlowBbTarget);
|
---|
3089 | VMMR3DECL(uint32_t) DBGFR3FlowBbGetRefBbCount(DBGFFLOWBB hFlowBb);
|
---|
3090 | VMMR3DECL(int) DBGFR3FlowBbGetRefBb(DBGFFLOWBB hFlowBb, PDBGFFLOWBB pahFlowBbRef, uint32_t cRef);
|
---|
3091 |
|
---|
3092 | VMMR3DECL(uint32_t) DBGFR3FlowBranchTblRetain(DBGFFLOWBRANCHTBL hFlowBranchTbl);
|
---|
3093 | VMMR3DECL(uint32_t) DBGFR3FlowBranchTblRelease(DBGFFLOWBRANCHTBL hFlowBranchTbl);
|
---|
3094 | VMMR3DECL(uint32_t) DBGFR3FlowBranchTblGetSlots(DBGFFLOWBRANCHTBL hFlowBranchTbl);
|
---|
3095 | VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBranchTblGetStartAddress(DBGFFLOWBRANCHTBL hFlowBranchTbl, PDBGFADDRESS pAddrStart);
|
---|
3096 | VMMR3DECL(PDBGFADDRESS) DBGFR3FlowBranchTblGetAddrAtSlot(DBGFFLOWBRANCHTBL hFlowBranchTbl, uint32_t idxSlot, PDBGFADDRESS pAddrSlot);
|
---|
3097 | VMMR3DECL(int) DBGFR3FlowBranchTblQueryAddresses(DBGFFLOWBRANCHTBL hFlowBranchTbl, PDBGFADDRESS paAddrs, uint32_t cAddrs);
|
---|
3098 |
|
---|
3099 | VMMR3DECL(int) DBGFR3FlowItCreate(DBGFFLOW hFlow, DBGFFLOWITORDER enmOrder, PDBGFFLOWIT phFlowIt);
|
---|
3100 | VMMR3DECL(void) DBGFR3FlowItDestroy(DBGFFLOWIT hFlowIt);
|
---|
3101 | VMMR3DECL(DBGFFLOWBB) DBGFR3FlowItNext(DBGFFLOWIT hFlowIt);
|
---|
3102 | VMMR3DECL(int) DBGFR3FlowItReset(DBGFFLOWIT hFlowIt);
|
---|
3103 |
|
---|
3104 | VMMR3DECL(int) DBGFR3FlowBranchTblItCreate(DBGFFLOW hFlow, DBGFFLOWITORDER enmOrder, PDBGFFLOWBRANCHTBLIT phFlowBranchTblIt);
|
---|
3105 | VMMR3DECL(void) DBGFR3FlowBranchTblItDestroy(DBGFFLOWBRANCHTBLIT hFlowBranchTblIt);
|
---|
3106 | VMMR3DECL(DBGFFLOWBRANCHTBL) DBGFR3FlowBranchTblItNext(DBGFFLOWBRANCHTBLIT hFlowBranchTblIt);
|
---|
3107 | VMMR3DECL(int) DBGFR3FlowBranchTblItReset(DBGFFLOWBRANCHTBLIT hFlowBranchTblIt);
|
---|
3108 |
|
---|
3109 | /** @} */
|
---|
3110 |
|
---|
3111 |
|
---|
3112 | /** @defgroup grp_dbgf_misc Misc DBGF interfaces.
|
---|
3113 | * @{ */
|
---|
3114 | VMMR3DECL(VBOXSTRICTRC) DBGFR3ReportBugCheck(PVM pVM, PVMCPU pVCpu, DBGFEVENTTYPE enmEvent, uint64_t uBugCheck,
|
---|
3115 | uint64_t uP1, uint64_t uP2, uint64_t uP3, uint64_t uP4);
|
---|
3116 | VMMR3DECL(int) DBGFR3FormatBugCheck(PUVM pUVM, char *pszDetails, size_t cbDetails,
|
---|
3117 | uint64_t uP0, uint64_t uP1, uint64_t uP2, uint64_t uP3, uint64_t uP4);
|
---|
3118 | /** @} */
|
---|
3119 | #endif /* IN_RING3 */
|
---|
3120 |
|
---|
3121 |
|
---|
3122 | /** @defgroup grp_dbgf_tracer DBGF event tracing.
|
---|
3123 | * @{ */
|
---|
3124 | #ifdef IN_RING3
|
---|
3125 | VMMR3_INT_DECL(int) DBGFR3TracerRegisterEvtSrc(PVM pVM, const char *pszName, PDBGFTRACEREVTSRC phEvtSrc);
|
---|
3126 | VMMR3_INT_DECL(int) DBGFR3TracerDeregisterEvtSrc(PVM pVM, DBGFTRACEREVTSRC hEvtSrc);
|
---|
3127 | VMMR3_INT_DECL(int) DBGFR3TracerEvtIoPortCreate(PVM pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTIOPORT cPorts, uint32_t fFlags,
|
---|
3128 | uint32_t iPciRegion);
|
---|
3129 | VMMR3_INT_DECL(int) DBGFR3TracerEvtMmioCreate(PVM pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS cbRegion, uint32_t fFlags,
|
---|
3130 | uint32_t iPciRegion);
|
---|
3131 | #endif
|
---|
3132 |
|
---|
3133 | VMM_INT_DECL(int) DBGFTracerEvtMmioMap(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS GCPhysMmio);
|
---|
3134 | VMM_INT_DECL(int) DBGFTracerEvtMmioUnmap(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion);
|
---|
3135 | VMM_INT_DECL(int) DBGFTracerEvtMmioRead(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS offMmio, const void *pvVal, size_t cbVal);
|
---|
3136 | VMM_INT_DECL(int) DBGFTracerEvtMmioWrite(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS offMmio, const void *pvVal, size_t cbVal);
|
---|
3137 | VMM_INT_DECL(int) DBGFTracerEvtMmioFill(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hRegion, RTGCPHYS offMmio, uint32_t u32Item, uint32_t cbItem, uint32_t cItems);
|
---|
3138 | VMM_INT_DECL(int) DBGFTracerEvtIoPortMap(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT IoPortBase);
|
---|
3139 | VMM_INT_DECL(int) DBGFTracerEvtIoPortUnmap(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts);
|
---|
3140 | VMM_INT_DECL(int) DBGFTracerEvtIoPortRead(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT offPort, const void *pvVal, size_t cbVal);
|
---|
3141 | VMM_INT_DECL(int) DBGFTracerEvtIoPortReadStr(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT offPort, const void *pv, size_t cb,
|
---|
3142 | uint32_t cTransfersReq, uint32_t cTransfersRet);
|
---|
3143 | VMM_INT_DECL(int) DBGFTracerEvtIoPortWrite(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT offPort, const void *pvVal, size_t cbVal);
|
---|
3144 | VMM_INT_DECL(int) DBGFTracerEvtIoPortWriteStr(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, uint64_t hIoPorts, RTIOPORT offPort, const void *pv, size_t cb,
|
---|
3145 | uint32_t cTransfersReq, uint32_t cTransfersRet);
|
---|
3146 | VMM_INT_DECL(int) DBGFTracerEvtIrq(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, int32_t iIrq, int32_t fIrqLvl);
|
---|
3147 | VMM_INT_DECL(int) DBGFTracerEvtIoApicMsi(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, RTGCPHYS GCPhys, uint32_t u32Val);
|
---|
3148 | VMM_INT_DECL(int) DBGFTracerEvtGCPhysRead(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, RTGCPHYS GCPhys, const void *pvBuf, size_t cbRead);
|
---|
3149 | VMM_INT_DECL(int) DBGFTracerEvtGCPhysWrite(PVMCC pVM, DBGFTRACEREVTSRC hEvtSrc, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite);
|
---|
3150 | /** @} */
|
---|
3151 |
|
---|
3152 |
|
---|
3153 | /** @defgroup grp_dbgf_sample_report DBGF sample report.
|
---|
3154 | * @{ */
|
---|
3155 |
|
---|
3156 | /**
|
---|
3157 | * Callback which provides progress information about a currently running
|
---|
3158 | * lengthy operation.
|
---|
3159 | *
|
---|
3160 | * @return VBox status code.
|
---|
3161 | * @retval VERR_DBGF_CANCELLED to cancel the operation.
|
---|
3162 | * @param pvUser The opaque user data associated with this interface.
|
---|
3163 | * @param uPercentage Completion percentage.
|
---|
3164 | */
|
---|
3165 | typedef DECLCALLBACKTYPE(int, FNDBGFPROGRESS,(void *pvUser, unsigned uPercentage));
|
---|
3166 | /** Pointer to FNDBGFPROGRESS() */
|
---|
3167 | typedef FNDBGFPROGRESS *PFNDBGFPROGRESS;
|
---|
3168 |
|
---|
3169 | /** @name Flags to pass to DBGFR3SampleReportCreate().
|
---|
3170 | * @{ */
|
---|
3171 | /** The report creates the call stack in reverse order (bottom to top). */
|
---|
3172 | #define DBGF_SAMPLE_REPORT_F_STACK_REVERSE RT_BIT(0)
|
---|
3173 | /** Mask containing the valid flags. */
|
---|
3174 | #define DBGF_SAMPLE_REPORT_F_VALID_MASK UINT32_C(0x00000001)
|
---|
3175 | /** @} */
|
---|
3176 |
|
---|
3177 | VMMR3DECL(int) DBGFR3SampleReportCreate(PUVM pUVM, uint32_t cSampleIntervalMs, uint32_t fFlags, PDBGFSAMPLEREPORT phSample);
|
---|
3178 | VMMR3DECL(uint32_t) DBGFR3SampleReportRetain(DBGFSAMPLEREPORT hSample);
|
---|
3179 | VMMR3DECL(uint32_t) DBGFR3SampleReportRelease(DBGFSAMPLEREPORT hSample);
|
---|
3180 | VMMR3DECL(int) DBGFR3SampleReportStart(DBGFSAMPLEREPORT hSample, uint64_t cSampleUs, PFNDBGFPROGRESS pfnProgress, void *pvUser);
|
---|
3181 | VMMR3DECL(int) DBGFR3SampleReportStop(DBGFSAMPLEREPORT hSample);
|
---|
3182 | VMMR3DECL(int) DBGFR3SampleReportDumpToFile(DBGFSAMPLEREPORT hSample, const char *pszFilename);
|
---|
3183 | /** @} */
|
---|
3184 |
|
---|
3185 | /** @} */
|
---|
3186 |
|
---|
3187 | RT_C_DECLS_END
|
---|
3188 |
|
---|
3189 | #endif /* !VBOX_INCLUDED_vmm_dbgf_h */
|
---|
3190 |
|
---|