42#ifndef __REMOTE_GDB_HH__
43#define __REMOTE_GDB_HH__
58#include "gdbremote/signals.hh"
104 virtual size_t size()
const = 0;
129 virtual const std::string
name()
const = 0;
174 void trap(
ContextID id, GDBSignal sig,
const std::string& stopReason=
"");
178 std::string stopReason);
181 template <
class GDBStub,
class ...Args>
186 return new GDBStub(args..., listen_config);
209 template <
void (BaseRemoteGDB::*F)(
int revent)>
223 typedef SocketEvent<&BaseRemoteGDB::incomingConnection>
248 template <
typename ...Args>
330 const std::string& stopReason);
429 static std::map<std::string, QuerySetCommand>
queryMap;
447 std::string &encoded)
const;
450 std::string &encoded,
size_t offset,
size_t unencoded_length)
const;
479 read(
addr,
sizeof(T), (
char *)&temp);
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Concrete subclasses of this abstract class represent how the register values are transmitted on the w...
virtual ~BaseGdbRegCache()
SocketEvent(BaseRemoteGDB *gdb, int fd, int e)
void stopReason(std::string s)
TrapEvent(BaseRemoteGDB *g)
virtual void removeHardBreak(Addr addr, size_t kind)
bool queryAttached(QuerySetCommand::Context &ctx)
std::map< ContextID, ThreadContext * > threads
bool cmdQueryVar(GdbCommand::Context &ctx)
bool cmdCont(GdbCommand::Context &ctx)
virtual bool checkBpKind(size_t kind)
MemberEventWrapper<&BaseRemoteGDB::singleStep > singleStepEvent
bool cmdDetach(GdbCommand::Context &ctx)
bool cmdReplyEmpty(GdbMultiLetterCommand::Context &ctx)
static std::map< std::string, GdbMultiLetterCommand > multiLetterMap
void send(const char *data)
void incomingConnection(int revent)
IncomingConnectionEvent * incomingConnectionEvent
void encodeBinaryData(const std::string &unencoded, std::string &encoded) const
virtual void insertSoftBreak(Addr addr, size_t kind)
static std::map< std::string, QuerySetCommand > queryMap
virtual bool writeBlob(Addr vaddr, size_t size, const char *data)
bool cmdMemW(GdbCommand::Context &ctx)
bool querySupported(QuerySetCommand::Context &ctx)
bool queryRcmd(QuerySetCommand::Context &ctx)
IncomingDataEvent * incomingDataEvent
bool cmdSetThread(GdbCommand::Context &ctx)
bool cmdClrHwBkpt(GdbCommand::Context &ctx)
bool cmdDumpPageTable(GdbCommand::Context &ctx)
static std::map< char, GdbCommand > commandMap
bool trap(ContextID id, int type)
void incomingData(int revent)
bool try_getbyte(uint8_t *c, int timeout=-1)
bool cmdAsyncStep(GdbCommand::Context &ctx)
virtual std::vector< std::string > availableFeatures() const
MemberEventWrapper<&BaseRemoteGDB::connect > connectEvent
void sendTPacket(GDBSignal sig, ContextID id, const std::string &stopReason)
MemberEventWrapper<&BaseRemoteGDB::detach > disconnectEvent
SocketEvent<&BaseRemoteGDB::incomingData > IncomingDataEvent
void send(const char *format, const Args &...args)
void send(const std::string &data)
bool cmdSetHwBkpt(GdbCommand::Context &ctx)
void scheduleInstCommitEvent(Event *ev, int delta)
bool querySThreadInfo(QuerySetCommand::Context &ctx)
bool cmdStep(GdbCommand::Context &ctx)
void recv(std::vector< char > &bp)
virtual bool getXferFeaturesRead(const std::string &annex, std::string &output)
Get an XML target description.
ThreadContext * context()
bool cmdRegW(GdbCommand::Context &ctx)
void encodeXferResponse(const std::string &unencoded, std::string &encoded, size_t offset, size_t unencoded_length) const
bool cmdSignal(GdbCommand::Context &ctx)
void sendSPacket(GDBSignal sig)
bool cmdMemR(GdbCommand::Context &ctx)
void descheduleInstCommitEvent(Event *ev)
Deschedule an instruction count based event.
bool read(Addr vaddr, size_t size, char *data)
SocketEvent<&BaseRemoteGDB::incomingConnection > IncomingConnectionEvent
bool cmdRegR(GdbCommand::Context &ctx)
bool cmdIsThreadAlive(GdbCommand::Context &ctx)
void scheduleInstCommitEvent(Event *ev, int delta, ThreadContext *_tc)
Schedule an event which will be triggered "delta" instructions later.
virtual bool readBlob(Addr vaddr, size_t size, char *data)
virtual bool acc(Addr addr, size_t len)=0
virtual BaseGdbRegCache * gdbRegs()=0
gem5::BaseRemoteGDB::TrapEvent trapEvent
bool write(Addr vaddr, size_t size, const char *data)
bool cmdMultiUnsupported(GdbMultiLetterCommand::Context &ctx)
bool cmdUnsupported(GdbCommand::Context &ctx)
friend class HardBreakpoint
bool cmdMultiLetter(GdbCommand::Context &ctx)
bool queryXfer(QuerySetCommand::Context &ctx)
bool cmdVKill(GdbMultiLetterCommand::Context &ctx)
BaseGdbRegCache * regCachePtr
bool cmdAsyncCont(GdbCommand::Context &ctx)
void sendOPacket(const std::string message)
bool querySymbol(QuerySetCommand::Context &ctx)
bool queryFThreadInfo(QuerySetCommand::Context &ctx)
virtual void removeSoftBreak(Addr addr, size_t kind)
void processCommands(GDBSignal sig=GDBSignal::ZERO)
bool queryC(QuerySetCommand::Context &ctx)
virtual void insertHardBreak(Addr addr, size_t kind)
static BaseRemoteGDB * build(ListenSocketConfig listen_config, Args... args)
Event(Priority p=Default_Pri, Flags f=0)
Wrap a member function inside MemberEventWrapper to use it as an event callback.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
PollEvent(int fd, int event)
virtual const std::string name() const =0
Return the name to use in places like DPRINTF.
BaseGdbRegCache(BaseRemoteGDB *g)
bool sendMessage(std::string message)
virtual void getRegs(ThreadContext *)=0
Fill the raw buffer from the registers in the ThreadContext.
virtual void setRegs(ThreadContext *) const =0
Set the ThreadContext's registers from the values in the raw buffer.
void replaceThreadContext(ThreadContext *_tc)
const ListenSocket & hostSocket() const
void scheduleTrapEvent(ContextID id, GDBSignal type, int delta, std::string stopReason)
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).
virtual char * data()=0
Return the pointer to the raw bytes buffer containing the register values.
void addThreadContext(ThreadContext *_tc)
BaseRemoteGDB(System *system, ListenSocketConfig _listen_config)
Interface to other parts of the simulator.
bool selectThreadContext(ContextID id)
Bitfield< 31, 29 > format
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static void output(const char *filename)
int ContextID
Globally unique thread context ID.
std::string csprintf(const char *format, const Args &...args)
std::unique_ptr< ListenSocket > ListenSocketPtr
bool(BaseRemoteGDB::* Func)(Context &ctx)
GdbCommand(const char *_name, Func _func)
const GdbMultiLetterCommand * cmd
GdbMultiLetterCommand(const char *_name, Func _func)
bool(BaseRemoteGDB::* Func)(Context &ctx)
Context(const std::string &_name)
std::vector< std::string > args
QuerySetCommand(Func _func, const char *_argSep=nullptr)
bool(BaseRemoteGDB::*)(Context &ctx) Func