Initial work to make remote gdb available in SE mode. This is completely untested.
authorGabe Black <gblack@eecs.umich.edu>
Wed, 20 Dec 2006 23:39:40 +0000 (18:39 -0500)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 20 Dec 2006 23:39:40 +0000 (18:39 -0500)
--HG--
extra : convert_revision : 3ad9a3368961d5e9e71f702da84ffe293fe8adc8

12 files changed:
src/SConscript
src/arch/alpha/SConscript
src/arch/alpha/system.cc
src/arch/alpha/system.hh
src/arch/sparc/SConscript
src/arch/sparc/system.cc
src/arch/sparc/system.hh
src/base/remote_gdb.cc
src/base/remote_gdb.hh
src/cpu/simple/base.hh
src/sim/system.cc
src/sim/system.hh

index f54e1de0de14f4329cbf32df1c4907996a952e86..5b90cdeae507daa00667d4bf397bf2f11cabced9 100644 (file)
@@ -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
index 3cc5ec270a53fa18f8fa50b754e9850765aaa8b4..addd49884c8c732d759a4ba320ca5bc432553d39 100644 (file)
@@ -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
index cd923948cb77e9e4aad6be642ab708b5cf36473f..ed0938aeb34dd3af1115eda4c88c31fba43347f9 100644 (file)
@@ -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)
 {
index 0c073a68c00b377eb5ad50d965e50138098af16d..f92b71c9a0407b163fe4fec2209c3afb6e091c2c 100644 (file)
@@ -56,8 +56,6 @@ class AlphaSystem : public System
 
     ~AlphaSystem();
 
-    virtual bool breakpoint();
-
 /**
  * Serialization stuff
  */
index c2ef97bfa5e0f45a1a6c917e6d5ecf8956f93e41..555bfba3d2a349c2478595cdd9da6deb5c2b3748 100644 (file)
@@ -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
index da83d86fcc6f4949121b6a697b51781f3e87149e..2600213fd1213505cce2444b1f326c4e8eb5f7f8 100644 (file)
@@ -191,12 +191,6 @@ SparcSystem::~SparcSystem()
     delete partition_desc;
 }
 
-bool
-SparcSystem::breakpoint()
-{
-    panic("Need to implement");
-}
-
 void
 SparcSystem::serialize(std::ostream &os)
 {
index c81b093e8d45d31731ff2300dc2d18650534fc21..ac4d34279fdbd32f3ea60615e347f0316244e49d 100644 (file)
@@ -68,8 +68,6 @@ class SparcSystem : public System
 
     ~SparcSystem();
 
-    virtual bool breakpoint();
-
 /**
  * Serialization stuff
  */
index 59a9b87d5cfa583bb9fc621ea8372f1916bee9a7..b1f50755b0d2df95dc0d622b51328ac9d61a0e52 100644 (file)
 #include <string>
 #include <unistd.h>
 
+#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;
 }
index 9a3201c955472192d340cfdd6f2f87bcddd0e912..92e599585f3770211485bd92537c639142819395 100644 (file)
@@ -32,6 +32,7 @@
 #define __REMOTE_GDB_HH__
 
 #include <map>
+#include <sys/signal.h>
 
 #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;
index dd178f64d3795be259805c69938ad5d9fb0e9c35..294ebd69fb22586fd49c8d13d58fe739f7750834 100644 (file)
@@ -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;
 
index b3ba1b8f147069e94b55fe1ef7a22a1996713197..f6febe4b199bf7c126fd9ca41ab9d31184b6e8e9 100644 (file)
@@ -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
index b3a67bf7a74d8fbcd4f717896257de7d450f3344..758da709e9efe73cb68d9f872adea2bab391dbb8 100644 (file)
@@ -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<TheISA::RemoteGDB *> remoteGDB;
     std::vector<GDBListener *> gdbListen;
-    virtual bool breakpoint() = 0;
-#endif // FULL_SYSTEM
+    bool breakpoint();
 
   public:
     struct Params