42#include <sys/signal.h>
59#include "debug/GDBAcc.hh"
67using namespace X86ISA;
70 BaseRemoteGDB(_system, _listen_config),
71 regCache32(this), regCache64(this)
75RemoteGDB::acc(Addr va,
size_t len)
78 Walker *walker =
dynamic_cast<MMU *
>(
79 context()->getMMUPtr())->getDataWalker();
81 Fault fault = walker->startFunctional(context(),
va, logBytes,
87 if ((va & ~
mask(logBytes)) == (endVa & ~mask(logBytes)))
90 fault = walker->startFunctional(context(), endVa, logBytes,
94 return context()->getProcessPtr()->pTable->lookup(va) !=
nullptr;
104 auto arch =
system()->workload->getArch();
105 if (arch == loader::X86_64) {
107 }
else if (arch == loader::I386) {
109 }
else if (arch != loader::UnknownArch) {
110 panic(
"Unrecognized workload arch %s.",
111 loader::archToString(arch));
116 HandyM5Reg m5reg = context()->readMiscRegNoEffect(misc_reg::M5Reg);
117 if (m5reg.submode == SixtyFourBitMode)
128 DPRINTF(GDBAcc,
"getRegs in remotegdb \n");
129 r.rax = context->
getReg(int_reg::Rax);
130 r.rbx = context->
getReg(int_reg::Rbx);
131 r.rcx = context->
getReg(int_reg::Rcx);
132 r.rdx = context->
getReg(int_reg::Rdx);
133 r.rsi = context->
getReg(int_reg::Rsi);
134 r.rdi = context->
getReg(int_reg::Rdi);
135 r.rbp = context->
getReg(int_reg::Rbp);
136 r.rsp = context->
getReg(int_reg::Rsp);
137 r.r8 = context->
getReg(int_reg::R8);
138 r.r9 = context->
getReg(int_reg::R9);
139 r.r10 = context->
getReg(int_reg::R10);
140 r.r11 = context->
getReg(int_reg::R11);
141 r.r12 = context->
getReg(int_reg::R12);
142 r.r13 = context->
getReg(int_reg::R13);
143 r.r14 = context->
getReg(int_reg::R14);
144 r.r15 = context->
getReg(int_reg::R15);
158 DPRINTF(GDBAcc,
"getRegs in remotegdb \n");
159 r.eax = context->
getReg(int_reg::Rax);
160 r.ecx = context->
getReg(int_reg::Rcx);
161 r.edx = context->
getReg(int_reg::Rdx);
162 r.ebx = context->
getReg(int_reg::Rbx);
163 r.esp = context->
getReg(int_reg::Rsp);
164 r.ebp = context->
getReg(int_reg::Rbp);
165 r.esi = context->
getReg(int_reg::Rsi);
166 r.edi = context->
getReg(int_reg::Rdi);
180 DPRINTF(GDBAcc,
"setRegs in remotegdb \n");
181 context->
setReg(int_reg::Rax, r.rax);
182 context->
setReg(int_reg::Rbx, r.rbx);
183 context->
setReg(int_reg::Rcx, r.rcx);
184 context->
setReg(int_reg::Rdx, r.rdx);
185 context->
setReg(int_reg::Rsi, r.rsi);
186 context->
setReg(int_reg::Rdi, r.rdi);
187 context->
setReg(int_reg::Rbp, r.rbp);
188 context->
setReg(int_reg::Rsp, r.rsp);
189 context->
setReg(int_reg::R8, r.r8);
190 context->
setReg(int_reg::R9, r.r9);
191 context->
setReg(int_reg::R10, r.r10);
192 context->
setReg(int_reg::R11, r.r11);
193 context->
setReg(int_reg::R12, r.r12);
194 context->
setReg(int_reg::R13, r.r13);
195 context->
setReg(int_reg::R14, r.r14);
196 context->
setReg(int_reg::R15, r.r15);
198 context->
setMiscReg(misc_reg::Rflags, r.eflags);
200 warn(
"Remote gdb: Ignoring update to CS.\n");
202 warn(
"Remote gdb: Ignoring update to SS.\n");
204 warn(
"Remote gdb: Ignoring update to DS.\n");
206 warn(
"Remote gdb: Ignoring update to ES.\n");
208 warn(
"Remote gdb: Ignoring update to FS.\n");
210 warn(
"Remote gdb: Ignoring update to GS.\n");
216 DPRINTF(GDBAcc,
"setRegs in remotegdb \n");
217 context->
setReg(int_reg::Rax, r.eax);
218 context->
setReg(int_reg::Rcx, r.ecx);
219 context->
setReg(int_reg::Rdx, r.edx);
220 context->
setReg(int_reg::Rbx, r.ebx);
221 context->
setReg(int_reg::Rsp, r.esp);
222 context->
setReg(int_reg::Rbp, r.ebp);
223 context->
setReg(int_reg::Rsi, r.esi);
224 context->
setReg(int_reg::Rdi, r.edi);
226 context->
setMiscReg(misc_reg::Rflags, r.eflags);
228 warn(
"Remote gdb: Ignoring update to CS.\n");
230 warn(
"Remote gdb: Ignoring update to SS.\n");
232 warn(
"Remote gdb: Ignoring update to DS.\n");
234 warn(
"Remote gdb: Ignoring update to ES.\n");
236 warn(
"Remote gdb: Ignoring update to FS.\n");
238 warn(
"Remote gdb: Ignoring update to GS.\n");
RemoteGDB(System *_system, ListenSocketConfig _listen_config)
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual void setMiscReg(RegIndex misc_reg, RegVal val)=0
virtual RegVal getReg(const RegId ®) const
virtual void setReg(const RegId ®, RegVal val)
virtual const PCStateBase & pcState() const =0
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
constexpr decltype(nullptr) NoFault
Declarations of a non-full system Page Table.