VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMAll/DBGFAll.cpp@ 23794

Last change on this file since 23794 was 19286, checked in by vboxsync, 15 years ago

VMM,VBoxDbg: SMP refactoring, part 1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1/* $Id: DBGFAll.cpp 19286 2009-05-01 12:41:07Z vboxsync $ */
2/** @file
3 * DBGF - Debugger Facility, All Context Code.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22
23/*******************************************************************************
24* Header Files *
25*******************************************************************************/
26#define LOG_GROUP LOG_GROUP_DBGF
27#include <VBox/dbgf.h>
28#include "DBGFInternal.h"
29#include <VBox/vm.h>
30#include <iprt/assert.h>
31
32
33/**
34 * Gets the hardware breakpoint configuration as DR7.
35 *
36 * @returns DR7 from the DBGF point of view.
37 * @param pVM The VM handle.
38 */
39VMMDECL(RTGCUINTREG) DBGFBpGetDR7(PVM pVM)
40{
41 RTGCUINTREG uDr7 = X86_DR7_GD | X86_DR7_GE | X86_DR7_LE | X86_DR7_MB1_MASK;
42 PDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[0];
43 unsigned cLeft = RT_ELEMENTS(pVM->dbgf.s.aHwBreakpoints);
44 while (cLeft-- > 0)
45 {
46 if ( pBp->enmType == DBGFBPTYPE_REG
47 && pBp->fEnabled)
48 {
49 static const uint8_t s_au8Sizes[8] =
50 {
51 X86_DR7_LEN_BYTE, X86_DR7_LEN_BYTE, X86_DR7_LEN_WORD, X86_DR7_LEN_BYTE,
52 X86_DR7_LEN_DWORD,X86_DR7_LEN_BYTE, X86_DR7_LEN_BYTE, X86_DR7_LEN_QWORD
53 };
54 uDr7 |= X86_DR7_G(pBp->u.Reg.iReg)
55 | X86_DR7_RW(pBp->u.Reg.iReg, pBp->u.Reg.fType)
56 | X86_DR7_LEN(pBp->u.Reg.iReg, s_au8Sizes[pBp->u.Reg.cb]);
57 }
58 pBp++;
59 }
60 return uDr7;
61}
62
63
64/**
65 * Gets the address of the hardware breakpoint number 0.
66 *
67 * @returns DR0 from the DBGF point of view.
68 * @param pVM The VM handle.
69 */
70VMMDECL(RTGCUINTREG) DBGFBpGetDR0(PVM pVM)
71{
72 PCDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[0];
73 Assert(pBp->u.Reg.iReg == 0);
74 return pBp->GCPtr;
75}
76
77
78/**
79 * Gets the address of the hardware breakpoint number 1.
80 *
81 * @returns DR1 from the DBGF point of view.
82 * @param pVM The VM handle.
83 */
84VMMDECL(RTGCUINTREG) DBGFBpGetDR1(PVM pVM)
85{
86 PCDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[1];
87 Assert(pBp->u.Reg.iReg == 1);
88 return pBp->GCPtr;
89}
90
91
92/**
93 * Gets the address of the hardware breakpoint number 2.
94 *
95 * @returns DR2 from the DBGF point of view.
96 * @param pVM The VM handle.
97 */
98VMMDECL(RTGCUINTREG) DBGFBpGetDR2(PVM pVM)
99{
100 PCDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[2];
101 Assert(pBp->u.Reg.iReg == 2);
102 return pBp->GCPtr;
103}
104
105
106/**
107 * Gets the address of the hardware breakpoint number 3.
108 *
109 * @returns DR3 from the DBGF point of view.
110 * @param pVM The VM handle.
111 */
112VMMDECL(RTGCUINTREG) DBGFBpGetDR3(PVM pVM)
113{
114 PCDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[3];
115 Assert(pBp->u.Reg.iReg == 3);
116 return pBp->GCPtr;
117}
118
119
120/**
121 * Returns the single stepping state for a virtual CPU.
122 *
123 * @returns stepping (true) or not (false).
124 *
125 * @param pVCpu The virtual CPU handle.
126 */
127VMMDECL(bool) DBGFIsStepping(PVMCPU pVCpu)
128{
129 return pVCpu->dbgf.s.fSingleSteppingRaw;
130}
131
Note: See TracBrowser for help on using the repository browser.

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