VirtualBox

Changeset 12663 in vbox for trunk/src


Ignore:
Timestamp:
Sep 23, 2008 10:16:45 AM (16 years ago)
Author:
vboxsync
Message:

#1865: DBGF, nothing really relevant here just some cleaning up.

Location:
trunk/src/VBox/VMM
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/DBGF.cpp

    r11820 r12663  
    2121
    2222
    23 /** @page   pg_dbgf     DBGC - The Debugger Facility
    24  *
    25  * The purpose of the DBGC is to provide an interface for debuggers to manipulate
    26  * the VMM without having to mess up the source code for each of them. The DBGF
    27  * is always built in and will always work when a debugger attaches to the VM.
    28  * The DBGF provides the basic debugger features, such as halting execution,
    29  * handling breakpoints and single step execution.
     23/** @page   pg_dbgf     DBGF - The Debugger Facility
     24 *
     25 * The purpose of the DBGF is to provide an interface for debuggers to
     26 * manipulate the VMM without having to mess up the source code for each of
     27 * them. The DBGF is always built in and will always work when a debugger
     28 * attaches to the VM. The DBGF provides the basic debugger features, such as
     29 * halting execution, handling breakpoints, single step execution, instruction
     30 * disassembly, info querying, OS specific diggers, symbol and module
     31 * management.
    3032 *
    3133 * The interface is working in a manner similar to the win32, linux and os2
    3234 * debugger interfaces. It interface has an asynchronous nature. This comes from
    33  * the fact that the VMM and the Debugger are running in different threads.
    34  * They are refered to as the "emulation thread" and the "debugger thread",
    35  * or as the "ping thread" and the "pong thread, respectivly. (The last set
    36  * of names comes from the use of the Ping-Pong synchronization construct from
    37  * the RTSem API.)
    38  *
    39  *
    40  *
    41  * @section sec_dbgf_scenario   Debugger Scenario
     35 * the fact that the VMM and the Debugger are running in different threads. They
     36 * are refered to as the "emulation thread" and the "debugger thread", or as the
     37 * "ping thread" and the "pong thread, respectivly. (The last set of names comes
     38 * from the use of the Ping-Pong synchronization construct from the RTSem API.)
     39 *
     40 *
     41 *
     42 * @section sec_dbgf_scenario   Usage Scenario
    4243 *
    4344 * The debugger starts by attaching to the VM. For pratical reasons we limit the
    44  * number of concurrently attached debuggers to 1 per VM. The action of attaching
    45  * to the VM causes the VM to check and generate debug events.
     45 * number of concurrently attached debuggers to 1 per VM. The action of
     46 * attaching to the VM causes the VM to check and generate debug events.
    4647 *
    4748 * The debugger then will wait/poll for debug events and issue commands.
     
    5354 * An event can be a respons to an command issued previously, the hitting of a
    5455 * breakpoint, or running into a bad/fatal VMM condition. The debugger now have
    55  * the ping and must respond to the event at hand - the VMM is waiting.  This
     56 * the ping and must respond to the event at hand - the VMM is waiting. This
    5657 * usually means that the user of the debugger must do something, but it doesn't
    5758 * have to. The debugger is free to call any DBGF function (nearly at least)
     
    6263 *
    6364 * When the user eventually terminates the debugging session or selects another
    64  * VM, the debugger detaches from the VM. This means that breakpoints are disabled
    65  * and that the emulation thread no longer polls for debugger commands.
    66  *
    67  */
    68 
     65 * VM, the debugger detaches from the VM. This means that breakpoints are
     66 * disabled and that the emulation thread no longer polls for debugger commands.
     67 *
     68 */
    6969
    7070
     
    9393*   Internal Functions                                                         *
    9494*******************************************************************************/
    95 static int dbgfr3VMMWait(PVM pVM);
    96 static int dbgfr3VMMCmd(PVM pVM, DBGFCMD enmCmd, PDBGFCMDDATA pCmdData, bool *pfResumeExecution);
     95static int dbgfR3VMMWait(PVM pVM);
     96static int dbgfR3VMMCmd(PVM pVM, DBGFCMD enmCmd, PDBGFCMDDATA pCmdData, bool *pfResumeExecution);
    9797
    9898
     
    104104 * @param   enmCmd  The command.
    105105 */
    106 DECLINLINE(DBGFCMD) dbgfr3SetCmd(PVM pVM, DBGFCMD enmCmd)
     106DECLINLINE(DBGFCMD) dbgfR3SetCmd(PVM pVM, DBGFCMD enmCmd)
    107107{
    108108    DBGFCMD rc;
     
    189189                 */
    190190                DBGFCMDDATA     CmdData = pVM->dbgf.s.VMMCmdData;
    191                 DBGFCMD         enmCmd = dbgfr3SetCmd(pVM, DBGFCMD_NO_COMMAND);
     191                DBGFCMD         enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_NO_COMMAND);
    192192                if (enmCmd != DBGFCMD_NO_COMMAND)
    193193                {
    194194                    bool fResumeExecution = false;
    195                     rc = dbgfr3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);
     195                    rc = dbgfR3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);
    196196                    if (enmCmd == DBGFCMD_DETACH_DEBUGGER)
    197197                        break;
     
    304304        bool            fResumeExecution;
    305305        DBGFCMDDATA     CmdData = pVM->dbgf.s.VMMCmdData;
    306         DBGFCMD         enmCmd = dbgfr3SetCmd(pVM, DBGFCMD_NO_COMMAND);
    307         rc = dbgfr3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);
     306        DBGFCMD         enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_NO_COMMAND);
     307        rc = dbgfR3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);
    308308        if (!fResumeExecution)
    309             rc = dbgfr3VMMWait(pVM);
     309            rc = dbgfR3VMMWait(pVM);
    310310    }
    311311    return rc;
     
    410410    int rc = RTSemPing(&pVM->dbgf.s.PingPong);
    411411    if (VBOX_SUCCESS(rc))
    412         rc = dbgfr3VMMWait(pVM);
     412        rc = dbgfR3VMMWait(pVM);
    413413
    414414    pVM->dbgf.s.fStoppedInHyper = false;
     
    582582 * @param   pVM     VM handle.
    583583 */
    584 static int dbgfr3VMMWait(PVM pVM)
    585 {
    586     LogFlow(("dbgfr3VMMWait:\n"));
     584static int dbgfR3VMMWait(PVM pVM)
     585{
     586    LogFlow(("dbgfR3VMMWait:\n"));
    587587
    588588    /** @todo stupid GDT/LDT sync hack. go away! */
     
    605605            if (rc != VERR_TIMEOUT)
    606606            {
    607                 LogFlow(("dbgfr3VMMWait: returns %Vrc\n", rc));
     607                LogFlow(("dbgfR3VMMWait: returns %Vrc\n", rc));
    608608                return rc;
    609609            }
     
    611611            if (VM_FF_ISSET(pVM, VM_FF_REQUEST))
    612612            {
    613                 LogFlow(("dbgfr3VMMWait: Processes requests...\n"));
     613                LogFlow(("dbgfR3VMMWait: Processes requests...\n"));
    614614                rc = VMR3ReqProcessU(pVM->pUVM);
    615                 LogFlow(("dbgfr3VMMWait: VMR3ReqProcess -> %Vrc rcRet=%Vrc\n", rc, rcRet));
     615                LogFlow(("dbgfR3VMMWait: VMR3ReqProcess -> %Vrc rcRet=%Vrc\n", rc, rcRet));
    616616                if (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST)
    617617                {
     
    628628                        case VINF_EM_TERMINATE:
    629629                        case VINF_EM_OFF:
    630                             LogFlow(("dbgfr3VMMWait: returns %Vrc\n", rc));
     630                            LogFlow(("dbgfR3VMMWait: returns %Vrc\n", rc));
    631631                            return rc;
    632632
     
    648648                else if (VBOX_FAILURE(rc))
    649649                {
    650                     LogFlow(("dbgfr3VMMWait: returns %Vrc\n", rc));
     650                    LogFlow(("dbgfR3VMMWait: returns %Vrc\n", rc));
    651651                    return rc;
    652652                }
     
    659659        bool            fResumeExecution;
    660660        DBGFCMDDATA     CmdData = pVM->dbgf.s.VMMCmdData;
    661         DBGFCMD         enmCmd = dbgfr3SetCmd(pVM, DBGFCMD_NO_COMMAND);
    662         int rc = dbgfr3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);
     661        DBGFCMD         enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_NO_COMMAND);
     662        int rc = dbgfR3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);
    663663        if (fResumeExecution)
    664664        {
     
    669669                     &&  (rc < rcRet || rcRet == VINF_SUCCESS))
    670670                rcRet = rc;
    671             LogFlow(("dbgfr3VMMWait: returns %Vrc\n", rcRet));
     671            LogFlow(("dbgfR3VMMWait: returns %Vrc\n", rcRet));
    672672            return rcRet;
    673673        }
     
    687687 * @param   pfResumeExecution   Where to store the resume execution / continue waiting indicator.
    688688 */
    689 static int dbgfr3VMMCmd(PVM pVM, DBGFCMD enmCmd, PDBGFCMDDATA pCmdData, bool *pfResumeExecution)
     689static int dbgfR3VMMCmd(PVM pVM, DBGFCMD enmCmd, PDBGFCMDDATA pCmdData, bool *pfResumeExecution)
    690690{
    691691    bool    fSendEvent;
     
    847847    if (pVM->dbgf.s.PingPong.enmSpeaker == RTPINGPONGSPEAKER_PONG)
    848848    {
    849         enmCmd = dbgfr3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);
     849        enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);
    850850        int rc = RTSemPong(&pVM->dbgf.s.PingPong);
    851851        if (VBOX_FAILURE(rc))
     
    858858    else
    859859    {
    860         enmCmd = dbgfr3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);
     860        enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);
    861861        LogFunc(("enmCmd=%d (ping)\n", enmCmd));
    862862    }
     
    948948     * Send command.
    949949     */
    950     dbgfr3SetCmd(pVM, DBGFCMD_HALT);
     950    dbgfR3SetCmd(pVM, DBGFCMD_HALT);
    951951
    952952    return VINF_SUCCESS;
     
    10201020     * Send the ping back to the emulation thread telling it to run.
    10211021     */
    1022     dbgfr3SetCmd(pVM, DBGFCMD_GO);
     1022    dbgfR3SetCmd(pVM, DBGFCMD_GO);
    10231023    int rc = RTSemPong(&pVM->dbgf.s.PingPong);
    10241024    AssertRC(rc);
     
    10561056     * Send the ping back to the emulation thread telling it to run.
    10571057     */
    1058     dbgfr3SetCmd(pVM, DBGFCMD_SINGLE_STEP);
     1058    dbgfR3SetCmd(pVM, DBGFCMD_SINGLE_STEP);
    10591059    int rc = RTSemPong(&pVM->dbgf.s.PingPong);
    10601060    AssertRC(rc);
  • trunk/src/VBox/VMM/DBGFAddr.cpp

    r8819 r12663  
    158158    return true;
    159159}
     160
  • trunk/src/VBox/VMM/DBGFBp.cpp

    r11311 r12663  
    5656
    5757
     58
    5859/**
    5960 * Initialize the breakpoint stuff.
  • trunk/src/VBox/VMM/DBGFDisas.cpp

    r9846 r12663  
    4242
    4343/*******************************************************************************
    44 *   Internal Functions                                                         *
     44*   Structures and Typedefs                                                    *
    4545*******************************************************************************/
    46 static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata);
    47 
    48 
    4946/**
    5047 * Structure used when disassembling and instructions in DBGF.
     
    8077
    8178
     79/*******************************************************************************
     80*   Internal Functions                                                         *
     81*******************************************************************************/
     82static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata);
     83
     84
    8285
    8386/**
  • trunk/src/VBox/VMM/DBGFInfo.cpp

    r8155 r12663  
    390390
    391391
    392 
    393392/**
    394393 * Register a info handler owned by an external component.
     
    631630}
    632631
     632
    633633/**
    634634 * Deregister a info handler owned by an internal component.
  • trunk/src/VBox/VMM/DBGFInternal.h

    r8802 r12663  
    8484{
    8585    uint32_t    uDummy;
    86 
    8786} DBGFCMDDATA;
    8887/** Pointer to DBGF Command Data. */
     
    205204     * Set if a debugger is attached, elsewise it's clear.
    206205     */
    207     volatile bool           fAttached;
     206    bool volatile           fAttached;
    208207
    209208    /** Stopped in the Hypervisor.
     
    211210     * the hypervisor and have to restrict the available operations.
    212211     */
    213     volatile bool           fStoppedInHyper;
     212    bool volatile           fStoppedInHyper;
    214213
    215214    /**
     
    232231     * when it have processed it.
    233232     */
    234     volatile DBGFCMD        enmVMMCmd;
     233    DBGFCMD volatile        enmVMMCmd;
    235234    /** The Command data.
    236235     * Not all commands take data. */
  • trunk/src/VBox/VMM/DBGFLog.cpp

    r8155 r12663  
    1919 * additional information or have any questions.
    2020 */
    21 
    2221
    2322
  • trunk/src/VBox/VMM/DBGFStack.cpp

    r8155 r12663  
    6464
    6565
    66 
    67 
    6866/**
    6967 * Internal worker routine.
     
    7674 *      4  return address
    7775 *      0  old ebp; current ebp points here
     76 *
     77 * @todo Add AMD64 support (needs teaming up with the module management for
     78 *       unwind tables).
    7879 */
    7980static int dbgfR3StackWalk(PVM pVM, PDBGFSTACKFRAME pFrame)
  • trunk/src/VBox/VMM/DBGFSym.cpp

    r9182 r12663  
    4949#include <stdio.h> /* for fopen(). */ /** @todo use iprt/stream.h! */
    5050#include <stdlib.h>
    51 
    5251
    5352
  • trunk/src/VBox/VMM/VMMGC/DBGFGC.cpp

    r9212 r12663  
    22/** @file
    33 * DBGF - Debugger Facility, GC part.
     4 *
     5 * Almost identical to DBGFR0.cpp, except for the fInHyper stuff.
    46 */
    57
  • trunk/src/VBox/VMM/VMMR0/DBGFR0.cpp

    r11311 r12663  
    22/** @file
    33 * DBGF - Debugger Facility, R0 part.
     4 *
     5 * Almost identical to DBGFGC.cpp, except for the fInHyper stuff.
    46 */
    57
Note: See TracChangeset for help on using the changeset viewer.

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