VirtualBox

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

Last change on this file since 4403 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1/* $Id: DBGFAll.cpp 4071 2007-08-07 17:07:59Z 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
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#define LOG_GROUP LOG_GROUP_DBGF
23#include <VBox/dbgf.h>
24#include "DBGFInternal.h"
25#include <VBox/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 */
35DBGFDECL(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 = 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 */
66DBGFDECL(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 */
80DBGFDECL(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 */
94DBGFDECL(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 */
108DBGFDECL(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 single stepping state
118 *
119 * @returns stepping or not
120 * @param pVM The VM handle.
121 */
122DBGFDECL(bool) DBGFIsStepping(PVM pVM)
123{
124 return pVM->dbgf.s.fSingleSteppingRaw;
125}
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