- Timestamp:
- Sep 23, 2008 10:16:45 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/DBGF.cpp
r11820 r12663 21 21 22 22 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. 30 32 * 31 33 * The interface is working in a manner similar to the win32, linux and os2 32 34 * 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 42 43 * 43 44 * 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 attaching45 * 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. 46 47 * 47 48 * The debugger then will wait/poll for debug events and issue commands. … … 53 54 * An event can be a respons to an command issued previously, the hitting of a 54 55 * 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. 56 * the ping and must respond to the event at hand - the VMM is waiting. This 56 57 * usually means that the user of the debugger must do something, but it doesn't 57 58 * have to. The debugger is free to call any DBGF function (nearly at least) … … 62 63 * 63 64 * 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 */ 69 69 70 70 … … 93 93 * Internal Functions * 94 94 *******************************************************************************/ 95 static int dbgf r3VMMWait(PVM pVM);96 static int dbgf r3VMMCmd(PVM pVM, DBGFCMD enmCmd, PDBGFCMDDATA pCmdData, bool *pfResumeExecution);95 static int dbgfR3VMMWait(PVM pVM); 96 static int dbgfR3VMMCmd(PVM pVM, DBGFCMD enmCmd, PDBGFCMDDATA pCmdData, bool *pfResumeExecution); 97 97 98 98 … … 104 104 * @param enmCmd The command. 105 105 */ 106 DECLINLINE(DBGFCMD) dbgf r3SetCmd(PVM pVM, DBGFCMD enmCmd)106 DECLINLINE(DBGFCMD) dbgfR3SetCmd(PVM pVM, DBGFCMD enmCmd) 107 107 { 108 108 DBGFCMD rc; … … 189 189 */ 190 190 DBGFCMDDATA CmdData = pVM->dbgf.s.VMMCmdData; 191 DBGFCMD enmCmd = dbgf r3SetCmd(pVM, DBGFCMD_NO_COMMAND);191 DBGFCMD enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_NO_COMMAND); 192 192 if (enmCmd != DBGFCMD_NO_COMMAND) 193 193 { 194 194 bool fResumeExecution = false; 195 rc = dbgf r3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);195 rc = dbgfR3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution); 196 196 if (enmCmd == DBGFCMD_DETACH_DEBUGGER) 197 197 break; … … 304 304 bool fResumeExecution; 305 305 DBGFCMDDATA CmdData = pVM->dbgf.s.VMMCmdData; 306 DBGFCMD enmCmd = dbgf r3SetCmd(pVM, DBGFCMD_NO_COMMAND);307 rc = dbgf r3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);306 DBGFCMD enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_NO_COMMAND); 307 rc = dbgfR3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution); 308 308 if (!fResumeExecution) 309 rc = dbgf r3VMMWait(pVM);309 rc = dbgfR3VMMWait(pVM); 310 310 } 311 311 return rc; … … 410 410 int rc = RTSemPing(&pVM->dbgf.s.PingPong); 411 411 if (VBOX_SUCCESS(rc)) 412 rc = dbgf r3VMMWait(pVM);412 rc = dbgfR3VMMWait(pVM); 413 413 414 414 pVM->dbgf.s.fStoppedInHyper = false; … … 582 582 * @param pVM VM handle. 583 583 */ 584 static int dbgf r3VMMWait(PVM pVM)585 { 586 LogFlow(("dbgf r3VMMWait:\n"));584 static int dbgfR3VMMWait(PVM pVM) 585 { 586 LogFlow(("dbgfR3VMMWait:\n")); 587 587 588 588 /** @todo stupid GDT/LDT sync hack. go away! */ … … 605 605 if (rc != VERR_TIMEOUT) 606 606 { 607 LogFlow(("dbgf r3VMMWait: returns %Vrc\n", rc));607 LogFlow(("dbgfR3VMMWait: returns %Vrc\n", rc)); 608 608 return rc; 609 609 } … … 611 611 if (VM_FF_ISSET(pVM, VM_FF_REQUEST)) 612 612 { 613 LogFlow(("dbgf r3VMMWait: Processes requests...\n"));613 LogFlow(("dbgfR3VMMWait: Processes requests...\n")); 614 614 rc = VMR3ReqProcessU(pVM->pUVM); 615 LogFlow(("dbgf r3VMMWait: VMR3ReqProcess -> %Vrc rcRet=%Vrc\n", rc, rcRet));615 LogFlow(("dbgfR3VMMWait: VMR3ReqProcess -> %Vrc rcRet=%Vrc\n", rc, rcRet)); 616 616 if (rc >= VINF_EM_FIRST && rc <= VINF_EM_LAST) 617 617 { … … 628 628 case VINF_EM_TERMINATE: 629 629 case VINF_EM_OFF: 630 LogFlow(("dbgf r3VMMWait: returns %Vrc\n", rc));630 LogFlow(("dbgfR3VMMWait: returns %Vrc\n", rc)); 631 631 return rc; 632 632 … … 648 648 else if (VBOX_FAILURE(rc)) 649 649 { 650 LogFlow(("dbgf r3VMMWait: returns %Vrc\n", rc));650 LogFlow(("dbgfR3VMMWait: returns %Vrc\n", rc)); 651 651 return rc; 652 652 } … … 659 659 bool fResumeExecution; 660 660 DBGFCMDDATA CmdData = pVM->dbgf.s.VMMCmdData; 661 DBGFCMD enmCmd = dbgf r3SetCmd(pVM, DBGFCMD_NO_COMMAND);662 int rc = dbgf r3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution);661 DBGFCMD enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_NO_COMMAND); 662 int rc = dbgfR3VMMCmd(pVM, enmCmd, &CmdData, &fResumeExecution); 663 663 if (fResumeExecution) 664 664 { … … 669 669 && (rc < rcRet || rcRet == VINF_SUCCESS)) 670 670 rcRet = rc; 671 LogFlow(("dbgf r3VMMWait: returns %Vrc\n", rcRet));671 LogFlow(("dbgfR3VMMWait: returns %Vrc\n", rcRet)); 672 672 return rcRet; 673 673 } … … 687 687 * @param pfResumeExecution Where to store the resume execution / continue waiting indicator. 688 688 */ 689 static int dbgf r3VMMCmd(PVM pVM, DBGFCMD enmCmd, PDBGFCMDDATA pCmdData, bool *pfResumeExecution)689 static int dbgfR3VMMCmd(PVM pVM, DBGFCMD enmCmd, PDBGFCMDDATA pCmdData, bool *pfResumeExecution) 690 690 { 691 691 bool fSendEvent; … … 847 847 if (pVM->dbgf.s.PingPong.enmSpeaker == RTPINGPONGSPEAKER_PONG) 848 848 { 849 enmCmd = dbgf r3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);849 enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER); 850 850 int rc = RTSemPong(&pVM->dbgf.s.PingPong); 851 851 if (VBOX_FAILURE(rc)) … … 858 858 else 859 859 { 860 enmCmd = dbgf r3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);860 enmCmd = dbgfR3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER); 861 861 LogFunc(("enmCmd=%d (ping)\n", enmCmd)); 862 862 } … … 948 948 * Send command. 949 949 */ 950 dbgf r3SetCmd(pVM, DBGFCMD_HALT);950 dbgfR3SetCmd(pVM, DBGFCMD_HALT); 951 951 952 952 return VINF_SUCCESS; … … 1020 1020 * Send the ping back to the emulation thread telling it to run. 1021 1021 */ 1022 dbgf r3SetCmd(pVM, DBGFCMD_GO);1022 dbgfR3SetCmd(pVM, DBGFCMD_GO); 1023 1023 int rc = RTSemPong(&pVM->dbgf.s.PingPong); 1024 1024 AssertRC(rc); … … 1056 1056 * Send the ping back to the emulation thread telling it to run. 1057 1057 */ 1058 dbgf r3SetCmd(pVM, DBGFCMD_SINGLE_STEP);1058 dbgfR3SetCmd(pVM, DBGFCMD_SINGLE_STEP); 1059 1059 int rc = RTSemPong(&pVM->dbgf.s.PingPong); 1060 1060 AssertRC(rc); -
trunk/src/VBox/VMM/DBGFAddr.cpp
r8819 r12663 158 158 return true; 159 159 } 160 -
trunk/src/VBox/VMM/DBGFBp.cpp
r11311 r12663 56 56 57 57 58 58 59 /** 59 60 * Initialize the breakpoint stuff. -
trunk/src/VBox/VMM/DBGFDisas.cpp
r9846 r12663 42 42 43 43 /******************************************************************************* 44 * Internal Functions*44 * Structures and Typedefs * 45 45 *******************************************************************************/ 46 static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata);47 48 49 46 /** 50 47 * Structure used when disassembling and instructions in DBGF. … … 80 77 81 78 79 /******************************************************************************* 80 * Internal Functions * 81 *******************************************************************************/ 82 static DECLCALLBACK(int) dbgfR3DisasInstrRead(RTUINTPTR pSrc, uint8_t *pDest, uint32_t size, void *pvUserdata); 83 84 82 85 83 86 /** -
trunk/src/VBox/VMM/DBGFInfo.cpp
r8155 r12663 390 390 391 391 392 393 392 /** 394 393 * Register a info handler owned by an external component. … … 631 630 } 632 631 632 633 633 /** 634 634 * Deregister a info handler owned by an internal component. -
trunk/src/VBox/VMM/DBGFInternal.h
r8802 r12663 84 84 { 85 85 uint32_t uDummy; 86 87 86 } DBGFCMDDATA; 88 87 /** Pointer to DBGF Command Data. */ … … 205 204 * Set if a debugger is attached, elsewise it's clear. 206 205 */ 207 volatile boolfAttached;206 bool volatile fAttached; 208 207 209 208 /** Stopped in the Hypervisor. … … 211 210 * the hypervisor and have to restrict the available operations. 212 211 */ 213 volatile boolfStoppedInHyper;212 bool volatile fStoppedInHyper; 214 213 215 214 /** … … 232 231 * when it have processed it. 233 232 */ 234 volatile DBGFCMDenmVMMCmd;233 DBGFCMD volatile enmVMMCmd; 235 234 /** The Command data. 236 235 * Not all commands take data. */ -
trunk/src/VBox/VMM/DBGFLog.cpp
r8155 r12663 19 19 * additional information or have any questions. 20 20 */ 21 22 21 23 22 -
trunk/src/VBox/VMM/DBGFStack.cpp
r8155 r12663 64 64 65 65 66 67 68 66 /** 69 67 * Internal worker routine. … … 76 74 * 4 return address 77 75 * 0 old ebp; current ebp points here 76 * 77 * @todo Add AMD64 support (needs teaming up with the module management for 78 * unwind tables). 78 79 */ 79 80 static int dbgfR3StackWalk(PVM pVM, PDBGFSTACKFRAME pFrame) -
trunk/src/VBox/VMM/DBGFSym.cpp
r9182 r12663 49 49 #include <stdio.h> /* for fopen(). */ /** @todo use iprt/stream.h! */ 50 50 #include <stdlib.h> 51 52 51 53 52 -
trunk/src/VBox/VMM/VMMGC/DBGFGC.cpp
r9212 r12663 2 2 /** @file 3 3 * DBGF - Debugger Facility, GC part. 4 * 5 * Almost identical to DBGFR0.cpp, except for the fInHyper stuff. 4 6 */ 5 7 -
trunk/src/VBox/VMM/VMMR0/DBGFR0.cpp
r11311 r12663 2 2 /** @file 3 3 * DBGF - Debugger Facility, R0 part. 4 * 5 * Almost identical to DBGFGC.cpp, except for the fInHyper stuff. 4 6 */ 5 7
Note:
See TracChangeset
for help on using the changeset viewer.