From f13155393df010665b468db5e2e64131a7b2c5da Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 20 Dec 2006 18:39:40 -0500 Subject: Initial work to make remote gdb available in SE mode. This is completely untested. --HG-- extra : convert_revision : 3ad9a3368961d5e9e71f702da84ffe293fe8adc8 --- src/SConscript | 2 +- src/arch/alpha/SConscript | 2 +- src/arch/alpha/system.cc | 6 ------ src/arch/alpha/system.hh | 2 -- src/arch/sparc/SConscript | 2 +- src/arch/sparc/system.cc | 6 ------ src/arch/sparc/system.hh | 2 -- src/base/remote_gdb.cc | 37 +++++++++++++++++++++++++++++-------- src/base/remote_gdb.hh | 5 +++++ src/cpu/simple/base.hh | 6 +++--- src/sim/system.cc | 17 ++++++----------- src/sim/system.hh | 6 ++---- 12 files changed, 48 insertions(+), 45 deletions(-) diff --git a/src/SConscript b/src/SConscript index f54e1de0d..5b90cdeae 100644 --- a/src/SConscript +++ b/src/SConscript @@ -62,6 +62,7 @@ base_sources = Split(''' base/pollevent.cc base/range.cc base/random.cc + base/remote_gdb.cc base/sat_counter.cc base/socket.cc base/statistics.cc @@ -171,7 +172,6 @@ mysql_sources = Split(''' full_system_sources = Split(''' base/crc.cc base/inet.cc - base/remote_gdb.cc cpu/intr_control.cc cpu/profile.cc diff --git a/src/arch/alpha/SConscript b/src/arch/alpha/SConscript index 3cc5ec270..addd49884 100644 --- a/src/arch/alpha/SConscript +++ b/src/arch/alpha/SConscript @@ -52,6 +52,7 @@ base_sources = Split(''' intregfile.cc miscregfile.cc regfile.cc + remote_gdb.cc ''') # Full-system sources @@ -66,7 +67,6 @@ full_system_sources = Split(''' osfpal.cc pagetable.cc stacktrace.cc - remote_gdb.cc system.cc tlb.cc tru64/system.cc diff --git a/src/arch/alpha/system.cc b/src/arch/alpha/system.cc index cd923948c..ed0938aeb 100644 --- a/src/arch/alpha/system.cc +++ b/src/arch/alpha/system.cc @@ -195,12 +195,6 @@ AlphaSystem::setAlphaAccess(Addr access) panic("could not find m5AlphaAccess\n"); } -bool -AlphaSystem::breakpoint() -{ - return remoteGDB[0]->trap(SIGTRAP); -} - void AlphaSystem::serialize(std::ostream &os) { diff --git a/src/arch/alpha/system.hh b/src/arch/alpha/system.hh index 0c073a68c..f92b71c9a 100644 --- a/src/arch/alpha/system.hh +++ b/src/arch/alpha/system.hh @@ -56,8 +56,6 @@ class AlphaSystem : public System ~AlphaSystem(); - virtual bool breakpoint(); - /** * Serialization stuff */ diff --git a/src/arch/sparc/SConscript b/src/arch/sparc/SConscript index c2ef97bfa..555bfba3d 100644 --- a/src/arch/sparc/SConscript +++ b/src/arch/sparc/SConscript @@ -50,12 +50,12 @@ base_sources = Split(''' intregfile.cc miscregfile.cc regfile.cc + remote_gdb.cc ''') # Full-system sources full_system_sources = Split(''' arguments.cc - remote_gdb.cc pagetable.cc stacktrace.cc system.cc diff --git a/src/arch/sparc/system.cc b/src/arch/sparc/system.cc index da83d86fc..2600213fd 100644 --- a/src/arch/sparc/system.cc +++ b/src/arch/sparc/system.cc @@ -191,12 +191,6 @@ SparcSystem::~SparcSystem() delete partition_desc; } -bool -SparcSystem::breakpoint() -{ - panic("Need to implement"); -} - void SparcSystem::serialize(std::ostream &os) { diff --git a/src/arch/sparc/system.hh b/src/arch/sparc/system.hh index c81b093e8..ac4d34279 100644 --- a/src/arch/sparc/system.hh +++ b/src/arch/sparc/system.hh @@ -68,8 +68,6 @@ class SparcSystem : public System ~SparcSystem(); - virtual bool breakpoint(); - /** * Serialization stuff */ diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc index 59a9b87d5..b1f50755b 100644 --- a/src/base/remote_gdb.cc +++ b/src/base/remote_gdb.cc @@ -121,16 +121,21 @@ #include #include +#include "config/full_system.hh" + +#if FULL_SYSTEM #include "arch/vtophys.hh" +#endif + #include "base/intmath.hh" #include "base/remote_gdb.hh" #include "base/socket.hh" #include "base/trace.hh" -#include "config/full_system.hh" #include "cpu/thread_context.hh" #include "cpu/static_inst.hh" -#include "mem/physical.hh" +//#include "mem/physical.hh" #include "mem/port.hh" +#include "mem/translating_port.hh" #include "sim/system.hh" using namespace std; @@ -448,9 +453,17 @@ BaseRemoteGDB::read(Addr vaddr, size_t size, char *data) DPRINTF(GDBRead, "read: addr=%#x, size=%d", vaddr, size); - VirtualPort *vp = context->getVirtPort(context); - vp->readBlob(vaddr, (uint8_t*)data, size); - context->delVirtPort(vp); +#if FULL_SYSTEM + VirtualPort *port = context->getVirtPort(context); +#else + TranslatingPort *port = context->getMemPort(); +#endif + port->readBlob(vaddr, (uint8_t*)data, size); +#if FULL_SYSTEM + context->delVirtPort(port); +#else + delete port; +#endif #if TRACING_ON if (DTRACE(GDBRead)) { @@ -487,9 +500,17 @@ BaseRemoteGDB::write(Addr vaddr, size_t size, const char *data) } else DPRINTFNR("\n"); } - VirtualPort *vp = context->getVirtPort(context); - vp->writeBlob(vaddr, (uint8_t*)data, size); - context->delVirtPort(vp); +#if FULL_SYSTEM + VirtualPort *port = context->getVirtPort(context); +#else + TranslatingPort *port = context->getMemPort(); +#endif + port->writeBlob(vaddr, (uint8_t*)data, size); +#if FULL_SYSTEM + context->delVirtPort(port); +#else + delete port; +#endif return true; } diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh index 9a3201c95..92e599585 100644 --- a/src/base/remote_gdb.hh +++ b/src/base/remote_gdb.hh @@ -32,6 +32,7 @@ #define __REMOTE_GDB_HH__ #include +#include #include "arch/types.hh" #include "cpu/pc_event.hh" @@ -177,6 +178,10 @@ class BaseRemoteGDB virtual bool acc(Addr addr, size_t len) = 0; bool trap(int type); + virtual bool breakpoint() + { + return trap(SIGTRAP); + } protected: virtual void getregs() = 0; diff --git a/src/cpu/simple/base.hh b/src/cpu/simple/base.hh index dd178f64d..294ebd69f 100644 --- a/src/cpu/simple/base.hh +++ b/src/cpu/simple/base.hh @@ -54,15 +54,15 @@ namespace TheISA } class MemObject; -class RemoteGDB; -class GDBListener; - #else class Process; #endif // FULL_SYSTEM +class RemoteGDB; +class GDBListener; + class ThreadContext; class Checkpoint; diff --git a/src/sim/system.cc b/src/sim/system.cc index b3ba1b8f1..f6febe4b1 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -32,6 +32,7 @@ */ #include "arch/isa_traits.hh" +#include "arch/remote_gdb.hh" #include "base/loader/object_file.hh" #include "base/loader/symtab.hh" #include "base/trace.hh" @@ -43,7 +44,6 @@ #include "sim/system.hh" #if FULL_SYSTEM #include "arch/vtophys.hh" -#include "arch/remote_gdb.hh" #include "kern/kernel_stats.hh" #endif @@ -141,14 +141,8 @@ System::~System() #endif // FULL_SYSTEM} } -#if FULL_SYSTEM - - int rgdb_wait = -1; -#endif // FULL_SYSTEM - - void System::setMemoryMode(MemoryMode mode) { @@ -156,6 +150,11 @@ System::setMemoryMode(MemoryMode mode) memoryMode = mode; } +bool System::breakpoint() +{ + return remoteGDB[0]->breakpoint(); +} + int System::registerThreadContext(ThreadContext *tc, int id) { @@ -175,7 +174,6 @@ System::registerThreadContext(ThreadContext *tc, int id) threadContexts[id] = tc; numcpus++; -#if FULL_SYSTEM RemoteGDB *rgdb = new RemoteGDB(this, tc); GDBListener *gdbl = new GDBListener(rgdb, 7000 + id); gdbl->listen(); @@ -191,7 +189,6 @@ System::registerThreadContext(ThreadContext *tc, int id) } remoteGDB[id] = rgdb; -#endif // FULL_SYSTEM return id; } @@ -213,9 +210,7 @@ System::replaceThreadContext(ThreadContext *tc, int id) } threadContexts[id] = tc; -#if FULL_SYSTEM remoteGDB[id]->replaceThreadContext(tc); -#endif // FULL_SYSTEM } #if !FULL_SYSTEM diff --git a/src/sim/system.hh b/src/sim/system.hh index b3a67bf7a..758da709e 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -55,12 +55,12 @@ class PhysicalMemory; #if FULL_SYSTEM class Platform; +#endif class GDBListener; namespace TheISA { class RemoteGDB; } -#endif class System : public SimObject { @@ -159,11 +159,9 @@ class System : public SimObject #endif public: -#if FULL_SYSTEM std::vector remoteGDB; std::vector gdbListen; - virtual bool breakpoint() = 0; -#endif // FULL_SYSTEM + bool breakpoint(); public: struct Params -- cgit v1.2.3