gem5
v21.1.0.2
|
#include <remote_gdb.hh>
Classes | |
struct | GdbCommand |
struct | QuerySetCommand |
class | SocketEvent |
class | TrapEvent |
Public Member Functions | |
bool | breakpoint () |
void | replaceThreadContext (ThreadContext *tc) |
bool | trap (ContextID id, int type) |
virtual | ~BaseRemoteGDB () |
BaseRemoteGDB (System *system, int _port) | |
Interface to other parts of the simulator. More... | |
virtual | ~BaseRemoteGDB () |
std::string | name () |
void | listen () |
void | connect () |
int | port () const |
void | attach (int fd) |
void | detach () |
bool | isAttached () |
void | addThreadContext (ThreadContext *_tc) |
void | replaceThreadContext (ThreadContext *_tc) |
bool | selectThreadContext (ContextID id) |
bool | trap (ContextID id, int type) |
Static Public Member Functions | |
template<class GDBStub , class ... Args> | |
static BaseRemoteGDB * | build (Args... args) |
Protected Member Functions | |
ThreadContext * | context () |
System * | system () |
void | encodeBinaryData (const std::string &unencoded, std::string &encoded) const |
void | encodeXferResponse (const std::string &unencoded, std::string &encoded, size_t offset, size_t unencoded_length) const |
virtual bool | checkBpLen (size_t len) |
virtual BaseGdbRegCache * | gdbRegs ()=0 |
virtual bool | acc (Addr addr, size_t len)=0 |
virtual std::vector< std::string > | availableFeatures () const |
virtual bool | getXferFeaturesRead (const std::string &annex, std::string &output) |
Get an XML target description. More... | |
Private Types | |
typedef SocketEvent<&BaseRemoteGDB::connectWrapper > | ConnectEvent |
typedef SocketEvent<&BaseRemoteGDB::incomingData > | DataEvent |
Private Member Functions | |
void | incomingData (int revent) |
void | connectWrapper (int revent) |
uint8_t | getbyte () |
void | putbyte (uint8_t b) |
void | recv (std::vector< char > &bp) |
void | send (const char *data) |
void | send (const std::string &data) |
template<typename ... Args> | |
void | send (const char *format, const Args &...args) |
bool | read (Addr addr, size_t size, char *data) |
bool | write (Addr addr, size_t size, const char *data) |
template<class T > | |
T | read (Addr addr) |
template<class T > | |
void | write (Addr addr, T data) |
void | singleStep () |
void | clearSingleStep () |
void | setSingleStep () |
void | scheduleInstCommitEvent (Event *ev, int delta) |
Schedule an event which will be triggered "delta" instructions later. More... | |
void | descheduleInstCommitEvent (Event *ev) |
Deschedule an instruction count based event. More... | |
void | insertSoftBreak (Addr addr, size_t len) |
void | removeSoftBreak (Addr addr, size_t len) |
void | insertHardBreak (Addr addr, size_t len) |
void | removeHardBreak (Addr addr, size_t len) |
bool | cmdUnsupported (GdbCommand::Context &ctx) |
bool | cmdSignal (GdbCommand::Context &ctx) |
bool | cmdCont (GdbCommand::Context &ctx) |
bool | cmdAsyncCont (GdbCommand::Context &ctx) |
bool | cmdDetach (GdbCommand::Context &ctx) |
bool | cmdRegR (GdbCommand::Context &ctx) |
bool | cmdRegW (GdbCommand::Context &ctx) |
bool | cmdSetThread (GdbCommand::Context &ctx) |
bool | cmdMemR (GdbCommand::Context &ctx) |
bool | cmdMemW (GdbCommand::Context &ctx) |
bool | cmdQueryVar (GdbCommand::Context &ctx) |
bool | cmdStep (GdbCommand::Context &ctx) |
bool | cmdAsyncStep (GdbCommand::Context &ctx) |
bool | cmdClrHwBkpt (GdbCommand::Context &ctx) |
bool | cmdSetHwBkpt (GdbCommand::Context &ctx) |
bool | cmdDumpPageTable (GdbCommand::Context &ctx) |
void | queryC (QuerySetCommand::Context &ctx) |
void | querySupported (QuerySetCommand::Context &ctx) |
void | queryXfer (QuerySetCommand::Context &ctx) |
void | queryFThreadInfo (QuerySetCommand::Context &ctx) |
void | querySThreadInfo (QuerySetCommand::Context &ctx) |
Private Attributes | |
friend | ConnectEvent |
friend | DataEvent |
ConnectEvent * | connectEvent |
DataEvent * | dataEvent |
ListenSocket | listener |
int | _port |
int | fd |
bool | active = false |
bool | attached = false |
bool | threadSwitching = false |
System * | sys |
std::map< ContextID, ThreadContext * > | threads |
ThreadContext * | tc = nullptr |
BaseGdbRegCache * | regCachePtr = nullptr |
gem5::BaseRemoteGDB::TrapEvent | trapEvent |
EventWrapper< BaseRemoteGDB, &BaseRemoteGDB::singleStep > | singleStepEvent |
size_t | threadInfoIdx = 0 |
Static Private Attributes | |
static std::map< char, GdbCommand > | commandMap |
static std::map< std::string, QuerySetCommand > | queryMap |
Friends | |
class | HardBreakpoint |
Definition at line 48 of file remote_gdb.hh.
|
private |
Definition at line 210 of file remote_gdb.hh.
|
private |
Definition at line 211 of file remote_gdb.hh.
|
inlinevirtual |
Definition at line 57 of file remote_gdb.hh.
|
protectedpure virtual |
|
protectedvirtual |
Reimplemented in gem5::RiscvISA::RemoteGDB, gem5::ArmISA::RemoteGDB, gem5::PowerISA::RemoteGDB, and gem5::MipsISA::RemoteGDB.
Definition at line 1187 of file remote_gdb.cc.
Referenced by querySupported().
|
inline |
Definition at line 53 of file remote_gdb.hh.
|
inlinestatic |
Definition at line 180 of file remote_gdb.hh.
References gem5::getRemoteGDBPort(), and port().
|
protectedvirtual |
Reimplemented in gem5::RiscvISA::RemoteGDB, and gem5::X86ISA::RemoteGDB.
Definition at line 881 of file remote_gdb.cc.
Referenced by insertHardBreak(), insertSoftBreak(), removeHardBreak(), and removeSoftBreak().
|
private |
Definition at line 735 of file remote_gdb.cc.
References descheduleInstCommitEvent(), and singleStepEvent.
Referenced by cmdAsyncCont(), cmdCont(), and detach().
|
private |
Definition at line 915 of file remote_gdb.cc.
References clearSingleStep(), gem5::BaseRemoteGDB::GdbCommand::Context::data, gem5::MipsISA::p, gem5::ThreadContext::pcState(), and tc.
|
private |
Definition at line 1232 of file remote_gdb.cc.
References gem5::BaseRemoteGDB::GdbCommand::Context::data, gem5::MipsISA::p, gem5::ThreadContext::pcState(), setSingleStep(), and tc.
|
private |
Definition at line 1257 of file remote_gdb.cc.
References gem5::X86ISA::addr, gem5::BaseRemoteGDB::GdbCommand::Context::data, DPRINTF, gem5::ArmISA::len, gem5::MipsISA::p, removeHardBreak(), removeSoftBreak(), and send().
|
private |
Definition at line 903 of file remote_gdb.cc.
References clearSingleStep(), gem5::BaseRemoteGDB::GdbCommand::Context::data, gem5::BaseRemoteGDB::GdbCommand::Context::len, gem5::MipsISA::p, gem5::ThreadContext::pcState(), and tc.
|
private |
Definition at line 928 of file remote_gdb.cc.
References detach().
|
private |
Definition at line 1225 of file remote_gdb.cc.
References gem5::EmulationPageTable::externalize(), gem5::ThreadContext::getProcessPtr(), gem5::Process::pTable, send(), and tc.
|
private |
Definition at line 1000 of file remote_gdb.cc.
References acc(), gem5::X86ISA::addr, gem5::BaseRemoteGDB::GdbCommand::Context::data, gem5::ArmISA::len, gem5::MipsISA::p, read(), and send().
|
private |
Definition at line 1024 of file remote_gdb.cc.
References acc(), gem5::X86ISA::addr, gem5::BaseRemoteGDB::GdbCommand::Context::data, gem5::BaseRemoteGDB::GdbCommand::Context::len, gem5::ArmISA::len, gem5::MipsISA::p, send(), and write().
|
private |
Definition at line 1152 of file remote_gdb.cc.
References gem5::BaseRemoteGDB::QuerySetCommand::Context::args, gem5::BaseRemoteGDB::GdbCommand::Context::data, DPRINTF, gem5::BaseRemoteGDB::GdbCommand::Context::len, queryMap, and gem5::ArmISA::s.
|
private |
Definition at line 935 of file remote_gdb.cc.
References gem5::BaseGdbRegCache::data(), regCachePtr, send(), and gem5::BaseGdbRegCache::size().
|
private |
Definition at line 945 of file remote_gdb.cc.
References gem5::BaseGdbRegCache::data(), gem5::BaseRemoteGDB::GdbCommand::Context::data, gem5::MipsISA::p, regCachePtr, send(), gem5::BaseGdbRegCache::setRegs(), gem5::BaseGdbRegCache::size(), and tc.
|
private |
Definition at line 1290 of file remote_gdb.cc.
References gem5::X86ISA::addr, gem5::BaseRemoteGDB::GdbCommand::Context::data, DPRINTF, insertHardBreak(), insertSoftBreak(), gem5::ArmISA::len, gem5::MipsISA::p, and send().
|
private |
Definition at line 959 of file remote_gdb.cc.
References gem5::ThreadContext::contextId(), gem5::BaseRemoteGDB::GdbCommand::Context::data, gem5::BaseRemoteGDB::TrapEvent::id(), gem5::MipsISA::p, scheduleInstCommitEvent(), selectThreadContext(), send(), tc, threadSwitching, and trapEvent.
|
private |
Definition at line 896 of file remote_gdb.cc.
References send(), and gem5::BaseRemoteGDB::GdbCommand::Context::type.
|
private |
Definition at line 1245 of file remote_gdb.cc.
References gem5::BaseRemoteGDB::GdbCommand::Context::data, gem5::BaseRemoteGDB::GdbCommand::Context::len, gem5::MipsISA::p, gem5::ThreadContext::pcState(), setSingleStep(), and tc.
|
private |
Definition at line 887 of file remote_gdb.cc.
References gem5::BaseRemoteGDB::GdbCommand::Context::cmd, gem5::BaseRemoteGDB::GdbCommand::Context::data, DDUMP, DPRINTF, gem5::BaseRemoteGDB::GdbCommand::Context::len, and gem5::BaseRemoteGDB::GdbCommand::name.
|
inlineprivate |
Definition at line 194 of file remote_gdb.hh.
References connect().
|
inlineprotected |
Definition at line 372 of file remote_gdb.hh.
References tc.
Referenced by gem5::ArmISA::RemoteGDB::acc(), gem5::ArmISA::RemoteGDB::gdbRegs(), gem5::SparcISA::RemoteGDB::SPARCGdbRegCache::getRegs(), gem5::PowerISA::RemoteGDB::PowerGdbRegCache::getRegs(), gem5::ArmISA::RemoteGDB::AArch32GdbRegCache::getRegs(), gem5::X86ISA::RemoteGDB::X86GdbRegCache::getRegs(), gem5::SparcISA::RemoteGDB::SPARC64GdbRegCache::getRegs(), gem5::PowerISA::RemoteGDB::Power64GdbRegCache::getRegs(), gem5::ArmISA::RemoteGDB::AArch64GdbRegCache::getRegs(), gem5::RiscvISA::RemoteGDB::RiscvGdbRegCache::getRegs(), gem5::X86ISA::RemoteGDB::AMD64GdbRegCache::getRegs(), gem5::ArmISA::RemoteGDB::getXferFeaturesRead(), gem5::SparcISA::RemoteGDB::SPARCGdbRegCache::setRegs(), gem5::PowerISA::RemoteGDB::PowerGdbRegCache::setRegs(), gem5::ArmISA::RemoteGDB::AArch32GdbRegCache::setRegs(), gem5::X86ISA::RemoteGDB::X86GdbRegCache::setRegs(), gem5::SparcISA::RemoteGDB::SPARC64GdbRegCache::setRegs(), gem5::PowerISA::RemoteGDB::Power64GdbRegCache::setRegs(), gem5::ArmISA::RemoteGDB::AArch64GdbRegCache::setRegs(), gem5::RiscvISA::RemoteGDB::RiscvGdbRegCache::setRegs(), and gem5::X86ISA::RemoteGDB::AMD64GdbRegCache::setRegs().
|
private |
Deschedule an instruction count based event.
Definition at line 815 of file remote_gdb.cc.
References gem5::ThreadContext::descheduleInstCountEvent(), gem5::Event::scheduled(), and tc.
Referenced by clearSingleStep(), and incomingData().
|
protected |
Definition at line 1200 of file remote_gdb.cc.
References gem5::ArmISA::c.
Referenced by encodeXferResponse().
|
protected |
Definition at line 1214 of file remote_gdb.cc.
References encodeBinaryData(), and gem5::ArmISA::offset.
Referenced by queryXfer().
|
protectedpure virtual |
|
private |
Definition at line 585 of file remote_gdb.cc.
References gem5::ArmISA::b, fd, and read().
|
protectedvirtual |
Get an XML target description.
[in] | annex | the XML filename |
[out] | output | set to the decoded XML |
Reimplemented in gem5::RiscvISA::RemoteGDB, gem5::ArmISA::RemoteGDB, gem5::PowerISA::RemoteGDB, and gem5::MipsISA::RemoteGDB.
Definition at line 1193 of file remote_gdb.cc.
Referenced by queryXfer().
|
private |
Definition at line 567 of file remote_gdb.cc.
References gem5::ThreadContext::contextId(), descheduleInstCommitEvent(), detach(), gem5::BaseRemoteGDB::TrapEvent::id(), gem5::Event::scheduled(), scheduleInstCommitEvent(), tc, trapEvent, gem5::BaseRemoteGDB::TrapEvent::type(), and warn.
|
private |
Definition at line 766 of file remote_gdb.cc.
References gem5::X86ISA::addr, checkBpLen(), DPRINTF, HardBreakpoint, gem5::ArmISA::len, gem5::HardBreakpoint::refcount, and sys.
Referenced by cmdSetHwBkpt(), and insertSoftBreak().
|
private |
Definition at line 748 of file remote_gdb.cc.
References gem5::X86ISA::addr, checkBpLen(), insertHardBreak(), and gem5::ArmISA::len.
Referenced by cmdSetHwBkpt().
|
private |
Definition at line 595 of file remote_gdb.cc.
References gem5::ArmISA::b, fd, and write().
|
private |
Definition at line 1072 of file remote_gdb.cc.
References gem5::ThreadContext::contextId(), send(), and tc.
|
private |
Definition at line 1132 of file remote_gdb.cc.
References querySThreadInfo(), and threadInfoIdx.
|
private |
Definition at line 1139 of file remote_gdb.cc.
References send(), threadInfoIdx, and threads.
Referenced by queryFThreadInfo().
|
private |
Definition at line 1078 of file remote_gdb.cc.
References availableFeatures(), and send().
|
private |
Definition at line 1091 of file remote_gdb.cc.
References gem5::BaseRemoteGDB::QuerySetCommand::Context::args, encodeXferResponse(), getXferFeaturesRead(), gem5::ArmISA::offset, and send().
|
inlineprivate |
Definition at line 403 of file remote_gdb.hh.
References gem5::X86ISA::addr, and read().
|
private |
Definition at line 686 of file remote_gdb.cc.
References data, DPRINTF, DPRINTFNR, gem5::ThreadContext::getVirtProxy(), gem5::PortProxy::readBlob(), tc, and gem5::MipsISA::vaddr.
|
private |
Definition at line 605 of file remote_gdb.cc.
References gem5::ArmISA::c, DPRINTF, gem5::GDBBadP, gem5::GDBEnd, gem5::GDBGoodP, gem5::GDBStart, getbyte(), and putbyte().
|
private |
Definition at line 781 of file remote_gdb.cc.
References gem5::X86ISA::addr, checkBpLen(), DPRINTF, gem5::ArmISA::i, gem5::ArmISA::len, and gem5::HardBreakpoint::refcount.
Referenced by cmdClrHwBkpt(), and removeSoftBreak().
|
private |
Definition at line 757 of file remote_gdb.cc.
References gem5::X86ISA::addr, checkBpLen(), gem5::ArmISA::len, and removeHardBreak().
Referenced by cmdClrHwBkpt().
|
inline |
Definition at line 54 of file remote_gdb.hh.
Referenced by gem5::Workload::replaceThreadContext().
|
private |
Schedule an event which will be triggered "delta" instructions later.
Definition at line 800 of file remote_gdb.cc.
References gem5::ThreadContext::Active, gem5::ThreadContext::getCurrentInstCount(), gem5::Event::process(), gem5::ThreadContext::scheduleInstCountEvent(), gem5::ThreadContext::status(), and tc.
Referenced by cmdSetThread(), incomingData(), setSingleStep(), and singleStep().
|
private |
Definition at line 657 of file remote_gdb.cc.
References gem5::ArmISA::c, DPRINTF, gem5::GDBBadP, gem5::GDBEnd, gem5::GDBStart, getbyte(), gem5::MipsISA::p, and putbyte().
Referenced by cmdClrHwBkpt(), cmdDumpPageTable(), cmdMemR(), cmdMemW(), cmdRegR(), cmdRegW(), cmdSetHwBkpt(), cmdSetThread(), cmdSignal(), queryC(), querySThreadInfo(), querySupported(), queryXfer(), and send().
|
inlineprivate |
Definition at line 235 of file remote_gdb.hh.
References gem5::csprintf(), gem5::ArmISA::format, and send().
|
inlineprivate |
|
private |
Definition at line 741 of file remote_gdb.cc.
References scheduleInstCommitEvent(), and singleStepEvent.
Referenced by cmdAsyncStep(), and cmdStep().
|
private |
Definition at line 727 of file remote_gdb.cc.
References gem5::ThreadContext::contextId(), scheduleInstCommitEvent(), singleStepEvent, tc, and trap().
|
inlineprotected |
Definition at line 373 of file remote_gdb.hh.
References sys.
|
inline |
Definition at line 55 of file remote_gdb.hh.
Referenced by gem5::HardBreakpoint::process(), gem5::BaseRemoteGDB::TrapEvent::process(), singleStep(), and gem5::Workload::trapToGdb().
|
private |
Definition at line 709 of file remote_gdb.cc.
References data, DPRINTFN, DPRINTFNR, gem5::ThreadContext::getVirtProxy(), tc, gem5::MipsISA::vaddr, and gem5::PortProxy::writeBlob().
|
inlineprivate |
Definition at line 412 of file remote_gdb.hh.
References gem5::X86ISA::addr, data, and write().
|
friend |
Definition at line 145 of file remote_gdb.hh.
Referenced by insertHardBreak().
|
private |
Definition at line 220 of file remote_gdb.hh.
|
private |
Definition at line 243 of file remote_gdb.hh.
Referenced by detach().
|
private |
Definition at line 244 of file remote_gdb.hh.
Referenced by attach(), detach(), and isAttached().
|
staticprivate |
Definition at line 321 of file remote_gdb.hh.
|
private |
Definition at line 213 of file remote_gdb.hh.
|
private |
Definition at line 216 of file remote_gdb.hh.
Referenced by listen().
|
private |
Definition at line 214 of file remote_gdb.hh.
|
private |
Definition at line 217 of file remote_gdb.hh.
|
private |
|
private |
Definition at line 219 of file remote_gdb.hh.
Referenced by addThreadContext(), connect(), listen(), and port().
|
staticprivate |
Definition at line 361 of file remote_gdb.hh.
Referenced by cmdQueryVar().
|
private |
Definition at line 252 of file remote_gdb.hh.
Referenced by cmdRegR(), cmdRegW(), and selectThreadContext().
|
private |
Definition at line 282 of file remote_gdb.hh.
Referenced by clearSingleStep(), setSingleStep(), and singleStep().
|
private |
Definition at line 247 of file remote_gdb.hh.
Referenced by insertHardBreak(), name(), and system().
|
private |
Definition at line 250 of file remote_gdb.hh.
Referenced by addThreadContext(), cmdAsyncCont(), cmdAsyncStep(), cmdCont(), cmdDumpPageTable(), cmdRegW(), cmdSetThread(), cmdStep(), context(), descheduleInstCommitEvent(), incomingData(), gem5::HardBreakpoint::process(), queryC(), read(), scheduleInstCommitEvent(), selectThreadContext(), singleStep(), and write().
|
private |
Definition at line 367 of file remote_gdb.hh.
Referenced by queryFThreadInfo(), and querySThreadInfo().
|
private |
Definition at line 249 of file remote_gdb.hh.
Referenced by addThreadContext(), querySThreadInfo(), and selectThreadContext().
|
private |
Definition at line 245 of file remote_gdb.hh.
Referenced by cmdSetThread().
|
private |
Referenced by cmdSetThread(), and incomingData().