Main Page
Namespaces
Classes
Files
Examples
File List
File Members
GDBRegisters.h
Go to the documentation of this file.
1
#pragma once
2
#include <vector>
3
4
namespace
GDBServerFoundation
5
{
7
struct
RegisterEntry
8
{
10
int
RegisterIndex
;
12
const
char
*
RegisterName
;
14
int
SizeInBits
;
15
};
16
22
23
26
struct
PlatformRegisterList
27
{
29
size_t
RegisterCount
;
31
RegisterEntry
*
Registers
;
32
};
33
35
struct
RegisterValue
36
{
38
bool
Valid
;
40
unsigned
char
SizeInBytes
;
42
unsigned
char
Value
[64];
43
45
RegisterValue
()
46
:
Valid
(false)
47
,
SizeInBytes
(0)
48
{
49
}
50
52
RegisterValue
(
unsigned
integralValue,
unsigned
char
sizeInBytes)
53
:
Valid
(true)
54
,
SizeInBytes
(sizeInBytes)
55
{
56
if
(
SizeInBytes
>
sizeof
(
Value
))
57
SizeInBytes
=
sizeof
(
Value
);
58
memcpy(
Value
, &integralValue,
SizeInBytes
);
59
}
60
62
unsigned
ToUInt32
()
const
63
{
64
return
*((
unsigned
*)
Value
);
65
}
66
68
unsigned
short
ToUInt16
()
const
69
{
70
return
*((
unsigned
short
*)
Value
);
71
}
72
};
73
75
84
class
RegisterSetContainer
85
{
86
private
:
87
std::vector<RegisterValue> m_Values;
88
89
public
:
91
RegisterSetContainer
(
size_t
registerCount)
92
{
93
m_Values.resize(registerCount);
94
}
95
97
RegisterValue
&
operator[]
(
size_t
index)
98
{
99
ASSERT(index < m_Values.size());
100
return
m_Values[index];
101
}
102
104
const
RegisterValue
&
operator[]
(
size_t
index)
const
105
{
106
ASSERT(index < m_Values.size());
107
return
m_Values[index];
108
}
109
111
size_t
RegisterCount
()
112
{
113
return
m_Values.size();
114
}
115
};
116
}