gem5
v20.1.0.0
arch
x86
remote_gdb.hh
Go to the documentation of this file.
1
/*
2
* Copyright 2015 LabWare
3
* Copyright 2014 Google, Inc.
4
* Copyright (c) 2007 The Hewlett-Packard Development Company
5
* All rights reserved.
6
*
7
* The license below extends only to copyright in the software and shall
8
* not be construed as granting a license to any other intellectual
9
* property including but not limited to intellectual property relating
10
* to a hardware implementation of the functionality of the software
11
* licensed hereunder. You may use the software subject to the license
12
* terms below provided that you ensure that this notice is replicated
13
* unmodified and in its entirety in all distributions of the software,
14
* modified or unmodified, in source code or in binary form.
15
*
16
* Redistribution and use in source and binary forms, with or without
17
* modification, are permitted provided that the following conditions are
18
* met: redistributions of source code must retain the above copyright
19
* notice, this list of conditions and the following disclaimer;
20
* redistributions in binary form must reproduce the above copyright
21
* notice, this list of conditions and the following disclaimer in the
22
* documentation and/or other materials provided with the distribution;
23
* neither the name of the copyright holders nor the names of its
24
* contributors may be used to endorse or promote products derived from
25
* this software without specific prior written permission.
26
*
27
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
*/
39
40
#ifndef __ARCH_X86_REMOTEGDB_HH__
41
#define __ARCH_X86_REMOTEGDB_HH__
42
43
#include <algorithm>
44
45
#include "
arch/x86/types.hh
"
46
#include "
base/remote_gdb.hh
"
47
48
class
System
;
49
class
ThreadContext
;
50
51
namespace
X86ISA
52
{
53
class
RemoteGDB
:
public
BaseRemoteGDB
54
{
55
protected
:
56
bool
acc
(
Addr
addr
,
size_t
len
);
57
bool
checkBpLen
(
size_t
len
) {
return
len
== 1; }
58
class
X86GdbRegCache
:
public
BaseGdbRegCache
59
{
60
using
BaseGdbRegCache::BaseGdbRegCache
;
61
private
:
62
struct
{
63
uint32_t
eax
;
64
uint32_t
ecx
;
65
uint32_t
edx
;
66
uint32_t
ebx
;
67
uint32_t
esp
;
68
uint32_t
ebp
;
69
uint32_t
esi
;
70
uint32_t
edi
;
71
uint32_t
eip
;
72
uint32_t
eflags
;
73
uint32_t
cs
;
74
uint32_t
ss
;
75
uint32_t
ds
;
76
uint32_t
es
;
77
uint32_t
fs
;
78
uint32_t
gs
;
79
}
r
;
80
public
:
81
char
*
data
()
const
{
return
(
char
*)&
r
; }
82
size_t
size
()
const
{
return
sizeof
(
r
); }
83
void
getRegs
(
ThreadContext
*);
84
void
setRegs
(
ThreadContext
*)
const
;
85
const
std::string
86
name
()
const
87
{
88
return
gdb
->
name
() +
".X86GdbRegCache"
;
89
}
90
};
91
92
class
AMD64GdbRegCache
:
public
BaseGdbRegCache
93
{
94
using
BaseGdbRegCache::BaseGdbRegCache
;
95
private
:
96
struct
M5_ATTR_PACKED
{
97
uint64_t
rax
;
98
uint64_t
rbx
;
99
uint64_t
rcx
;
100
uint64_t
rdx
;
101
uint64_t
rsi
;
102
uint64_t
rdi
;
103
uint64_t
rbp
;
104
uint64_t
rsp
;
105
uint64_t
r8
;
106
uint64_t
r9
;
107
uint64_t
r10
;
108
uint64_t
r11
;
109
uint64_t
r12
;
110
uint64_t
r13
;
111
uint64_t
r14
;
112
uint64_t
r15
;
113
uint64_t
rip
;
114
uint32_t
eflags
;
115
uint32_t
cs
;
116
uint32_t
ss
;
117
uint32_t
ds
;
118
uint32_t
es
;
119
uint32_t
fs
;
120
uint32_t
gs
;
121
/*
122
* We do not model st[], FPU status regs, xmm[] etc.
123
* While it's not ok to have G-packets larger than what gdb
124
* knows about, it is ok to have smaller ones.
125
*/
126
}
r
;
127
public
:
128
char
*
data
()
const
{
return
(
char
*)&
r
; }
129
size_t
size
()
const
{
return
sizeof
(
r
); }
130
void
getRegs
(
ThreadContext
*);
131
void
setRegs
(
ThreadContext
*)
const
;
132
const
std::string
133
name
()
const
134
{
135
return
gdb
->
name
() +
".AMD64GdbRegCache"
;
136
}
137
};
138
139
X86GdbRegCache
regCache32
;
140
AMD64GdbRegCache
regCache64
;
141
142
public
:
143
RemoteGDB
(
System
*
system
,
ThreadContext
*
context
,
int
_port
);
144
BaseGdbRegCache
*
gdbRegs
();
145
};
146
}
// namespace X86ISA
147
148
#endif // __ARCH_X86_REMOTEGDB_HH__
X86ISA::RemoteGDB::gdbRegs
BaseGdbRegCache * gdbRegs()
Definition:
remote_gdb.cc:92
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::r14
uint64_t r14
Definition:
remote_gdb.hh:111
X86ISA::RemoteGDB::X86GdbRegCache::data
char * data() const
Return the pointer to the raw bytes buffer containing the register values.
Definition:
remote_gdb.hh:81
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rsp
uint64_t rsp
Definition:
remote_gdb.hh:104
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::es
uint32_t es
Definition:
remote_gdb.hh:118
X86ISA::RemoteGDB::AMD64GdbRegCache
Definition:
remote_gdb.hh:92
X86ISA::RemoteGDB::X86GdbRegCache::ecx
uint32_t ecx
Definition:
remote_gdb.hh:64
X86ISA::RemoteGDB::X86GdbRegCache::ss
uint32_t ss
Definition:
remote_gdb.hh:74
X86ISA::RemoteGDB::X86GdbRegCache::esi
uint32_t esi
Definition:
remote_gdb.hh:69
X86ISA::RemoteGDB::AMD64GdbRegCache::r
struct X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED r
X86ISA::RemoteGDB::AMD64GdbRegCache::getRegs
void getRegs(ThreadContext *)
Fill the raw buffer from the registers in the ThreadContext.
Definition:
remote_gdb.cc:104
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED
Definition:
remote_gdb.hh:96
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::r12
uint64_t r12
Definition:
remote_gdb.hh:109
X86ISA::RemoteGDB::X86GdbRegCache::size
size_t size() const
Return the size of the raw buffer, in bytes (i.e., half of the number of digits in the g/G packet).
Definition:
remote_gdb.hh:82
remote_gdb.hh
X86ISA::RemoteGDB
Definition:
remote_gdb.hh:53
X86ISA::RemoteGDB::X86GdbRegCache::ds
uint32_t ds
Definition:
remote_gdb.hh:75
BaseGdbRegCache::gdb
BaseRemoteGDB * gdb
Definition:
remote_gdb.hh:125
BaseGdbRegCache::BaseGdbRegCache
BaseGdbRegCache(BaseRemoteGDB *g)
Definition:
remote_gdb.hh:119
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::r9
uint64_t r9
Definition:
remote_gdb.hh:106
X86ISA::RemoteGDB::X86GdbRegCache::getRegs
void getRegs(ThreadContext *)
Fill the raw buffer from the registers in the ThreadContext.
Definition:
remote_gdb.cc:134
X86ISA::RemoteGDB::X86GdbRegCache::eax
uint32_t eax
Definition:
remote_gdb.hh:63
X86ISA::RemoteGDB::X86GdbRegCache::esp
uint32_t esp
Definition:
remote_gdb.hh:67
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rsi
uint64_t rsi
Definition:
remote_gdb.hh:101
X86ISA::RemoteGDB::X86GdbRegCache::es
uint32_t es
Definition:
remote_gdb.hh:76
BaseRemoteGDB::context
ThreadContext * context()
Definition:
remote_gdb.hh:304
X86ISA::RemoteGDB::regCache64
AMD64GdbRegCache regCache64
Definition:
remote_gdb.hh:140
X86ISA::RemoteGDB::X86GdbRegCache::name
const std::string name() const
Return the name to use in places like DPRINTF.
Definition:
remote_gdb.hh:86
ThreadContext
ThreadContext is the external interface to all thread state for anything outside of the CPU.
Definition:
thread_context.hh:88
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rip
uint64_t rip
Definition:
remote_gdb.hh:113
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rcx
uint64_t rcx
Definition:
remote_gdb.hh:99
X86ISA::RemoteGDB::acc
bool acc(Addr addr, size_t len)
Definition:
remote_gdb.cc:68
System
Definition:
system.hh:73
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::r15
uint64_t r15
Definition:
remote_gdb.hh:112
BaseRemoteGDB::_port
int _port
Definition:
remote_gdb.hh:193
X86ISA::RemoteGDB::X86GdbRegCache::fs
uint32_t fs
Definition:
remote_gdb.hh:77
BaseRemoteGDB::system
System * system()
Definition:
remote_gdb.hh:305
X86ISA::RemoteGDB::X86GdbRegCache::r
struct X86ISA::RemoteGDB::X86GdbRegCache::@21 r
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::fs
uint32_t fs
Definition:
remote_gdb.hh:119
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rbp
uint64_t rbp
Definition:
remote_gdb.hh:103
X86ISA::RemoteGDB::checkBpLen
bool checkBpLen(size_t len)
Definition:
remote_gdb.hh:57
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::gs
uint32_t gs
Definition:
remote_gdb.hh:120
X86ISA::RemoteGDB::AMD64GdbRegCache::name
const std::string name() const
Return the name to use in places like DPRINTF.
Definition:
remote_gdb.hh:133
X86ISA::RemoteGDB::X86GdbRegCache::ebx
uint32_t ebx
Definition:
remote_gdb.hh:66
X86ISA::RemoteGDB::X86GdbRegCache::edx
uint32_t edx
Definition:
remote_gdb.hh:65
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rbx
uint64_t rbx
Definition:
remote_gdb.hh:98
X86ISA::RemoteGDB::X86GdbRegCache::eip
uint32_t eip
Definition:
remote_gdb.hh:71
X86ISA::RemoteGDB::X86GdbRegCache::eflags
uint32_t eflags
Definition:
remote_gdb.hh:72
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rdi
uint64_t rdi
Definition:
remote_gdb.hh:102
X86ISA::RemoteGDB::X86GdbRegCache::cs
uint32_t cs
Definition:
remote_gdb.hh:73
X86ISA
This is exposed globally, independent of the ISA.
Definition:
acpi.hh:55
BaseRemoteGDB
Definition:
remote_gdb.hh:43
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition:
types.hh:142
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::cs
uint32_t cs
Definition:
remote_gdb.hh:115
BaseGdbRegCache
Concrete subclasses of this abstract class represent how the register values are transmitted on the w...
Definition:
remote_gdb.hh:70
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rax
uint64_t rax
Definition:
remote_gdb.hh:97
X86ISA::RemoteGDB::X86GdbRegCache::edi
uint32_t edi
Definition:
remote_gdb.hh:70
X86ISA::addr
Bitfield< 3 > addr
Definition:
types.hh:79
X86ISA::RemoteGDB::X86GdbRegCache
Definition:
remote_gdb.hh:58
X86ISA::RemoteGDB::AMD64GdbRegCache::setRegs
void setRegs(ThreadContext *) const
Set the ThreadContext's registers from the values in the raw buffer.
Definition:
remote_gdb.cc:156
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::ds
uint32_t ds
Definition:
remote_gdb.hh:117
X86ISA::RemoteGDB::regCache32
X86GdbRegCache regCache32
Definition:
remote_gdb.hh:139
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::r8
uint64_t r8
Definition:
remote_gdb.hh:105
ArmISA::len
Bitfield< 18, 16 > len
Definition:
miscregs_types.hh:439
BaseRemoteGDB::name
std::string name()
Definition:
remote_gdb.cc:332
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::ss
uint32_t ss
Definition:
remote_gdb.hh:116
X86ISA::RemoteGDB::AMD64GdbRegCache::size
size_t size() const
Return the size of the raw buffer, in bytes (i.e., half of the number of digits in the g/G packet).
Definition:
remote_gdb.hh:129
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::r11
uint64_t r11
Definition:
remote_gdb.hh:108
X86ISA::RemoteGDB::X86GdbRegCache::gs
uint32_t gs
Definition:
remote_gdb.hh:78
X86ISA::RemoteGDB::RemoteGDB
RemoteGDB(System *system, ThreadContext *context, int _port)
Definition:
remote_gdb.cc:63
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::r10
uint64_t r10
Definition:
remote_gdb.hh:107
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::rdx
uint64_t rdx
Definition:
remote_gdb.hh:100
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::r13
uint64_t r13
Definition:
remote_gdb.hh:110
X86ISA::RemoteGDB::AMD64GdbRegCache::M5_ATTR_PACKED::eflags
uint32_t eflags
Definition:
remote_gdb.hh:114
X86ISA::RemoteGDB::AMD64GdbRegCache::data
char * data() const
Return the pointer to the raw bytes buffer containing the register values.
Definition:
remote_gdb.hh:128
types.hh
X86ISA::RemoteGDB::X86GdbRegCache::setRegs
void setRegs(ThreadContext *) const
Set the ThreadContext's registers from the values in the raw buffer.
Definition:
remote_gdb.cc:192
X86ISA::RemoteGDB::X86GdbRegCache::ebp
uint32_t ebp
Definition:
remote_gdb.hh:68
Generated on Wed Sep 30 2020 14:02:01 for gem5 by
doxygen
1.8.17