DBGFInternal.h revision 8c97c335e49609421316d92d2e0aff3e7f8eed04
af062818b47340eef15700d2f0211576ba3506eevboxsync * DBGF - Internal header file.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright (C) 2006-2007 Oracle Corporation
af062818b47340eef15700d2f0211576ba3506eevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
af062818b47340eef15700d2f0211576ba3506eevboxsync * available from http://www.virtualbox.org. This file is free software;
af062818b47340eef15700d2f0211576ba3506eevboxsync * you can redistribute it and/or modify it under the terms of the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * General Public License (GPL) as published by the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
af062818b47340eef15700d2f0211576ba3506eevboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
af062818b47340eef15700d2f0211576ba3506eevboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
af062818b47340eef15700d2f0211576ba3506eevboxsync/** @defgroup grp_dbgf_int Internals
af062818b47340eef15700d2f0211576ba3506eevboxsync * @ingroup grp_dbgf
af062818b47340eef15700d2f0211576ba3506eevboxsync * @internal
af062818b47340eef15700d2f0211576ba3506eevboxsync/** VMM Debugger Command. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** No command.
af062818b47340eef15700d2f0211576ba3506eevboxsync * This is assigned to the field by the emulation thread after
af062818b47340eef15700d2f0211576ba3506eevboxsync * a command has been completed. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Halt the VM. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Resume execution. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Single step execution - stepping into calls. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Set a breakpoint. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Set a access breakpoint. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Set a REM breakpoint. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Clear a breakpoint. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Enable a breakpoint. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Disable a breakpoint. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** List breakpoints. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Detaches the debugger.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Disabling all breakpoints, watch points and the like. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Detached the debugger.
af062818b47340eef15700d2f0211576ba3506eevboxsync * The isn't a command as such, it's just that it's necessary for the
af062818b47340eef15700d2f0211576ba3506eevboxsync * detaching protocol to be racefree. */
af062818b47340eef15700d2f0211576ba3506eevboxsync * VMM Debugger Command.
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Pointer to DBGF Command Data. */
af062818b47340eef15700d2f0211576ba3506eevboxsync * Info type.
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Invalid. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Device owner. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Driver owner. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Internal owner. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** External owner. */
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Pointer to info structure. */
af062818b47340eef15700d2f0211576ba3506eevboxsync * Info structure.
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef struct DBGFINFO
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The flags. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Owner type. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Per type data. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** DBGFINFOTYPE_DEV */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Device info handler function. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The device instance. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** DBGFINFOTYPE_DRV */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Driver info handler function. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The driver instance. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** DBGFINFOTYPE_INT */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Internal info handler function. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** DBGFINFOTYPE_EXT */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** External info handler function. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The user argument. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Pointer to the description. */
af062818b47340eef15700d2f0211576ba3506eevboxsync const char *pszDesc;
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Pointer to the next info structure. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The identifier name length. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The identifier name. (Extends 'beyond' the struct as usual.) */
af062818b47340eef15700d2f0211576ba3506eevboxsync * Guest OS digger instance.
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef struct DBGFOS
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Pointer to the registration record. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Pointer to the next OS we've registered. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The instance data (variable size). */
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Pointer to guest OS digger instance. */
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Pointer to const guest OS digger instance. */
af062818b47340eef15700d2f0211576ba3506eevboxsync * Converts a DBGF pointer into a VM pointer.
af062818b47340eef15700d2f0211576ba3506eevboxsync * @returns Pointer to the VM structure the CPUM is part of.
af062818b47340eef15700d2f0211576ba3506eevboxsync * @param pDBGF Pointer to DBGF instance data.
af062818b47340eef15700d2f0211576ba3506eevboxsync#define DBGF2VM(pDBGF) ( (PVM)((char*)pDBGF - pDBGF->offVM) )
af062818b47340eef15700d2f0211576ba3506eevboxsync * DBGF Data (part of VM)
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef struct DBGF
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Offset to the VM structure. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Debugger Attached flag.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Set if a debugger is attached, elsewise it's clear.
af062818b47340eef15700d2f0211576ba3506eevboxsync bool volatile fAttached;
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Stopped in the Hypervisor.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Set if we're stopped on a trace, breakpoint or assertion inside
af062818b47340eef15700d2f0211576ba3506eevboxsync * the hypervisor and have to restrict the available operations.
af062818b47340eef15700d2f0211576ba3506eevboxsync bool volatile fStoppedInHyper;
af062818b47340eef15700d2f0211576ba3506eevboxsync * Ping-Pong construct where the Ping side is the VMM and the Pong side
af062818b47340eef15700d2f0211576ba3506eevboxsync * the Debugger.
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The Event to the debugger.
af062818b47340eef15700d2f0211576ba3506eevboxsync * The VMM will ping the debugger when the event is ready. The event is
af062818b47340eef15700d2f0211576ba3506eevboxsync * either a response to a command or to a break/watch point issued
af062818b47340eef15700d2f0211576ba3506eevboxsync * previously.
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The Command to the VMM.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Operated in an atomic fashion since the VMM will poll on this.
af062818b47340eef15700d2f0211576ba3506eevboxsync * This means that a the command data must be written before this member
af062818b47340eef15700d2f0211576ba3506eevboxsync * is set. The VMM will reset this member to the no-command state
af062818b47340eef15700d2f0211576ba3506eevboxsync * when it have processed it.
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The Command data.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Not all commands take data. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** List of registered info handlers. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Critical section protecting the above list. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Range tree containing the loaded symbols of the a VM.
af062818b47340eef15700d2f0211576ba3506eevboxsync * This tree will never have blind spots. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Symbol name space. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Indicates whether DBGFSym.cpp is initialized or not.
af062818b47340eef15700d2f0211576ba3506eevboxsync * This part is initialized in a lazy manner for performance reasons. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Alignment padding. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The number of hardware breakpoints. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The number of active breakpoints. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Array of hardware breakpoints. (0..3)
af062818b47340eef15700d2f0211576ba3506eevboxsync * This is shared among all the CPUs because life is much simpler that way. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Array of int 3 and REM breakpoints. (4..)
af062818b47340eef15700d2f0211576ba3506eevboxsync * @remark This is currently a fixed size array for reasons of simplicity. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The address space database lock. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The address space handle database. (Protected by hAsDbLock.) */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The address space process id database. (Protected by hAsDbLock.) */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The address space name database. (Protected by hAsDbLock.) */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Special address space aliases. (Protected by hAsDbLock.) */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** For lazily populating the aliased address spaces. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Alignment padding. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The register database lock. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** String space for looking up registers. (Protected by hRegDbLock.) */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** String space holding the register sets. (Protected by hRegDbLock.) */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The number of registers (aliases, sub-fields and the special CPU
af062818b47340eef15700d2f0211576ba3506eevboxsync * register aliases (eg AH) are not counted). */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** For early initialization by . */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Alignment padding. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The current Guest OS digger. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The head of the Guest OS digger instances. */
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Pointer to DBGF Data. */
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Converts a DBGFCPU pointer into a VM pointer. */
af062818b47340eef15700d2f0211576ba3506eevboxsync#define DBGFCPU_2_VM(pDbgfCpu) ((PVM)((uint8_t *)(pDbgfCpu) + (pDbgfCpu)->offVM))
af062818b47340eef15700d2f0211576ba3506eevboxsync * The per CPU data for DBGF.
af062818b47340eef15700d2f0211576ba3506eevboxsynctypedef struct DBGFCPU
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The offset into the VM structure.
af062818b47340eef15700d2f0211576ba3506eevboxsync * @see DBGFCPU_2_VM(). */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Current active breakpoint (id).
af062818b47340eef15700d2f0211576ba3506eevboxsync * This is ~0U if not active. It is set when a execution engine
af062818b47340eef15700d2f0211576ba3506eevboxsync * encounters a breakpoint and returns VINF_EM_DBG_BREAKPOINT. This is
af062818b47340eef15700d2f0211576ba3506eevboxsync * currently not used for REM breakpoints because of the lazy coupling
af062818b47340eef15700d2f0211576ba3506eevboxsync * between VBox and REM. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Set if we're singlestepping in raw mode.
af062818b47340eef15700d2f0211576ba3506eevboxsync * This is checked and cleared in the \#DB handler. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** Padding the structure to 16 bytes. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The guest register set for this CPU. Can be NULL. */
af062818b47340eef15700d2f0211576ba3506eevboxsync /** The hypervisor register set for this CPU. Can be NULL. */
af062818b47340eef15700d2f0211576ba3506eevboxsync/** Pointer to DBGFCPU data. */