45 #ifndef __REMOTE_GDB_HH__ 46 #define __REMOTE_GDB_HH__ 48 #include <sys/signal.h> 54 #include "arch/types.hh" 82 virtual char *
data()
const = 0;
88 virtual size_t size()
const = 0;
107 virtual const std::string
name()
const = 0;
149 void incomingData(
int revent);
152 template <
void (BaseRemoteGDB::*F)(
int revent)>
163 void process(
int revent) { (gdb->*F)(revent); }
183 void putbyte(uint8_t
b);
186 void send(
const char *
data);
218 bool write(
Addr addr,
size_t size,
const char *data);
220 template <
class T> T read(
Addr addr);
221 template <
class T>
void write(
Addr addr, T data);
227 void clearSingleStep();
228 void setSingleStep();
231 void scheduleInstCommitEvent(
Event *ev,
int delta);
233 void descheduleInstCommitEvent(
Event *ev);
236 void insertSoftBreak(
Addr addr,
size_t len);
237 void removeSoftBreak(
Addr addr,
size_t len);
238 void insertHardBreak(
Addr addr,
size_t len);
239 void removeHardBreak(
Addr addr,
size_t len);
241 void clearTempBreakpoint(
Addr &bkpt);
242 void setTempBreakpoint(
Addr bkpt);
264 GdbCommand(
const char *_name, Func _func) : name(_name), func(_func) {}
290 void encodeBinaryData(
const std::string &unencoded,
291 std::string &encoded)
const;
293 void encodeXferResponse(
const std::string &unencoded,
294 std::string &encoded,
size_t offset,
size_t unencoded_length)
const;
297 virtual bool checkBpLen(
size_t len);
301 virtual bool acc(
Addr addr,
size_t len) = 0;
312 virtual bool getXferFeaturesRead(
const std::string &annex,
321 read(addr,
sizeof(T), (
char *)&temp);
329 write(addr,
sizeof(T), (
const char *)&data);
bool read(Addr addr, size_t size, char *data)
void connectWrapper(int revent)
static void output(const char *filename)
ConnectEvent * connectEvent
virtual void getRegs(ThreadContext *)=0
Fill the raw buffer from the registers in the ThreadContext.
virtual const std::string name() const =0
Return the name to use in places like DPRINTF.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
virtual void setRegs(ThreadContext *) const =0
Set the ThreadContext's registers from the values in the raw buffer.
EventWrapper< BaseRemoteGDB, &BaseRemoteGDB::singleStep > singleStepEvent
BaseGdbRegCache * regCachePtr
SocketEvent(BaseRemoteGDB *gdb, int fd, int e)
void replaceThreadContext(ThreadContext *_tc)
Concrete subclasses of this abstract class represent how the register values are transmitted on the w...
static std::map< char, GdbCommand > command_map
SocketEvent<&BaseRemoteGDB::incomingData > DataEvent
TrapEvent(BaseRemoteGDB *g)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool write(Addr addr, size_t size, const char *data)
virtual ~BaseGdbRegCache()
GdbCommand(const char *_name, Func _func)
virtual char * data() const =0
Return the pointer to the raw bytes buffer containing the register values.
ThreadContext * context()
BaseGdbRegCache(BaseRemoteGDB *g)
virtual size_t size() const =0
Return the size of the raw buffer, in bytes (i.e., half of the number of digits in the g/G packet)...
SocketEvent<&BaseRemoteGDB::connectWrapper > ConnectEvent