1 | /* $Id: DBGFAll.cpp 2981 2007-06-01 16:01:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DBGF - Debugger Facility, All Context Code.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
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 | */
|
---|
39 | DBGFDECL(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 = 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 | */
|
---|
70 | DBGFDECL(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 | */
|
---|
84 | DBGFDECL(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 | */
|
---|
98 | DBGFDECL(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 | */
|
---|
112 | DBGFDECL(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 single stepping state
|
---|
122 | *
|
---|
123 | * @returns stepping or not
|
---|
124 | * @param pVM The VM handle.
|
---|
125 | */
|
---|
126 | DBGFDECL(bool) DBGFIsStepping(PVM pVM)
|
---|
127 | {
|
---|
128 | return pVM->dbgf.s.fSingleSteppingRaw;
|
---|
129 | }
|
---|