VirtualBox

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

Last change on this file since 37387 was 35346, checked in by vboxsync, 14 years ago

VMM reorg: Moving the public include files from include/VBox to include/VBox/vmm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1/* $Id: DBGFAll.cpp 35346 2010-12-27 16:13:13Z vboxsync $ */
2/** @file
3 * DBGF - Debugger Facility, All Context Code.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Oracle Corporation
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
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#define LOG_GROUP LOG_GROUP_DBGF
23#include <VBox/vmm/dbgf.h>
24#include "DBGFInternal.h"
25#include <VBox/vmm/vm.h>
26#include <iprt/assert.h>
27
28
29/**
30 * Gets the hardware breakpoint configuration as DR7.
31 *
32 * @returns DR7 from the DBGF point of view.
33 * @param pVM The VM handle.
34 */
35VMMDECL(RTGCUINTREG) DBGFBpGetDR7(PVM pVM)
36{
37 RTGCUINTREG uDr7 = X86_DR7_GD | X86_DR7_GE | X86_DR7_LE | X86_DR7_MB1_MASK;
38 PDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[0];
39 unsigned cLeft = RT_ELEMENTS(pVM->dbgf.s.aHwBreakpoints);
40 while (cLeft-- > 0)
41 {
42 if ( pBp->enmType == DBGFBPTYPE_REG
43 && pBp->fEnabled)
44 {
45 static const uint8_t s_au8Sizes[8] =
46 {
47 X86_DR7_LEN_BYTE, X86_DR7_LEN_BYTE, X86_DR7_LEN_WORD, X86_DR7_LEN_BYTE,
48 X86_DR7_LEN_DWORD,X86_DR7_LEN_BYTE, X86_DR7_LEN_BYTE, X86_DR7_LEN_QWORD
49 };
50 uDr7 |= X86_DR7_G(pBp->u.Reg.iReg)
51 | X86_DR7_RW(pBp->u.Reg.iReg, pBp->u.Reg.fType)
52 | X86_DR7_LEN(pBp->u.Reg.iReg, s_au8Sizes[pBp->u.Reg.cb]);
53 }
54 pBp++;
55 }
56 return uDr7;
57}
58
59
60/**
61 * Gets the address of the hardware breakpoint number 0.
62 *
63 * @returns DR0 from the DBGF point of view.
64 * @param pVM The VM handle.
65 */
66VMMDECL(RTGCUINTREG) DBGFBpGetDR0(PVM pVM)
67{
68 PCDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[0];
69 Assert(pBp->u.Reg.iReg == 0);
70 return pBp->GCPtr;
71}
72
73
74/**
75 * Gets the address of the hardware breakpoint number 1.
76 *
77 * @returns DR1 from the DBGF point of view.
78 * @param pVM The VM handle.
79 */
80VMMDECL(RTGCUINTREG) DBGFBpGetDR1(PVM pVM)
81{
82 PCDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[1];
83 Assert(pBp->u.Reg.iReg == 1);
84 return pBp->GCPtr;
85}
86
87
88/**
89 * Gets the address of the hardware breakpoint number 2.
90 *
91 * @returns DR2 from the DBGF point of view.
92 * @param pVM The VM handle.
93 */
94VMMDECL(RTGCUINTREG) DBGFBpGetDR2(PVM pVM)
95{
96 PCDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[2];
97 Assert(pBp->u.Reg.iReg == 2);
98 return pBp->GCPtr;
99}
100
101
102/**
103 * Gets the address of the hardware breakpoint number 3.
104 *
105 * @returns DR3 from the DBGF point of view.
106 * @param pVM The VM handle.
107 */
108VMMDECL(RTGCUINTREG) DBGFBpGetDR3(PVM pVM)
109{
110 PCDBGFBP pBp = &pVM->dbgf.s.aHwBreakpoints[3];
111 Assert(pBp->u.Reg.iReg == 3);
112 return pBp->GCPtr;
113}
114
115
116/**
117 * Returns the single stepping state for a virtual CPU.
118 *
119 * @returns stepping (true) or not (false).
120 *
121 * @param pVCpu The virtual CPU handle.
122 */
123VMMDECL(bool) DBGFIsStepping(PVMCPU pVCpu)
124{
125 return pVCpu->dbgf.s.fSingleSteppingRaw;
126}
127
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