From ecec88750729b2c94d5ca9dedbf7a755c46c41a7 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 16 Jan 2018 01:25:39 -0800 Subject: sim, arch, base: Refactor the base remote GDB class. Fold the GDBListener class into the main BaseRemoteGDB class, move around a bunch of functions, convert a lot of internal functions to be private, move some functions into the .cc, make some functions non-virtual which didn't really need to be overridden. Change-Id: Id0832b730b0fdfb2eababa5067e72c66de1c147d Reviewed-on: https://gem5-review.googlesource.com/7422 Reviewed-by: Jason Lowe-Power Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/arch/alpha/remote_gdb.cc | 39 ++++++++++----------------------------- src/arch/alpha/remote_gdb.hh | 11 ++++++----- 2 files changed, 16 insertions(+), 34 deletions(-) (limited to 'src/arch/alpha') diff --git a/src/arch/alpha/remote_gdb.cc b/src/arch/alpha/remote_gdb.cc index a9ec4cf89..f3eafc0fe 100644 --- a/src/arch/alpha/remote_gdb.cc +++ b/src/arch/alpha/remote_gdb.cc @@ -144,9 +144,11 @@ using namespace std; using namespace AlphaISA; -RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc) - : BaseRemoteGDB(_system, tc) +RemoteGDB::RemoteGDB(System *_system, ThreadContext *tc, int _port) + : BaseRemoteGDB(_system, tc, _port) { + warn_once("Breakpoints do not work in Alpha PAL mode.\n" + " See PCEventQueue::doService() in cpu/pc_event.cc.\n"); } /* @@ -165,7 +167,7 @@ RemoteGDB::acc(Addr va, size_t len) do { if (IsK0Seg(va)) { - if (va < (K0SegBase + system->memSize())) { + if (va < (K0SegBase + system()->memSize())) { DPRINTF(GDBAcc, "acc: Mapping is valid K0SEG <= " "%#x < K0SEG + size\n", va); return true; @@ -187,9 +189,9 @@ RemoteGDB::acc(Addr va, size_t len) if (PcPAL(va) || va < 0x10000) return true; - Addr ptbr = context->readMiscRegNoEffect(IPR_PALtemp20); + Addr ptbr = context()->readMiscRegNoEffect(IPR_PALtemp20); PageTableEntry pte = - kernel_pte_lookup(context->getPhysProxy(), ptbr, va); + kernel_pte_lookup(context()->getPhysProxy(), ptbr, va); if (!pte.valid()) { DPRINTF(GDBAcc, "acc: %#x pte is invalid\n", va); return false; @@ -247,31 +249,10 @@ RemoteGDB::AlphaGdbRegCache::setRegs(ThreadContext *context) const context->pcState(r.pc); } -// Write bytes to kernel address space for debugger. -bool -RemoteGDB::write(Addr vaddr, size_t size, const char *data) -{ - if (BaseRemoteGDB::write(vaddr, size, data)) { -#ifdef IMB - alpha_pal_imb(); -#endif - return true; - } else { - return false; - } -} - -void -RemoteGDB::insertHardBreak(Addr addr, size_t len) +BaseGdbRegCache* +RemoteGDB::gdbRegs() { - warn_once("Breakpoints do not work in Alpha PAL mode.\n" - " See PCEventQueue::doService() in cpu/pc_event.cc.\n"); - BaseRemoteGDB::insertHardBreak(addr, len); -} - -RemoteGDB::BaseGdbRegCache* -RemoteGDB::gdbRegs() { - return new AlphaGdbRegCache(this); + return new AlphaGdbRegCache(this); } diff --git a/src/arch/alpha/remote_gdb.hh b/src/arch/alpha/remote_gdb.hh index c8ed709f6..1e99b5fdc 100644 --- a/src/arch/alpha/remote_gdb.hh +++ b/src/arch/alpha/remote_gdb.hh @@ -51,9 +51,6 @@ class RemoteGDB : public BaseRemoteGDB protected: // Machine memory bool acc(Addr addr, size_t len) override; - bool write(Addr addr, size_t size, const char *data) override; - - void insertHardBreak(Addr addr, size_t len) override; class AlphaGdbRegCache : public BaseGdbRegCache { @@ -70,11 +67,15 @@ class RemoteGDB : public BaseRemoteGDB size_t size() const { return sizeof(r); } void getRegs(ThreadContext*); void setRegs(ThreadContext*) const; - const std::string name() const { return gdb->name() + ".AlphaGdbRegCache"; } + const std::string + name() const + { + return gdb->name() + ".AlphaGdbRegCache"; + } }; public: - RemoteGDB(System *system, ThreadContext *context); + RemoteGDB(System *system, ThreadContext *context, int _port); BaseGdbRegCache *gdbRegs() override; }; -- cgit v1.2.3