1 | /** @file
|
---|
2 | * DBGF - Debugging Facility.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006 InnoTek Systemberatung GmbH
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License as published by the Free Software Foundation,
|
---|
12 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
13 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
14 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * If you received this file as part of a commercial VirtualBox
|
---|
17 | * distribution, then only the terms of your commercial VirtualBox
|
---|
18 | * license agreement apply instead of the previous paragraph.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef __VBox_dbgf_h__
|
---|
22 | #define __VBox_dbgf_h__
|
---|
23 |
|
---|
24 |
|
---|
25 | #include <VBox/cdefs.h>
|
---|
26 | #include <VBox/types.h>
|
---|
27 | #include <VBox/vmm.h>
|
---|
28 | #include <VBox/log.h>
|
---|
29 |
|
---|
30 | #include <iprt/stdarg.h>
|
---|
31 |
|
---|
32 | __BEGIN_DECLS
|
---|
33 |
|
---|
34 |
|
---|
35 | /** @defgroup grp_dbgf The Debugging Facility API
|
---|
36 | * @{
|
---|
37 | */
|
---|
38 |
|
---|
39 | #ifdef IN_GC
|
---|
40 | /** @addgroup grp_dbgf_gc The GC DBGF API
|
---|
41 | * @ingroup grp_dbgf
|
---|
42 | * @{
|
---|
43 | */
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * \#DB (Debug event) handler.
|
---|
47 | *
|
---|
48 | * @returns VBox status code.
|
---|
49 | * VINF_SUCCESS means we completely handled this trap,
|
---|
50 | * other codes are passed execution to host context.
|
---|
51 | *
|
---|
52 | * @param pVM The VM handle.
|
---|
53 | * @param pRegFrame Pointer to the register frame for the trap.
|
---|
54 | * @param uDr6 The DR6 register value.
|
---|
55 | */
|
---|
56 | DBGFGCDECL(int) DBGFGCTrap01Handler(PVM pVM, PCPUMCTXCORE pRegFrame, RTUINTREG uDr6);
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * \#BP (Breakpoint) handler.
|
---|
60 | *
|
---|
61 | * @returns VBox status code.
|
---|
62 | * VINF_SUCCESS means we completely handled this trap,
|
---|
63 | * other codes are passed execution to host context.
|
---|
64 | *
|
---|
65 | * @param pVM The VM handle.
|
---|
66 | * @param pRegFrame Pointer to the register frame for the trap.
|
---|
67 | */
|
---|
68 | DBGFGCDECL(int) DBGFGCTrap03Handler(PVM pVM, PCPUMCTXCORE pRegFrame);
|
---|
69 |
|
---|
70 | /** @} */
|
---|
71 | #endif
|
---|
72 |
|
---|
73 |
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * Mixed address.
|
---|
77 | */
|
---|
78 | typedef struct DBGFADDRESS
|
---|
79 | {
|
---|
80 | /** The flat address. */
|
---|
81 | RTGCUINTPTR FlatPtr;
|
---|
82 | /** The selector offset address. */
|
---|
83 | RTGCUINTPTR off;
|
---|
84 | /** The selector. DBGF_SEL_FLAT is a legal value. */
|
---|
85 | RTSEL Sel;
|
---|
86 | /** Flags describing further details about the address. */
|
---|
87 | uint16_t fFlags;
|
---|
88 | } DBGFADDRESS;
|
---|
89 | /** Pointer to a mixed address. */
|
---|
90 | typedef DBGFADDRESS *PDBGFADDRESS;
|
---|
91 | /** Pointer to a const mixed address. */
|
---|
92 | typedef const DBGFADDRESS *PCDBGFADDRESS;
|
---|
93 |
|
---|
94 | /** @name DBGFADDRESS Flags.
|
---|
95 | * @{ */
|
---|
96 | /** A 16:16 far address. */
|
---|
97 | #define DBGFADDRESS_FLAGS_FAR16 0
|
---|
98 | /** A 16:32 far address. */
|
---|
99 | #define DBGFADDRESS_FLAGS_FAR32 1
|
---|
100 | /** A 16:64 far address. */
|
---|
101 | #define DBGFADDRESS_FLAGS_FAR64 2
|
---|
102 | /** A flat address. */
|
---|
103 | #define DBGFADDRESS_FLAGS_FLAT 3
|
---|
104 | /** The address type mask. */
|
---|
105 | #define DBGFADDRESS_FLAGS_TYPE_MASK 3
|
---|
106 |
|
---|
107 | /** Set if the address is valid. */
|
---|
108 | #define DBGFADDRESS_FLAGS_VALID BIT(2)
|
---|
109 |
|
---|
110 | /** The address is within the hypervisor memoary area (HMA).
|
---|
111 | * If not set, the address can be assumed to be a guest address. */
|
---|
112 | #define DBGFADDRESS_FLAGS_HMA BIT(3)
|
---|
113 |
|
---|
114 | /** Checks if the mixed address is flat or not. */
|
---|
115 | #define DBGFADDRESS_IS_FLAT(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FLAT )
|
---|
116 | /** Checks if the mixed address is far 16:16 or not. */
|
---|
117 | #define DBGFADDRESS_IS_FAR16(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR16 )
|
---|
118 | /** Checks if the mixed address is far 16:32 or not. */
|
---|
119 | #define DBGFADDRESS_IS_FAR32(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR32 )
|
---|
120 | /** Checks if the mixed address is far 16:64 or not. */
|
---|
121 | #define DBGFADDRESS_IS_FAR64(pAddress) ( ((pAddress)->fFlags & DBGFADDRESS_FLAGS_TYPE_MASK) == DBGFADDRESS_FLAGS_FAR64 )
|
---|
122 | /** Checks if the mixed address is valid. */
|
---|
123 | #define DBGFADDRESS_IS_VALID(pAddress) ( (pAddress)->fFlags & DBGFADDRESS_FLAGS_VALID )
|
---|
124 | /** @} */
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Creates a mixed address from a Sel:off pair.
|
---|
128 | *
|
---|
129 | * @returns VBox status code.
|
---|
130 | * @param pVM The VM handle.
|
---|
131 | * @param pAddress Where to store the mixed address.
|
---|
132 | * @param Sel The selector part.
|
---|
133 | * @param off The offset part.
|
---|
134 | */
|
---|
135 | DBGFR3DECL(int) DBGFR3AddrFromSelOff(PVM pVM, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off);
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * Creates a mixed address from a flat address.
|
---|
139 | *
|
---|
140 | * @param pVM The VM handle.
|
---|
141 | * @param pAddress Where to store the mixed address.
|
---|
142 | * @param FlatPtr The flat pointer.
|
---|
143 | */
|
---|
144 | DBGFR3DECL(void) DBGFR3AddrFromFlat(PVM pVM, PDBGFADDRESS pAddress, RTGCUINTPTR FlatPtr);
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * Checks if the specified address is valid (checks the structure pointer too).
|
---|
148 | *
|
---|
149 | * @returns true if valid.
|
---|
150 | * @returns false if invalid.
|
---|
151 | * @param pVM The VM handle.
|
---|
152 | * @param pAddress The address to validate.
|
---|
153 | */
|
---|
154 | DBGFR3DECL(bool) DBGFR3AddrIsValid(PVM pVM, PCDBGFADDRESS pAddress);
|
---|
155 |
|
---|
156 |
|
---|
157 |
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * VMM Debug Event Type.
|
---|
161 | */
|
---|
162 | typedef enum DBGFEVENTTYPE
|
---|
163 | {
|
---|
164 | /** Halt completed.
|
---|
165 | * This notifies that a halt command have been successfully completed.
|
---|
166 | */
|
---|
167 | DBGFEVENT_HALT_DONE = 0,
|
---|
168 | /** Detach completed.
|
---|
169 | * This notifies that the detach command have been successfully completed.
|
---|
170 | */
|
---|
171 | DBGFEVENT_DETACH_DONE,
|
---|
172 | /** The command from the debugger is not recognized.
|
---|
173 | * This means internal error or half implemented features.
|
---|
174 | */
|
---|
175 | DBGFEVENT_INVALID_COMMAND,
|
---|
176 |
|
---|
177 |
|
---|
178 | /** Fatal error.
|
---|
179 | * This notifies a fatal error in the VMM and that the debugger get's a
|
---|
180 | * chance to first hand information about the the problem.
|
---|
181 | */
|
---|
182 | DBGFEVENT_FATAL_ERROR = 100,
|
---|
183 | /** Breakpoint Hit.
|
---|
184 | * This notifies that a breakpoint installed by the debugger was hit. The
|
---|
185 | * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
|
---|
186 | */
|
---|
187 | DBGFEVENT_BREAKPOINT,
|
---|
188 | /** Breakpoint Hit in the Hypervisor.
|
---|
189 | * This notifies that a breakpoint installed by the debugger was hit. The
|
---|
190 | * identifier of the breakpoint can be found in the DBGFEVENT::u::Bp::iBp member.
|
---|
191 | */
|
---|
192 | DBGFEVENT_BREAKPOINT_HYPER,
|
---|
193 | /** Assertion in the Hypervisor (breakpoint instruction).
|
---|
194 | * This notifies that a breakpoint instruction was hit in the hypervisor context.
|
---|
195 | */
|
---|
196 | DBGFEVENT_ASSERTION_HYPER,
|
---|
197 | /** Single Stepped.
|
---|
198 | * This notifies that a single step operation was completed.
|
---|
199 | */
|
---|
200 | DBGFEVENT_STEPPED,
|
---|
201 | /** Single Stepped.
|
---|
202 | * This notifies that a hypervisor single step operation was completed.
|
---|
203 | */
|
---|
204 | DBGFEVENT_STEPPED_HYPER,
|
---|
205 | /** The developer have used the DBGFSTOP macro or the PDMDeviceDBGFSTOP function
|
---|
206 | * to bring up the debugger at a specific place.
|
---|
207 | */
|
---|
208 | DBGFEVENT_DEV_STOP,
|
---|
209 | /** The VM is terminating.
|
---|
210 | * When this notification is received, the debugger thread should detach ASAP.
|
---|
211 | */
|
---|
212 | DBGFEVENT_TERMINATING,
|
---|
213 |
|
---|
214 | /** The usual 32-bit hack. */
|
---|
215 | DBGFEVENT_32BIT_HACK = 0x7fffffff
|
---|
216 | } DBGFEVENTTYPE;
|
---|
217 |
|
---|
218 |
|
---|
219 | /**
|
---|
220 | * The context of an event.
|
---|
221 | */
|
---|
222 | typedef enum DBGFEVENTCTX
|
---|
223 | {
|
---|
224 | /** The usual invalid entry. */
|
---|
225 | DBGFEVENTCTX_INVALID = 0,
|
---|
226 | /** Raw mode. */
|
---|
227 | DBGFEVENTCTX_RAW,
|
---|
228 | /** Recompiled mode. */
|
---|
229 | DBGFEVENTCTX_REM,
|
---|
230 | /** VMX / AVT mode. */
|
---|
231 | DBGFEVENTCTX_HWACCL,
|
---|
232 | /** Hypervisor context. */
|
---|
233 | DBGFEVENTCTX_HYPER,
|
---|
234 | /** Other mode */
|
---|
235 | DBGFEVENTCTX_OTHER,
|
---|
236 |
|
---|
237 | /** The usual 32-bit hack */
|
---|
238 | DBGFEVENTCTX_32BIT_HACK = 0x7fffffff
|
---|
239 | } DBGFEVENTCTX;
|
---|
240 |
|
---|
241 | /**
|
---|
242 | * VMM Debug Event.
|
---|
243 | */
|
---|
244 | typedef struct DBGFEVENT
|
---|
245 | {
|
---|
246 | /** Type. */
|
---|
247 | DBGFEVENTTYPE enmType;
|
---|
248 | /** Context */
|
---|
249 | DBGFEVENTCTX enmCtx;
|
---|
250 | /** Type specific data. */
|
---|
251 | union
|
---|
252 | {
|
---|
253 | /** Fatal error details. */
|
---|
254 | struct
|
---|
255 | {
|
---|
256 | /** The GC return code. */
|
---|
257 | int rc;
|
---|
258 | } FatalError;
|
---|
259 |
|
---|
260 | /** Source location. */
|
---|
261 | struct
|
---|
262 | {
|
---|
263 | /** File name. */
|
---|
264 | R3PTRTYPE(const char *) pszFile;
|
---|
265 | /** Function name. */
|
---|
266 | R3PTRTYPE(const char *) pszFunction;
|
---|
267 | /** Message. */
|
---|
268 | R3PTRTYPE(const char *) pszMessage;
|
---|
269 | /** Line number. */
|
---|
270 | unsigned uLine;
|
---|
271 | } Src;
|
---|
272 |
|
---|
273 | /** Assertion messages. */
|
---|
274 | struct
|
---|
275 | {
|
---|
276 | /** The first message. */
|
---|
277 | R3PTRTYPE(const char *) pszMsg1;
|
---|
278 | /** The second message. */
|
---|
279 | R3PTRTYPE(const char *) pszMsg2;
|
---|
280 | } Assert;
|
---|
281 |
|
---|
282 | /** Breakpoint. */
|
---|
283 | struct DBGFEVENTBP
|
---|
284 | {
|
---|
285 | /** The identifier of the breakpoint which was hit. */
|
---|
286 | RTUINT iBp;
|
---|
287 | } Bp;
|
---|
288 | /** Padding for ensuring that the structure is 8 byte aligned. */
|
---|
289 | uint64_t au64Padding[4];
|
---|
290 | } u;
|
---|
291 | } DBGFEVENT;
|
---|
292 | /** Pointer to VMM Debug Event. */
|
---|
293 | typedef DBGFEVENT *PDBGFEVENT;
|
---|
294 | /** Pointer to const VMM Debug Event. */
|
---|
295 | typedef const DBGFEVENT *PCDBGFEVENT;
|
---|
296 |
|
---|
297 |
|
---|
298 | /** @def DBGFSTOP
|
---|
299 | * Stops the debugger raising a DBGFEVENT_DEVELOPER_STOP event.
|
---|
300 | *
|
---|
301 | * @returns VBox status code which must be propagated up to EM if not VINF_SUCCESS.
|
---|
302 | * @param pVM VM Handle.
|
---|
303 | */
|
---|
304 | #ifdef VBOX_STRICT
|
---|
305 | # define DBGFSTOP(pVM) DBGFR3EventSrc(pVM, DBGFEVENT_DEV_STOP, __FILE__, __LINE__, __PRETTY_FUNCTION__, NULL)
|
---|
306 | #else
|
---|
307 | # define DBGFSTOP(pVM) VINF_SUCCESS
|
---|
308 | #endif
|
---|
309 |
|
---|
310 | /**
|
---|
311 | * Initializes the DBGF.
|
---|
312 | *
|
---|
313 | * @returns VBox status code.
|
---|
314 | * @param pVM VM handle.
|
---|
315 | */
|
---|
316 | DBGFR3DECL(int) DBGFR3Init(PVM pVM);
|
---|
317 |
|
---|
318 | /**
|
---|
319 | * Termiantes and cleans up resources allocated by the DBGF.
|
---|
320 | *
|
---|
321 | * @returns VBox status code.
|
---|
322 | * @param pVM VM Handle.
|
---|
323 | */
|
---|
324 | DBGFR3DECL(int) DBGFR3Term(PVM pVM);
|
---|
325 |
|
---|
326 | /**
|
---|
327 | * Applies relocations to data and code managed by this
|
---|
328 | * component. This function will be called at init and
|
---|
329 | * whenever the VMM need to relocate it self inside the GC.
|
---|
330 | *
|
---|
331 | * @param pVM VM handle.
|
---|
332 | * @param offDelta Relocation delta relative to old location.
|
---|
333 | */
|
---|
334 | DBGFR3DECL(void) DBGFR3Relocate(PVM pVM, RTGCINTPTR offDelta);
|
---|
335 |
|
---|
336 | /**
|
---|
337 | * Forced action callback.
|
---|
338 | * The VMM will call this from it's main loop when VM_FF_DBGF is set.
|
---|
339 | *
|
---|
340 | * The function checks and executes pending commands from the debugger.
|
---|
341 | *
|
---|
342 | * @returns VINF_SUCCESS normally.
|
---|
343 | * @returns VERR_DBGF_RAISE_FATAL_ERROR to pretend a fatal error happend.
|
---|
344 | * @param pVM VM Handle.
|
---|
345 | */
|
---|
346 | DBGFR3DECL(int) DBGFR3VMMForcedAction(PVM pVM);
|
---|
347 |
|
---|
348 | /**
|
---|
349 | * Send a generic debugger event which takes no data.
|
---|
350 | *
|
---|
351 | * @returns VBox status.
|
---|
352 | * @param pVM The VM handle.
|
---|
353 | * @param enmEvent The event to send.
|
---|
354 | */
|
---|
355 | DBGFR3DECL(int) DBGFR3Event(PVM pVM, DBGFEVENTTYPE enmEvent);
|
---|
356 |
|
---|
357 | /**
|
---|
358 | * Send a debugger event which takes the full source file location.
|
---|
359 | *
|
---|
360 | * @returns VBox status.
|
---|
361 | * @param pVM The VM handle.
|
---|
362 | * @param enmEvent The event to send.
|
---|
363 | * @param pszFile Source file.
|
---|
364 | * @param uLine Line number in source file.
|
---|
365 | * @param pszFunction Function name.
|
---|
366 | * @param pszFormat Message which accompanies the event.
|
---|
367 | * @param ... Message arguments.
|
---|
368 | */
|
---|
369 | DBGFR3DECL(int) DBGFR3EventSrc(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, ...);
|
---|
370 |
|
---|
371 | /**
|
---|
372 | * Send a debugger event which takes the full source file location.
|
---|
373 | *
|
---|
374 | * @returns VBox status.
|
---|
375 | * @param pVM The VM handle.
|
---|
376 | * @param enmEvent The event to send.
|
---|
377 | * @param pszFile Source file.
|
---|
378 | * @param uLine Line number in source file.
|
---|
379 | * @param pszFunction Function name.
|
---|
380 | * @param pszFormat Message which accompanies the event.
|
---|
381 | * @param args Message arguments.
|
---|
382 | */
|
---|
383 | DBGFR3DECL(int) DBGFR3EventSrcV(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszFile, unsigned uLine, const char *pszFunction, const char *pszFormat, va_list args);
|
---|
384 |
|
---|
385 | /**
|
---|
386 | * Send a debugger event which takes the two assertion messages.
|
---|
387 | *
|
---|
388 | * @returns VBox status.
|
---|
389 | * @param pVM The VM handle.
|
---|
390 | * @param enmEvent The event to send.
|
---|
391 | * @param pszMsg1 First assertion message.
|
---|
392 | * @param pszMsg2 Second assertion message.
|
---|
393 | */
|
---|
394 | DBGFR3DECL(int) DBGFR3EventAssertion(PVM pVM, DBGFEVENTTYPE enmEvent, const char *pszMsg1, const char *pszMsg2);
|
---|
395 |
|
---|
396 | /**
|
---|
397 | * Breakpoint was hit somewhere.
|
---|
398 | * Figure out which breakpoint it is and notify the debugger.
|
---|
399 | *
|
---|
400 | * @returns VBox status.
|
---|
401 | * @param pVM The VM handle.
|
---|
402 | * @param enmEvent DBGFEVENT_BREAKPOINT_HYPER or DBGFEVENT_BREAKPOINT.
|
---|
403 | */
|
---|
404 | DBGFR3DECL(int) DBGFR3EventBreakpoint(PVM pVM, DBGFEVENTTYPE enmEvent);
|
---|
405 |
|
---|
406 | /**
|
---|
407 | * Attaches a debugger to the specified VM.
|
---|
408 | *
|
---|
409 | * Only one debugger at a time.
|
---|
410 | *
|
---|
411 | * @returns VBox status code.
|
---|
412 | * @param pVM VM Handle.
|
---|
413 | */
|
---|
414 | DBGFR3DECL(int) DBGFR3Attach(PVM pVM);
|
---|
415 |
|
---|
416 | /**
|
---|
417 | * Detaches a debugger from the specified VM.
|
---|
418 | *
|
---|
419 | * Caller must be attached to the VM.
|
---|
420 | *
|
---|
421 | * @returns VBox status code.
|
---|
422 | * @param pVM VM Handle.
|
---|
423 | */
|
---|
424 | DBGFR3DECL(int) DBGFR3Detach(PVM pVM);
|
---|
425 |
|
---|
426 | /**
|
---|
427 | * Wait for a debug event.
|
---|
428 | *
|
---|
429 | * @returns VBox status. Will not return VBOX_INTERRUPTED.
|
---|
430 | * @param pVM VM handle.
|
---|
431 | * @param cMillies Number of millies to wait.
|
---|
432 | * @param ppEvent Where to store the event pointer.
|
---|
433 | */
|
---|
434 | DBGFR3DECL(int) DBGFR3EventWait(PVM pVM, unsigned cMillies, PCDBGFEVENT *ppEvent);
|
---|
435 |
|
---|
436 | /**
|
---|
437 | * Halts VM execution.
|
---|
438 | *
|
---|
439 | * After calling this the VM isn't actually halted till an DBGFEVENT_HALT_DONE
|
---|
440 | * arrives. Until that time it's not possible to issue any new commands.
|
---|
441 | *
|
---|
442 | * @returns VBox status.
|
---|
443 | * @param pVM VM handle.
|
---|
444 | */
|
---|
445 | DBGFR3DECL(int) DBGFR3Halt(PVM pVM);
|
---|
446 |
|
---|
447 | /**
|
---|
448 | * Checks if the VM is halted by the debugger.
|
---|
449 | *
|
---|
450 | * @returns True if halted.
|
---|
451 | * @returns False if not halted.
|
---|
452 | * @param pVM VM handle.
|
---|
453 | */
|
---|
454 | DBGFR3DECL(bool) DBGFR3IsHalted(PVM pVM);
|
---|
455 |
|
---|
456 | /**
|
---|
457 | * Checks if the the debugger can wait for events or not.
|
---|
458 | *
|
---|
459 | * This function is only used by lazy, multiplexing debuggers. :-)
|
---|
460 | *
|
---|
461 | * @returns True if waitable.
|
---|
462 | * @returns False if not waitable.
|
---|
463 | * @param pVM VM handle.
|
---|
464 | */
|
---|
465 | DBGFR3DECL(bool) DBGFR3CanWait(PVM pVM);
|
---|
466 |
|
---|
467 | /**
|
---|
468 | * Resumes VM execution.
|
---|
469 | *
|
---|
470 | * There is no receipt event on this command.
|
---|
471 | *
|
---|
472 | * @returns VBox status.
|
---|
473 | * @param pVM VM handle.
|
---|
474 | */
|
---|
475 | DBGFR3DECL(int) DBGFR3Resume(PVM pVM);
|
---|
476 |
|
---|
477 | /**
|
---|
478 | * Step Into.
|
---|
479 | *
|
---|
480 | * A single step event is generated from this command.
|
---|
481 | * The current implementation is not reliable, so don't rely on the event comming.
|
---|
482 | *
|
---|
483 | * @returns VBox status.
|
---|
484 | * @param pVM VM handle.
|
---|
485 | */
|
---|
486 | DBGFR3DECL(int) DBGFR3Step(PVM pVM);
|
---|
487 |
|
---|
488 | /**
|
---|
489 | * Call this to single step rawmode or recompiled mode.
|
---|
490 | *
|
---|
491 | * You must pass down the return code to the EM loop! That's
|
---|
492 | * where the actual single stepping take place (at least in the
|
---|
493 | * current implementation).
|
---|
494 | *
|
---|
495 | * @returns VINF_EM_DBG_STEP
|
---|
496 | * @thread EMT
|
---|
497 | */
|
---|
498 | DBGFR3DECL(int) DBGFR3PrgStep(PVM pVM);
|
---|
499 |
|
---|
500 |
|
---|
501 | /** Breakpoint type. */
|
---|
502 | typedef enum DBGFBPTYPE
|
---|
503 | {
|
---|
504 | /** Free breakpoint entry. */
|
---|
505 | DBGFBPTYPE_FREE = 0,
|
---|
506 | /** Debug register. */
|
---|
507 | DBGFBPTYPE_REG,
|
---|
508 | /** INT 3 instruction. */
|
---|
509 | DBGFBPTYPE_INT3,
|
---|
510 | /** Recompiler. */
|
---|
511 | DBGFBPTYPE_REM,
|
---|
512 | /** ensure 32-bit size. */
|
---|
513 | DBGFBPTYPE_32BIT_HACK = 0x7fffffff
|
---|
514 | } DBGFBPTYPE;
|
---|
515 |
|
---|
516 |
|
---|
517 | /**
|
---|
518 | * A Breakpoint.
|
---|
519 | */
|
---|
520 | typedef struct DBGFBP
|
---|
521 | {
|
---|
522 | /** The number of breakpoint hits. */
|
---|
523 | uint64_t cHits;
|
---|
524 | /** The hit number which starts to trigger the breakpoint. */
|
---|
525 | uint64_t iHitTrigger;
|
---|
526 | /** The hit number which stops triggering the breakpoint (disables it).
|
---|
527 | * Use ~(uint64_t)0 if it should never stop. */
|
---|
528 | uint64_t iHitDisable;
|
---|
529 | /** The Flat GC address of the breakpoint.
|
---|
530 | * (PC register value if REM type?) */
|
---|
531 | RTGCUINTPTR GCPtr;
|
---|
532 | /** The breakpoint id. */
|
---|
533 | RTUINT iBp;
|
---|
534 | /** The breakpoint status - enabled or disabled. */
|
---|
535 | bool fEnabled;
|
---|
536 |
|
---|
537 | /** The breakpoint type. */
|
---|
538 | DBGFBPTYPE enmType;
|
---|
539 | /** Union of type specific data. */
|
---|
540 | union
|
---|
541 | {
|
---|
542 | /** Debug register data. */
|
---|
543 | struct DBGFBPREG
|
---|
544 | {
|
---|
545 | /** The debug register number. */
|
---|
546 | uint8_t iReg;
|
---|
547 | /** The access type (one of the X86_DR7_RW_* value). */
|
---|
548 | uint8_t fType;
|
---|
549 | /** The access size. */
|
---|
550 | uint8_t cb;
|
---|
551 | } Reg;
|
---|
552 | /** Recompiler breakpoint data. */
|
---|
553 | struct DBGFBPINT3
|
---|
554 | {
|
---|
555 | /** The byte value we replaced by the INT 3 instruction. */
|
---|
556 | uint8_t bOrg;
|
---|
557 | } Int3;
|
---|
558 |
|
---|
559 | /** Recompiler breakpoint data. */
|
---|
560 | struct DBGFBPREM
|
---|
561 | {
|
---|
562 | /** nothing yet */
|
---|
563 | uint8_t fDummy;
|
---|
564 | } Rem;
|
---|
565 | /** Paddind to ensure that the size is identical on win32 and linux. */
|
---|
566 | uint64_t u64Padding;
|
---|
567 | } u;
|
---|
568 | } DBGFBP;
|
---|
569 |
|
---|
570 | /** Pointer to a breakpoint. */
|
---|
571 | typedef DBGFBP *PDBGFBP;
|
---|
572 | /** Pointer to a const breakpoint. */
|
---|
573 | typedef const DBGFBP *PCDBGFBP;
|
---|
574 |
|
---|
575 |
|
---|
576 | /**
|
---|
577 | * Sets a breakpoint (int 3 based).
|
---|
578 | *
|
---|
579 | * @returns VBox status code.
|
---|
580 | * @param pVM The VM handle.
|
---|
581 | * @param pAddress The address of the breakpoint.
|
---|
582 | * @param iHitTrigger The hit count at which the breakpoint start triggering.
|
---|
583 | * Use 0 (or 1) if it's gonna trigger at once.
|
---|
584 | * @param iHitDisable The hit count which disables the breakpoint.
|
---|
585 | * Use ~(uint64_t) if it's never gonna be disabled.
|
---|
586 | * @param piBp Where to store the breakpoint id. (optional)
|
---|
587 | * @thread Any thread.
|
---|
588 | */
|
---|
589 | DBGFR3DECL(int) DBGFR3BpSet(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp);
|
---|
590 |
|
---|
591 | /**
|
---|
592 | * Sets a register breakpoint.
|
---|
593 | *
|
---|
594 | * @returns VBox status code.
|
---|
595 | * @param pVM The VM handle.
|
---|
596 | * @param pAddress The address of the breakpoint.
|
---|
597 | * @param iHitTrigger The hit count at which the breakpoint start triggering.
|
---|
598 | * Use 0 (or 1) if it's gonna trigger at once.
|
---|
599 | * @param iHitDisable The hit count which disables the breakpoint.
|
---|
600 | * Use ~(uint64_t) if it's never gonna be disabled.
|
---|
601 | * @param fType The access type (one of the X86_DR7_RW_* defines).
|
---|
602 | * @param cb The access size - 1,2,4 or 8 (the latter is AMD64 long mode only.
|
---|
603 | * Must be 1 if fType is X86_DR7_RW_EO.
|
---|
604 | * @param piBp Where to store the breakpoint id. (optional)
|
---|
605 | * @thread Any thread.
|
---|
606 | */
|
---|
607 | DBGFR3DECL(int) DBGFR3BpSetReg(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
|
---|
608 | uint8_t fType, uint8_t cb, PRTUINT piBp);
|
---|
609 |
|
---|
610 | /**
|
---|
611 | * Sets a recompiler breakpoint.
|
---|
612 | *
|
---|
613 | * @returns VBox status code.
|
---|
614 | * @param pVM The VM handle.
|
---|
615 | * @param pAddress The address of the breakpoint.
|
---|
616 | * @param iHitTrigger The hit count at which the breakpoint start triggering.
|
---|
617 | * Use 0 (or 1) if it's gonna trigger at once.
|
---|
618 | * @param iHitDisable The hit count which disables the breakpoint.
|
---|
619 | * Use ~(uint64_t) if it's never gonna be disabled.
|
---|
620 | * @param piBp Where to store the breakpoint id. (optional)
|
---|
621 | * @thread Any thread.
|
---|
622 | */
|
---|
623 | DBGFR3DECL(int) DBGFR3BpSetREM(PVM pVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp);
|
---|
624 |
|
---|
625 | /**
|
---|
626 | * Clears a breakpoint.
|
---|
627 | *
|
---|
628 | * @returns VBox status code.
|
---|
629 | * @param pVM The VM handle.
|
---|
630 | * @param iBp The id of the breakpoint which should be removed (cleared).
|
---|
631 | * @thread Any thread.
|
---|
632 | */
|
---|
633 | DBGFR3DECL(int) DBGFR3BpClear(PVM pVM, RTUINT iBp);
|
---|
634 |
|
---|
635 | /**
|
---|
636 | * Enables a breakpoint.
|
---|
637 | *
|
---|
638 | * @returns VBox status code.
|
---|
639 | * @param pVM The VM handle.
|
---|
640 | * @param iBp The id of the breakpoint which should be enabled.
|
---|
641 | * @thread Any thread.
|
---|
642 | */
|
---|
643 | DBGFR3DECL(int) DBGFR3BpEnable(PVM pVM, RTUINT iBp);
|
---|
644 |
|
---|
645 | /**
|
---|
646 | * Disables a breakpoint.
|
---|
647 | *
|
---|
648 | * @returns VBox status code.
|
---|
649 | * @param pVM The VM handle.
|
---|
650 | * @param iBp The id of the breakpoint which should be disabled.
|
---|
651 | * @thread Any thread.
|
---|
652 | */
|
---|
653 | DBGFR3DECL(int) DBGFR3BpDisable(PVM pVM, RTUINT iBp);
|
---|
654 |
|
---|
655 | /**
|
---|
656 | * Breakpoint enumeration callback function.
|
---|
657 | *
|
---|
658 | * @returns VBox status code. Any failure will stop the enumeration.
|
---|
659 | * @param pVM The VM handle.
|
---|
660 | * @param pvUser The user argument.
|
---|
661 | * @param pBp Pointer to the breakpoint information. (readonly)
|
---|
662 | */
|
---|
663 | typedef DECLCALLBACK(int) FNDBGFBPENUM(PVM pVM, void *pvUser, PCDBGFBP pBp);
|
---|
664 | /** Pointer to a breakpoint enumeration callback function. */
|
---|
665 | typedef FNDBGFBPENUM *PFNDBGFBPENUM;
|
---|
666 |
|
---|
667 | /**
|
---|
668 | * Enumerate the breakpoints.
|
---|
669 | *
|
---|
670 | * @returns VBox status code.
|
---|
671 | * @param pVM The VM handle.
|
---|
672 | * @param pfnCallback The callback function.
|
---|
673 | * @param pvUser The user argument to pass to the callback.
|
---|
674 | * @thread Any thread but the callback will be called from EMT.
|
---|
675 | */
|
---|
676 | DBGFR3DECL(int) DBGFR3BpEnum(PVM pVM, PFNDBGFBPENUM pfnCallback, void *pvUser);
|
---|
677 |
|
---|
678 |
|
---|
679 | /**
|
---|
680 | * Gets the hardware breakpoint configuration as DR7.
|
---|
681 | *
|
---|
682 | * @returns DR7 from the DBGF point of view.
|
---|
683 | * @param pVM The VM handle.
|
---|
684 | */
|
---|
685 | DBGFDECL(RTGCUINTREG) DBGFBpGetDR7(PVM pVM);
|
---|
686 |
|
---|
687 | /**
|
---|
688 | * Gets the address of the hardware breakpoint number 0.
|
---|
689 | *
|
---|
690 | * @returns DR0 from the DBGF point of view.
|
---|
691 | * @param pVM The VM handle.
|
---|
692 | */
|
---|
693 | DBGFDECL(RTGCUINTREG) DBGFBpGetDR0(PVM pVM);
|
---|
694 |
|
---|
695 | /**
|
---|
696 | * Gets the address of the hardware breakpoint number 1.
|
---|
697 | *
|
---|
698 | * @returns DR1 from the DBGF point of view.
|
---|
699 | * @param pVM The VM handle.
|
---|
700 | */
|
---|
701 | DBGFDECL(RTGCUINTREG) DBGFBpGetDR1(PVM pVM);
|
---|
702 |
|
---|
703 | /**
|
---|
704 | * Gets the address of the hardware breakpoint number 2.
|
---|
705 | *
|
---|
706 | * @returns DR2 from the DBGF point of view.
|
---|
707 | * @param pVM The VM handle.
|
---|
708 | */
|
---|
709 | DBGFDECL(RTGCUINTREG) DBGFBpGetDR2(PVM pVM);
|
---|
710 |
|
---|
711 | /**
|
---|
712 | * Gets the address of the hardware breakpoint number 3.
|
---|
713 | *
|
---|
714 | * @returns DR3 from the DBGF point of view.
|
---|
715 | * @param pVM The VM handle.
|
---|
716 | */
|
---|
717 | DBGFDECL(RTGCUINTREG) DBGFBpGetDR3(PVM pVM);
|
---|
718 |
|
---|
719 |
|
---|
720 |
|
---|
721 | /** Pointer to a info helper callback structure. */
|
---|
722 | typedef struct DBGFINFOHLP *PDBGFINFOHLP;
|
---|
723 | /** Pointer to a const info helper callback structure. */
|
---|
724 | typedef const struct DBGFINFOHLP *PCDBGFINFOHLP;
|
---|
725 |
|
---|
726 | /**
|
---|
727 | * Info helper callback structure.
|
---|
728 | */
|
---|
729 | typedef struct DBGFINFOHLP
|
---|
730 | {
|
---|
731 | /**
|
---|
732 | * Print formatted string.
|
---|
733 | *
|
---|
734 | * @param pHlp Pointer to this structure.
|
---|
735 | * @param pszFormat The format string.
|
---|
736 | * @param ... Arguments.
|
---|
737 | */
|
---|
738 | DECLCALLBACKMEMBER(void, pfnPrintf)(PCDBGFINFOHLP pHlp, const char *pszFormat, ...);
|
---|
739 |
|
---|
740 | /**
|
---|
741 | * Print formatted string.
|
---|
742 | *
|
---|
743 | * @param pHlp Pointer to this structure.
|
---|
744 | * @param pszFormat The format string.
|
---|
745 | * @param args Argument list.
|
---|
746 | */
|
---|
747 | DECLCALLBACKMEMBER(void, pfnPrintfV)(PCDBGFINFOHLP pHlp, const char *pszFormat, va_list args);
|
---|
748 | } DBGFINFOHLP;
|
---|
749 |
|
---|
750 |
|
---|
751 | /**
|
---|
752 | * Info handler, device version.
|
---|
753 | *
|
---|
754 | * @param pDevIns Device instance which registered the info.
|
---|
755 | * @param pHlp Callback functions for doing output.
|
---|
756 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
757 | */
|
---|
758 | typedef DECLCALLBACK(void) FNDBGFHANDLERDEV(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
759 | /** Pointer to a FNDBGFHANDLERDEV function. */
|
---|
760 | typedef FNDBGFHANDLERDEV *PFNDBGFHANDLERDEV;
|
---|
761 |
|
---|
762 | /**
|
---|
763 | * Info handler, driver version.
|
---|
764 | *
|
---|
765 | * @param pDrvIns Driver instance which registered the info.
|
---|
766 | * @param pHlp Callback functions for doing output.
|
---|
767 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
768 | */
|
---|
769 | typedef DECLCALLBACK(void) FNDBGFHANDLERDRV(PPDMDRVINS pDrvIns, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
770 | /** Pointer to a FNDBGFHANDLERDRV function. */
|
---|
771 | typedef FNDBGFHANDLERDRV *PFNDBGFHANDLERDRV;
|
---|
772 |
|
---|
773 | /**
|
---|
774 | * Info handler, internal version.
|
---|
775 | *
|
---|
776 | * @param pVM The VM handle.
|
---|
777 | * @param pHlp Callback functions for doing output.
|
---|
778 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
779 | */
|
---|
780 | typedef DECLCALLBACK(void) FNDBGFHANDLERINT(PVM pVM, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
781 | /** Pointer to a FNDBGFHANDLERINT function. */
|
---|
782 | typedef FNDBGFHANDLERINT *PFNDBGFHANDLERINT;
|
---|
783 |
|
---|
784 | /**
|
---|
785 | * Info handler, external version.
|
---|
786 | *
|
---|
787 | * @param pvUser User argument.
|
---|
788 | * @param pHlp Callback functions for doing output.
|
---|
789 | * @param pszArgs Argument string. Optional and specific to the handler.
|
---|
790 | */
|
---|
791 | typedef DECLCALLBACK(void) FNDBGFHANDLEREXT(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs);
|
---|
792 | /** Pointer to a FNDBGFHANDLEREXT function. */
|
---|
793 | typedef FNDBGFHANDLEREXT *PFNDBGFHANDLEREXT;
|
---|
794 |
|
---|
795 |
|
---|
796 | /**
|
---|
797 | * Register a info handler owned by a device.
|
---|
798 | *
|
---|
799 | * @returns VBox status code.
|
---|
800 | * @param pVM VM handle.
|
---|
801 | * @param pszName The identifier of the info.
|
---|
802 | * @param pszDesc The description of the info and any arguments the handler may take.
|
---|
803 | * @param pfnHandler The handler function to be called to display the info.
|
---|
804 | * @param pDevIns The device instance owning the info.
|
---|
805 | */
|
---|
806 | DBGFR3DECL(int) DBGFR3InfoRegisterDevice(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler, PPDMDEVINS pDevIns);
|
---|
807 |
|
---|
808 | /**
|
---|
809 | * Register a info handler owned by a driver.
|
---|
810 | *
|
---|
811 | * @returns VBox status code.
|
---|
812 | * @param pVM VM handle.
|
---|
813 | * @param pszName The identifier of the info.
|
---|
814 | * @param pszDesc The description of the info and any arguments the handler may take.
|
---|
815 | * @param pfnHandler The handler function to be called to display the info.
|
---|
816 | * @param pDrvIns The driver instance owning the info.
|
---|
817 | */
|
---|
818 | DBGFR3DECL(int) DBGFR3InfoRegisterDriver(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDRV pfnHandler, PPDMDRVINS pDrvIns);
|
---|
819 |
|
---|
820 | /**
|
---|
821 | * Register a info handler owned by an internal component.
|
---|
822 | *
|
---|
823 | * @returns VBox status code.
|
---|
824 | * @param pVM VM handle.
|
---|
825 | * @param pszName The identifier of the info.
|
---|
826 | * @param pszDesc The description of the info and any arguments the handler may take.
|
---|
827 | * @param pfnHandler The handler function to be called to display the info.
|
---|
828 | */
|
---|
829 | DBGFR3DECL(int) DBGFR3InfoRegisterInternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLERINT pfnHandler);
|
---|
830 |
|
---|
831 | /**
|
---|
832 | * Register a info handler owned by an external component.
|
---|
833 | *
|
---|
834 | * @returns VBox status code.
|
---|
835 | * @param pVM VM handle.
|
---|
836 | * @param pszName The identifier of the info.
|
---|
837 | * @param pszDesc The description of the info and any arguments the handler may take.
|
---|
838 | * @param pfnHandler The handler function to be called to display the info.
|
---|
839 | * @param pvUser User argument to be passed to the handler.
|
---|
840 | */
|
---|
841 | DBGFR3DECL(int) DBGFR3InfoRegisterExternal(PVM pVM, const char *pszName, const char *pszDesc, PFNDBGFHANDLEREXT pfnHandler, void *pvUser);
|
---|
842 |
|
---|
843 | /**
|
---|
844 | * Deregister one(/all) info handler(s) owned by a device.
|
---|
845 | *
|
---|
846 | * @returns VBox status code.
|
---|
847 | * @param pVM VM Handle.
|
---|
848 | * @param pDevIns Device instance.
|
---|
849 | * @param pszName The identifier of the info. If NULL all owned by the device.
|
---|
850 | */
|
---|
851 | DBGFR3DECL(int) DBGFR3InfoDeregisterDevice(PVM pVM, PPDMDEVINS pDevIns, const char *pszName);
|
---|
852 |
|
---|
853 | /**
|
---|
854 | * Deregister one(/all) info handler(s) owned by a driver.
|
---|
855 | *
|
---|
856 | * @returns VBox status code.
|
---|
857 | * @param pVM VM Handle.
|
---|
858 | * @param pDrvIns Driver instance.
|
---|
859 | * @param pszName The identifier of the info. If NULL all owned by the driver.
|
---|
860 | */
|
---|
861 | DBGFR3DECL(int) DBGFR3InfoDeregisterDriver(PVM pVM, PPDMDRVINS pDrvIns, const char *pszName);
|
---|
862 |
|
---|
863 | /**
|
---|
864 | * Deregister a info handler owned by an internal component.
|
---|
865 | *
|
---|
866 | * @returns VBox status code.
|
---|
867 | * @param pVM VM Handle.
|
---|
868 | * @param pszName The identifier of the info. If NULL all owned by the device.
|
---|
869 | */
|
---|
870 | DBGFR3DECL(int) DBGFR3InfoDeregisterInternal(PVM pVM, const char *pszName);
|
---|
871 |
|
---|
872 | /**
|
---|
873 | * Deregister a info handler owned by an external component.
|
---|
874 | *
|
---|
875 | * @returns VBox status code.
|
---|
876 | * @param pVM VM Handle.
|
---|
877 | * @param pszName The identifier of the info. If NULL all owned by the device.
|
---|
878 | */
|
---|
879 | DBGFR3DECL(int) DBGFR3InfoDeregisterExternal(PVM pVM, const char *pszName);
|
---|
880 |
|
---|
881 | /**
|
---|
882 | * Display a piece of info writing to the supplied handler.
|
---|
883 | *
|
---|
884 | * @returns VBox status code.
|
---|
885 | * @param pVM VM handle.
|
---|
886 | * @param pszName The identifier of the info to display.
|
---|
887 | * @param pszArgs Arguments to the info handler.
|
---|
888 | * @param pHlp The output helper functions. If NULL the logger will be used.
|
---|
889 | */
|
---|
890 | DBGFR3DECL(int) DBGFR3Info(PVM pVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp);
|
---|
891 |
|
---|
892 | /** @def DBGFR3InfoLog
|
---|
893 | * Display a piece of info writing to the log if enabled.
|
---|
894 | *
|
---|
895 | * @param pVM VM handle.
|
---|
896 | * @param pszName The identifier of the info to display.
|
---|
897 | * @param pszArgs Arguments to the info handler.
|
---|
898 | */
|
---|
899 | #ifdef LOG_ENABLED
|
---|
900 | #define DBGFR3InfoLog(pVM, pszName, pszArgs) \
|
---|
901 | do { \
|
---|
902 | if (LogIsEnabled()) \
|
---|
903 | DBGFR3Info(pVM, pszName, pszArgs, NULL); \
|
---|
904 | } while (0)
|
---|
905 | #else
|
---|
906 | #define DBGFR3InfoLog(pVM, pszName, pszArgs) do { } while (0)
|
---|
907 | #endif
|
---|
908 |
|
---|
909 |
|
---|
910 | /**
|
---|
911 | * Changes the logger group settings.
|
---|
912 | *
|
---|
913 | * @returns VBox status code.
|
---|
914 | * @param pVM The VM handle.
|
---|
915 | * @param pszGroupSettings The group settings string. (VBOX_LOG)
|
---|
916 | */
|
---|
917 | DBGFR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings);
|
---|
918 |
|
---|
919 | /**
|
---|
920 | * Changes the logger flag settings.
|
---|
921 | *
|
---|
922 | * @returns VBox status code.
|
---|
923 | * @param pVM The VM handle.
|
---|
924 | * @param pszFlagSettings The flag settings string. (VBOX_LOG_FLAGS)
|
---|
925 | */
|
---|
926 | DBGFR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings);
|
---|
927 |
|
---|
928 | /**
|
---|
929 | * Changes the logger destination settings.
|
---|
930 | *
|
---|
931 | * @returns VBox status code.
|
---|
932 | * @param pVM The VM handle.
|
---|
933 | * @param pszDestSettings The destination settings string. (VBOX_LOG_DEST)
|
---|
934 | */
|
---|
935 | DBGFR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings);
|
---|
936 |
|
---|
937 |
|
---|
938 | /**
|
---|
939 | * Enumeration callback for use with DBGFR3InfoEnum.
|
---|
940 | *
|
---|
941 | * @returns VBox status code.
|
---|
942 | * A status code indicating failure will end the enumeration
|
---|
943 | * and DBGFR3InfoEnum will return with that status code.
|
---|
944 | * @param pVM VM handle.
|
---|
945 | * @param pszName Info identifier name.
|
---|
946 | * @param pszDesc The description.
|
---|
947 | */
|
---|
948 | typedef DECLCALLBACK(int) FNDBGFINFOENUM(PVM pVM, const char *pszName, const char *pszDesc, void *pvUser);
|
---|
949 | /** Pointer to a FNDBGFINFOENUM function. */
|
---|
950 | typedef FNDBGFINFOENUM *PFNDBGFINFOENUM;
|
---|
951 |
|
---|
952 | /**
|
---|
953 | * Enumerate all the register info handlers.
|
---|
954 | *
|
---|
955 | * @returns VBox status code.
|
---|
956 | * @param pVM VM handle.
|
---|
957 | * @param pfnCallback Pointer to callback function.
|
---|
958 | * @param pvUser User argument to pass to the callback.
|
---|
959 | */
|
---|
960 | DBGFR3DECL(int) DBGFR3InfoEnum(PVM pVM, PFNDBGFINFOENUM pfnCallback, void *pvUser);
|
---|
961 |
|
---|
962 | /**
|
---|
963 | * Gets the logger info helper.
|
---|
964 | * The returned info helper will unconditionally write all output to the log.
|
---|
965 | *
|
---|
966 | * @returns Pointer to the logger info helper.
|
---|
967 | */
|
---|
968 | DBGFR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogHlp(void);
|
---|
969 |
|
---|
970 | /**
|
---|
971 | * Gets the release logger info helper.
|
---|
972 | * The returned info helper will unconditionally write all output to the release log.
|
---|
973 | *
|
---|
974 | * @returns Pointer to the release logger info helper.
|
---|
975 | */
|
---|
976 | DBGFR3DECL(PCDBGFINFOHLP) DBGFR3InfoLogRelHlp(void);
|
---|
977 |
|
---|
978 |
|
---|
979 |
|
---|
980 | /** Max length (including '\\0') of a symbol name. */
|
---|
981 | #define DBGF_SYMBOL_NAME_LENGTH 512
|
---|
982 |
|
---|
983 | /**
|
---|
984 | * Debug symbol.
|
---|
985 | */
|
---|
986 | typedef struct DBGFSYMBOL
|
---|
987 | {
|
---|
988 | /** Symbol value (address). */
|
---|
989 | RTGCUINTPTR Value;
|
---|
990 | /** Symbol size. */
|
---|
991 | uint32_t cb;
|
---|
992 | /** Symbol Flags. (reserved). */
|
---|
993 | uint32_t fFlags;
|
---|
994 | /** Symbol name. */
|
---|
995 | char szName[DBGF_SYMBOL_NAME_LENGTH];
|
---|
996 | } DBGFSYMBOL;
|
---|
997 | /** Pointer to debug symbol. */
|
---|
998 | typedef DBGFSYMBOL *PDBGFSYMBOL;
|
---|
999 | /** Pointer to const debug symbol. */
|
---|
1000 | typedef const DBGFSYMBOL *PCDBGFSYMBOL;
|
---|
1001 |
|
---|
1002 | /**
|
---|
1003 | * Debug line number information.
|
---|
1004 | */
|
---|
1005 | typedef struct DBGFLINE
|
---|
1006 | {
|
---|
1007 | /** Address. */
|
---|
1008 | RTGCUINTPTR Address;
|
---|
1009 | /** Line number. */
|
---|
1010 | uint32_t uLineNo;
|
---|
1011 | /** Filename. */
|
---|
1012 | char szFilename[260];
|
---|
1013 | } DBGFLINE;
|
---|
1014 | /** Pointer to debug line number. */
|
---|
1015 | typedef DBGFLINE *PDBGFLINE;
|
---|
1016 | /** Pointer to const debug line number. */
|
---|
1017 | typedef const DBGFLINE *PCDBGFLINE;
|
---|
1018 |
|
---|
1019 |
|
---|
1020 | /**
|
---|
1021 | * Load debug info, optionally related to a specific module.
|
---|
1022 | *
|
---|
1023 | * @returns VBox status.
|
---|
1024 | * @param pVM VM Handle.
|
---|
1025 | * @param pszFilename Path to the file containing the symbol information.
|
---|
1026 | * This can be the executable image, a flat symbol file of some kind or stripped debug info.
|
---|
1027 | * @param AddressDelta The value to add to the loaded symbols.
|
---|
1028 | * @param pszName Short hand name for the module. If not related to a module specify NULL.
|
---|
1029 | * @param Address Address which the image is loaded at. This will be used to reference the module other places in the api.
|
---|
1030 | * Ignored when pszName is NULL.
|
---|
1031 | * @param cbImage Size of the image.
|
---|
1032 | * Ignored when pszName is NULL.
|
---|
1033 | */
|
---|
1034 | DBGFR3DECL(int) DBGFR3ModuleLoad(PVM pVM, const char *pszFilename, RTGCUINTPTR AddressDelta, const char *pszName, RTGCUINTPTR ModuleAddress, unsigned cbImage);
|
---|
1035 |
|
---|
1036 | /**
|
---|
1037 | * Interface used by PDMR3LdrRelocate for telling us that a GC module has been relocated.
|
---|
1038 | *
|
---|
1039 | * @param pVM The VM handle.
|
---|
1040 | * @param OldImageBase The old image base.
|
---|
1041 | * @param NewImageBase The new image base.
|
---|
1042 | * @param cbImage The image size.
|
---|
1043 | * @param pszFilename The image filename.
|
---|
1044 | * @param pszName The module name.
|
---|
1045 | */
|
---|
1046 | DBGFR3DECL(void) DBGFR3ModuleRelocate(PVM pVM, RTGCUINTPTR OldImageBase, RTGCUINTPTR NewImageBase, unsigned cbImage,
|
---|
1047 | const char *pszFilename, const char *pszName);
|
---|
1048 |
|
---|
1049 | /**
|
---|
1050 | * Adds a symbol to the debug info manager.
|
---|
1051 | *
|
---|
1052 | * @returns VBox status.
|
---|
1053 | * @param pVM VM Handle.
|
---|
1054 | * @param ModuleAddress Module address. Use 0 if no module.
|
---|
1055 | * @param SymbolAddress Symbol address
|
---|
1056 | * @param cbSymbol Size of the symbol. Use 0 if info not available.
|
---|
1057 | * @param pszSymbol Symbol name.
|
---|
1058 | */
|
---|
1059 | DBGFR3DECL(int) DBGFR3SymbolAdd(PVM pVM, RTGCUINTPTR ModuleAddress, RTGCUINTPTR SymbolAddress, RTUINT cbSymbol, const char *pszSymbol);
|
---|
1060 |
|
---|
1061 | /**
|
---|
1062 | * Find symbol by address (nearest).
|
---|
1063 | *
|
---|
1064 | * @returns VBox status.
|
---|
1065 | * @param pVM VM handle.
|
---|
1066 | * @param Address Address.
|
---|
1067 | * @param poffDisplacement Where to store the symbol displacement from Address.
|
---|
1068 | * @param pSymbol Where to store the symbol info.
|
---|
1069 | */
|
---|
1070 | DBGFR3DECL(int) DBGFR3SymbolByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFSYMBOL pSymbol);
|
---|
1071 |
|
---|
1072 | /**
|
---|
1073 | * Find symbol by name (first).
|
---|
1074 | *
|
---|
1075 | * @returns VBox status.
|
---|
1076 | * @param pVM VM handle.
|
---|
1077 | * @param pszSymbol Symbol name.
|
---|
1078 | * @param pSymbol Where to store the symbol info.
|
---|
1079 | */
|
---|
1080 | DBGFR3DECL(int) DBGFR3SymbolByName(PVM pVM, const char *pszSymbol, PDBGFSYMBOL pSymbol);
|
---|
1081 |
|
---|
1082 | /**
|
---|
1083 | * Find symbol by address (nearest), allocate return buffer.
|
---|
1084 | *
|
---|
1085 | * @returns Pointer to the symbol. Must be freed using DBGFR3SymbolFree().
|
---|
1086 | * @returns NULL if the symbol was not found or if we're out of memory.
|
---|
1087 | * @param pVM VM handle.
|
---|
1088 | * @param Address Address.
|
---|
1089 | * @param poffDisplacement Where to store the symbol displacement from Address.
|
---|
1090 | */
|
---|
1091 | DBGFR3DECL(PDBGFSYMBOL) DBGFR3SymbolByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement);
|
---|
1092 |
|
---|
1093 | /**
|
---|
1094 | * Find symbol by name (first), allocate return buffer.
|
---|
1095 | *
|
---|
1096 | * @returns Pointer to the symbol. Must be freed using DBGFR3SymbolFree().
|
---|
1097 | * @returns NULL if the symbol was not found or if we're out of memory.
|
---|
1098 | * @param pVM VM handle.
|
---|
1099 | * @param pszSymbol Symbol name.
|
---|
1100 | * @param ppSymbol Where to store the pointer to the symbol info.
|
---|
1101 | */
|
---|
1102 | DBGFR3DECL(PDBGFSYMBOL) DBGFR3SymbolByNameAlloc(PVM pVM, const char *pszSymbol);
|
---|
1103 |
|
---|
1104 | /**
|
---|
1105 | * Frees a symbol returned by DBGFR3SymbolbyNameAlloc() or DBGFR3SymbolByAddressAlloc().
|
---|
1106 | *
|
---|
1107 | * @param pSymbol Pointer to the symbol.
|
---|
1108 | */
|
---|
1109 | DBGFR3DECL(void) DBGFR3SymbolFree(PDBGFSYMBOL pSymbol);
|
---|
1110 |
|
---|
1111 | /**
|
---|
1112 | * Find line by address (nearest).
|
---|
1113 | *
|
---|
1114 | * @returns VBox status.
|
---|
1115 | * @param pVM VM handle.
|
---|
1116 | * @param Address Address.
|
---|
1117 | * @param poffDisplacement Where to store the line displacement from Address.
|
---|
1118 | * @param pLine Where to store the line info.
|
---|
1119 | */
|
---|
1120 | DBGFR3DECL(int) DBGFR3LineByAddr(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFLINE pLine);
|
---|
1121 |
|
---|
1122 | /**
|
---|
1123 | * Find line by address (nearest), allocate return buffer.
|
---|
1124 | *
|
---|
1125 | * @returns Pointer to the line. Must be freed using DBGFR3LineFree().
|
---|
1126 | * @returns NULL if the line was not found or if we're out of memory.
|
---|
1127 | * @param pVM VM handle.
|
---|
1128 | * @param Address Address.
|
---|
1129 | * @param poffDisplacement Where to store the line displacement from Address.
|
---|
1130 | */
|
---|
1131 | DBGFR3DECL(PDBGFLINE) DBGFR3LineByAddrAlloc(PVM pVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement);
|
---|
1132 |
|
---|
1133 | /**
|
---|
1134 | * Frees a line returned by DBGFR3LineByAddressAlloc().
|
---|
1135 | *
|
---|
1136 | * @param pLine Pointer to the line.
|
---|
1137 | */
|
---|
1138 | DBGFR3DECL(void) DBGFR3LineFree(PDBGFLINE pLine);
|
---|
1139 |
|
---|
1140 | /**
|
---|
1141 | * Return type.
|
---|
1142 | */
|
---|
1143 | typedef enum DBGFRETRUNTYPE
|
---|
1144 | {
|
---|
1145 | /** The usual invalid 0 value. */
|
---|
1146 | DBGFRETURNTYPE_INVALID = 0,
|
---|
1147 | /** Near 16-bit return. */
|
---|
1148 | DBGFRETURNTYPE_NEAR16,
|
---|
1149 | /** Near 32-bit return. */
|
---|
1150 | DBGFRETURNTYPE_NEAR32,
|
---|
1151 | /** Near 64-bit return. */
|
---|
1152 | DBGFRETURNTYPE_NEAR64,
|
---|
1153 | /** Far 16:16 return. */
|
---|
1154 | DBGFRETURNTYPE_FAR16,
|
---|
1155 | /** Far 16:32 return. */
|
---|
1156 | DBGFRETURNTYPE_FAR32,
|
---|
1157 | /** Far 16:64 return. */
|
---|
1158 | DBGFRETURNTYPE_FAR64,
|
---|
1159 | /** 16-bit iret return (e.g. real or 286 protect mode). */
|
---|
1160 | DBGFRETURNTYPE_IRET16,
|
---|
1161 | /** 32-bit iret return. */
|
---|
1162 | DBGFRETURNTYPE_IRET32,
|
---|
1163 | /** 32-bit iret return. */
|
---|
1164 | DBGFRETURNTYPE_IRET32_PRIV,
|
---|
1165 | /** 32-bit iret return to V86 mode. */
|
---|
1166 | DBGFRETURNTYPE_IRET32_V86,
|
---|
1167 | /** @todo 64-bit iret return. */
|
---|
1168 | DBGFRETURNTYPE_IRET64,
|
---|
1169 | /** The usual 32-bit blowup. */
|
---|
1170 | DBGFRETURNTYPE_32BIT_HACK = 0x7fffffff
|
---|
1171 | } DBGFRETURNTYPE;
|
---|
1172 |
|
---|
1173 |
|
---|
1174 | /**
|
---|
1175 | * Figures the size of the return state on the stack.
|
---|
1176 | *
|
---|
1177 | * @returns number of bytes. 0 if invalid parameter.
|
---|
1178 | * @param enmRetType The type of return.
|
---|
1179 | */
|
---|
1180 | DECLINLINE(unsigned) DBGFReturnTypeSize(DBGFRETURNTYPE enmRetType)
|
---|
1181 | {
|
---|
1182 | switch (enmRetType)
|
---|
1183 | {
|
---|
1184 | case DBGFRETURNTYPE_NEAR16: return 2;
|
---|
1185 | case DBGFRETURNTYPE_NEAR32: return 4;
|
---|
1186 | case DBGFRETURNTYPE_NEAR64: return 8;
|
---|
1187 | case DBGFRETURNTYPE_FAR16: return 4;
|
---|
1188 | case DBGFRETURNTYPE_FAR32: return 4;
|
---|
1189 | case DBGFRETURNTYPE_FAR64: return 8;
|
---|
1190 | case DBGFRETURNTYPE_IRET16: return 6;
|
---|
1191 | case DBGFRETURNTYPE_IRET32: return 4*3;
|
---|
1192 | case DBGFRETURNTYPE_IRET32_PRIV: return 4*5;
|
---|
1193 | case DBGFRETURNTYPE_IRET32_V86: return 4*9;
|
---|
1194 | case DBGFRETURNTYPE_IRET64:
|
---|
1195 | default:
|
---|
1196 | return 0;
|
---|
1197 | }
|
---|
1198 | }
|
---|
1199 |
|
---|
1200 |
|
---|
1201 | /** Pointer to stack frame info. */
|
---|
1202 | typedef struct DBGFSTACKFRAME *PDBGFSTACKFRAME;
|
---|
1203 | /**
|
---|
1204 | * Info about a stack frame.
|
---|
1205 | */
|
---|
1206 | typedef struct DBGFSTACKFRAME
|
---|
1207 | {
|
---|
1208 | /** Frame number. */
|
---|
1209 | RTUINT iFrame;
|
---|
1210 | /** Frame flags. */
|
---|
1211 | RTUINT fFlags;
|
---|
1212 | /** The frame address.
|
---|
1213 | * The off member is [e|r]bp and the Sel member is ss. */
|
---|
1214 | DBGFADDRESS AddrFrame;
|
---|
1215 | /** The stack address of the frame.
|
---|
1216 | * The off member is [e|r]sp and the Sel member is ss. */
|
---|
1217 | DBGFADDRESS AddrStack;
|
---|
1218 | /** The program counter (PC) address of the frame.
|
---|
1219 | * The off member is [e|r]ip and the Sel member is cs. */
|
---|
1220 | DBGFADDRESS AddrPC;
|
---|
1221 | /** Pointer to the symbol nearest the program counter (PC). NULL if not found. */
|
---|
1222 | PDBGFSYMBOL pSymPC;
|
---|
1223 | /** Pointer to the linnumber nearest the program counter (PC). NULL if not found. */
|
---|
1224 | PDBGFLINE pLinePC;
|
---|
1225 |
|
---|
1226 | /** The return frame address.
|
---|
1227 | * The off member is [e|r]bp and the Sel member is ss. */
|
---|
1228 | DBGFADDRESS AddrReturnFrame;
|
---|
1229 | /** The return stack address.
|
---|
1230 | * The off member is [e|r]sp and the Sel member is ss. */
|
---|
1231 | DBGFADDRESS AddrReturnStack;
|
---|
1232 | /** The way this frame returns to the next one. */
|
---|
1233 | DBGFRETURNTYPE enmReturnType;
|
---|
1234 |
|
---|
1235 | /** The program counter (PC) address which the frame returns to.
|
---|
1236 | * The off member is [e|r]ip and the Sel member is cs. */
|
---|
1237 | DBGFADDRESS AddrReturnPC;
|
---|
1238 | /** Pointer to the symbol nearest the return PC. NULL if not found. */
|
---|
1239 | PDBGFSYMBOL pSymReturnPC;
|
---|
1240 | /** Pointer to the linnumber nearest the return PC. NULL if not found. */
|
---|
1241 | PDBGFLINE pLineReturnPC;
|
---|
1242 |
|
---|
1243 | /** 32-bytes of stack arguments. */
|
---|
1244 | union
|
---|
1245 | {
|
---|
1246 | /** 64-bit view */
|
---|
1247 | uint64_t au64[4];
|
---|
1248 | /** 32-bit view */
|
---|
1249 | uint32_t au32[8];
|
---|
1250 | /** 16-bit view */
|
---|
1251 | uint16_t au16[16];
|
---|
1252 | /** 8-bit view */
|
---|
1253 | uint8_t au8[32];
|
---|
1254 | } Args;
|
---|
1255 |
|
---|
1256 | /** Pointer to the next frame.
|
---|
1257 | * Might not be used in some cases, so consider it internal. */
|
---|
1258 | PDBGFSTACKFRAME pNext;
|
---|
1259 | /** Pointer to the first frame.
|
---|
1260 | * Might not be used in some cases, so consider it internal. */
|
---|
1261 | PDBGFSTACKFRAME pFirst;
|
---|
1262 | } DBGFSTACKFRAME;
|
---|
1263 |
|
---|
1264 | /** @name DBGFSTACKFRAME Flags.
|
---|
1265 | * @{ */
|
---|
1266 | /** Set if the content of the frame is filled in by DBGFR3StackWalk() and can be used
|
---|
1267 | * to construct the next frame. */
|
---|
1268 | #define DBGFSTACKFRAME_FLAGS_ALL_VALID BIT(0)
|
---|
1269 | /** This is the last stack frame we can read.
|
---|
1270 | * This flag is not set if the walk stop because of max dept or recursion. */
|
---|
1271 | #define DBGFSTACKFRAME_FLAGS_LAST BIT(1)
|
---|
1272 | /** This is the last record because we detected a loop. */
|
---|
1273 | #define DBGFSTACKFRAME_FLAGS_LOOP BIT(2)
|
---|
1274 | /** This is the last record because we reached the maximum depth. */
|
---|
1275 | #define DBGFSTACKFRAME_FLAGS_MAX_DEPTH BIT(3)
|
---|
1276 | /** @} */
|
---|
1277 |
|
---|
1278 | /**
|
---|
1279 | * Begins a stack walk.
|
---|
1280 | * This will construct and obtain the first frame.
|
---|
1281 | *
|
---|
1282 | * @returns VINF_SUCCESS on success.
|
---|
1283 | * @returns VERR_NO_MEMORY if we're out of memory.
|
---|
1284 | * @param pVM The VM handle.
|
---|
1285 | * @param pFrame The stack frame info structure.
|
---|
1286 | * On input this structure must be memset to zero.
|
---|
1287 | * If wanted, the AddrPC, AddrStack and AddrFrame fields may be set
|
---|
1288 | * to valid addresses after memsetting it. Any of those fields not set
|
---|
1289 | * will be fetched from the guest CPU state.
|
---|
1290 | * On output the structure will contain all the information we were able to
|
---|
1291 | * obtain about the stack frame.
|
---|
1292 | */
|
---|
1293 | DBGFR3DECL(int) DBGFR3StackWalkBeginGuest(PVM pVM, PDBGFSTACKFRAME pFrame);
|
---|
1294 |
|
---|
1295 | /**
|
---|
1296 | * Begins a stack walk.
|
---|
1297 | * This will construct and obtain the first frame.
|
---|
1298 | *
|
---|
1299 | * @returns VINF_SUCCESS on success.
|
---|
1300 | * @returns VERR_NO_MEMORY if we're out of memory.
|
---|
1301 | * @param pVM The VM handle.
|
---|
1302 | * @param pFrame The stack frame info structure.
|
---|
1303 | * On input this structure must be memset to zero.
|
---|
1304 | * If wanted, the AddrPC, AddrStack and AddrFrame fields may be set
|
---|
1305 | * to valid addresses after memsetting it. Any of those fields not set
|
---|
1306 | * will be fetched from the hypervisor CPU state.
|
---|
1307 | * On output the structure will contain all the information we were able to
|
---|
1308 | * obtain about the stack frame.
|
---|
1309 | */
|
---|
1310 | DBGFR3DECL(int) DBGFR3StackWalkBeginHyper(PVM pVM, PDBGFSTACKFRAME pFrame);
|
---|
1311 |
|
---|
1312 | /**
|
---|
1313 | * Gets the next stack frame.
|
---|
1314 | *
|
---|
1315 | * @returns VINF_SUCCESS
|
---|
1316 | * @returns VERR_NO_MORE_FILES if not more stack frames.
|
---|
1317 | * @param pVM The VM handle.
|
---|
1318 | * @param pFrame Pointer to the current frame on input, content is replaced with the next frame on successful return.
|
---|
1319 | */
|
---|
1320 | DBGFR3DECL(int) DBGFR3StackWalkNext(PVM pVM, PDBGFSTACKFRAME pFrame);
|
---|
1321 |
|
---|
1322 | /**
|
---|
1323 | * Ends a stack walk process.
|
---|
1324 | *
|
---|
1325 | * This *must* be called after a successful first call to any of the stack
|
---|
1326 | * walker functions. If not called we will leak memory or other resources.
|
---|
1327 | *
|
---|
1328 | * @param pVM The VM handle.
|
---|
1329 | * @param pFrame The stackframe as returned by the last stack walk call.
|
---|
1330 | */
|
---|
1331 | DBGFR3DECL(void) DBGFR3StackWalkEnd(PVM pVM, PDBGFSTACKFRAME pFrame);
|
---|
1332 |
|
---|
1333 |
|
---|
1334 |
|
---|
1335 |
|
---|
1336 | /** Flags to pass to DBGFR3DisasInstrEx().
|
---|
1337 | * @{ */
|
---|
1338 | /** Disassemble the current guest instruction, with annotations. */
|
---|
1339 | #define DBGF_DISAS_FLAGS_CURRENT_GUEST BIT(0)
|
---|
1340 | /** Disassemble the current hypervisor instruction, with annotations. */
|
---|
1341 | #define DBGF_DISAS_FLAGS_CURRENT_HYPER BIT(1)
|
---|
1342 | /** No annotations for current context. */
|
---|
1343 | #define DBGF_DISAS_FLAGS_NO_ANNOTATION BIT(2)
|
---|
1344 | /** No symbol lookup. */
|
---|
1345 | #define DBGF_DISAS_FLAGS_NO_SYMBOLS BIT(3)
|
---|
1346 | /** No instruction bytes. */
|
---|
1347 | #define DBGF_DISAS_FLAGS_NO_BYTES BIT(4)
|
---|
1348 | /** No address in the output. */
|
---|
1349 | #define DBGF_DISAS_FLAGS_NO_ADDRESS BIT(5)
|
---|
1350 | /** @} */
|
---|
1351 |
|
---|
1352 | /** Special flat selector. */
|
---|
1353 | #define DBGF_SEL_FLAT 1
|
---|
1354 |
|
---|
1355 | /**
|
---|
1356 | * Disassembles the one instruction according to the specified flags and address.
|
---|
1357 | *
|
---|
1358 | * @returns VBox status code.
|
---|
1359 | * @param pVM VM handle.
|
---|
1360 | * @param Sel The code selector. This used to determin the 32/16 bit ness and
|
---|
1361 | * calculation of the actual instruction address.
|
---|
1362 | * Use DBGF_SEL_FLAT for specifying a flat address.
|
---|
1363 | * @param GCPtr The code address relative to the base of Sel.
|
---|
1364 | * @param fFlags Flags controlling where to start and how to format.
|
---|
1365 | * A combination of the DBGF_DISAS_FLAGS_* #defines.
|
---|
1366 | * @param pszOutput Output buffer.
|
---|
1367 | * @param cchOutput Size of the output buffer.
|
---|
1368 | * @param pcbInstr Where to return the size of the instruction.
|
---|
1369 | */
|
---|
1370 | DBGFR3DECL(int) DBGFR3DisasInstrEx(PVM pVM, RTSEL Sel, RTGCPTR GCPtr, unsigned fFlags, char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr);
|
---|
1371 |
|
---|
1372 | /**
|
---|
1373 | * Disassembles the current instruction.
|
---|
1374 | * Addresses will be tried resolved to symbols
|
---|
1375 | *
|
---|
1376 | * @returns VBox status code.
|
---|
1377 | * @param pVM VM handle.
|
---|
1378 | * @param Sel The code selector. This used to determin the 32/16 bit ness and
|
---|
1379 | * calculation of the actual instruction address.
|
---|
1380 | * Use DBGF_SEL_FLAT for specifying a flat address.
|
---|
1381 | * @param GCPtr The code address relative to the base of Sel.
|
---|
1382 | * @param pszOutput Output buffer.
|
---|
1383 | * @param cbOutput Size of the output buffer.
|
---|
1384 | */
|
---|
1385 | DBGFR3DECL(int) DBGFR3DisasInstr(PVM pVM, RTSEL Sel, RTGCPTR GCPtr, char *pszOutput, uint32_t cbOutput);
|
---|
1386 |
|
---|
1387 | /**
|
---|
1388 | * Disassembles the current instruction.
|
---|
1389 | * All registers and data will be displayed. Addresses will be attempted resolved to symbols
|
---|
1390 | *
|
---|
1391 | * @returns VBox status code.
|
---|
1392 | * @param pVM VM handle.
|
---|
1393 | * @param pszOutput Output buffer.
|
---|
1394 | * @param cbOutput Size of the output buffer.
|
---|
1395 | */
|
---|
1396 | DBGFR3DECL(int) DBGFR3DisasInstrCurrent(PVM pVM, char *pszOutput, uint32_t cbOutput);
|
---|
1397 |
|
---|
1398 | /**
|
---|
1399 | * Disassembles the current guest context instruction and writes it to the log.
|
---|
1400 | * All registers and data will be displayed. Addresses will be attempted resolved to symbols.
|
---|
1401 | *
|
---|
1402 | * @returns VBox status code.
|
---|
1403 | * @param pVM VM handle.
|
---|
1404 | * @param pszPrefix Short prefix string to the dissassembly string. (optional)
|
---|
1405 | */
|
---|
1406 | DBGFR3DECL(int) DBGFR3DisasInstrCurrentLogInternal(PVM pVM, const char *pszPrefix);
|
---|
1407 |
|
---|
1408 | /** @def DBGFR3DisasInstrCurrentLog
|
---|
1409 | * Disassembles the current guest context instruction and writes it to the log.
|
---|
1410 | * All registers and data will be displayed. Addresses will be attempted resolved to symbols.
|
---|
1411 | */
|
---|
1412 | #ifdef LOG_ENABLED
|
---|
1413 | # define DBGFR3DisasInstrCurrentLog(pVM, pszPrefix) \
|
---|
1414 | do { \
|
---|
1415 | if (LogIsEnabled()) \
|
---|
1416 | DBGFR3DisasInstrCurrentLogInternal(pVM, pszPrefix); \
|
---|
1417 | } while (0)
|
---|
1418 | #else
|
---|
1419 | # define DBGFR3DisasInstrCurrentLog(pVM, pszPrefix) do { } while (0)
|
---|
1420 | #endif
|
---|
1421 |
|
---|
1422 | /**
|
---|
1423 | * Disassembles the specified guest context instruction and writes it to the log.
|
---|
1424 | * Addresses will be attempted resolved to symbols.
|
---|
1425 | *
|
---|
1426 | * @returns VBox status code.
|
---|
1427 | * @param pVM VM handle.
|
---|
1428 | * @param Sel The code selector. This used to determin the 32/16 bit-ness and
|
---|
1429 | * calculation of the actual instruction address.
|
---|
1430 | * @param GCPtr The code address relative to the base of Sel.
|
---|
1431 | */
|
---|
1432 | DBGFR3DECL(int) DBGFR3DisasInstrLogInternal(PVM pVM, RTSEL Sel, RTGCPTR GCPtr);
|
---|
1433 |
|
---|
1434 | /** @def DBGFR3DisasInstrLog
|
---|
1435 | * Disassembles the specified guest context instruction and writes it to the log.
|
---|
1436 | * Addresses will be attempted resolved to symbols.
|
---|
1437 | */
|
---|
1438 | #ifdef LOG_ENABLED
|
---|
1439 | # define DBGFR3DisasInstrLog(pVM, Sel, GCPtr) \
|
---|
1440 | do { \
|
---|
1441 | if (LogIsEnabled()) \
|
---|
1442 | DBGFR3DisasInstrLogInternal(pVM, Sel, GCPtr); \
|
---|
1443 | } while (0)
|
---|
1444 | #else
|
---|
1445 | # define DBGFR3DisasInstrLog(pVM, Sel, GCPtr) do { } while (0)
|
---|
1446 | #endif
|
---|
1447 |
|
---|
1448 | /** @} */
|
---|
1449 |
|
---|
1450 | __END_DECLS
|
---|
1451 |
|
---|
1452 | #endif
|
---|