summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorMichael Adler <Michael.Adler@intel.com>2008-07-23 14:41:33 -0700
committerMichael Adler <Michael.Adler@intel.com>2008-07-23 14:41:33 -0700
commit8c4f18f6f5e5dd9ccc4ef54590a11d70ba001264 (patch)
treea7d309a3269112993b84ca4d33dc8e7842906bfd /src/sim
parent9389ede894895999bf6cb20da64aa5b4c3a400b0 (diff)
downloadgem5-8c4f18f6f5e5dd9ccc4ef54590a11d70ba001264.tar.xz
RemoteGDB: add an m5 command line option for setting or disabling remote gdb.
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/debug.cc17
-rw-r--r--src/sim/debug.hh7
-rw-r--r--src/sim/process.cc13
-rw-r--r--src/sim/system.cc6
4 files changed, 36 insertions, 7 deletions
diff --git a/src/sim/debug.cc b/src/sim/debug.cc
index b4f4cd9dc..36ac4efac 100644
--- a/src/sim/debug.cc
+++ b/src/sim/debug.cc
@@ -108,3 +108,20 @@ eventqDump()
mainEventQueue.dump();
}
+
+int remote_gdb_base_port = 7000;
+
+int
+getRemoteGDBPort()
+{
+ return remote_gdb_base_port;
+}
+
+// Set remote GDB base port. 0 means disable remote GDB.
+// Callable from python.
+void
+setRemoteGDBPort(int port)
+{
+ remote_gdb_base_port = port;
+}
+
diff --git a/src/sim/debug.hh b/src/sim/debug.hh
index 79792234b..937864e69 100644
--- a/src/sim/debug.hh
+++ b/src/sim/debug.hh
@@ -31,6 +31,13 @@
#ifndef __DEBUG_HH__
#define __DEBUG_HH__
+#include "sim/host.hh"
+
+void schedBreakCycle(Tick when);
void debug_break();
+int getRemoteGDBPort();
+// Remote gdb base port. 0 disables remote gdb.
+void setRemoteGDBPort(int port);
+
#endif // __DEBUG_HH__
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 16037b2f4..046a6bf9b 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -46,6 +46,7 @@
#include "mem/translating_port.hh"
#include "params/Process.hh"
#include "params/LiveProcess.hh"
+#include "sim/debug.hh"
#include "sim/process.hh"
#include "sim/process_impl.hh"
#include "sim/stats.hh"
@@ -201,12 +202,14 @@ Process::registerThreadContext(ThreadContext *tc)
int myIndex = threadContexts.size();
threadContexts.push_back(tc);
- RemoteGDB *rgdb = new RemoteGDB(system, tc);
- GDBListener *gdbl = new GDBListener(rgdb, 7000 + myIndex);
- gdbl->listen();
- //gdbl->accept();
+ int port = getRemoteGDBPort();
+ if (port) {
+ RemoteGDB *rgdb = new RemoteGDB(system, tc);
+ GDBListener *gdbl = new GDBListener(rgdb, port + myIndex);
+ gdbl->listen();
- remoteGDB.push_back(rgdb);
+ remoteGDB.push_back(rgdb);
+ }
// return CPU number to caller
return myIndex;
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 10b9b1217..803881539 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -42,6 +42,7 @@
#include "mem/physical.hh"
#include "sim/byteswap.hh"
#include "sim/system.hh"
+#include "sim/debug.hh"
#if FULL_SYSTEM
#include "arch/vtophys.hh"
#include "kern/kernel_stats.hh"
@@ -183,9 +184,10 @@ System::registerThreadContext(ThreadContext *tc, int id)
threadContexts[id] = tc;
numcpus++;
- if (rgdb_enable) {
+ int port = getRemoteGDBPort();
+ if (rgdb_enable && port) {
RemoteGDB *rgdb = new RemoteGDB(this, tc);
- GDBListener *gdbl = new GDBListener(rgdb, 7000 + id);
+ GDBListener *gdbl = new GDBListener(rgdb, port + id);
gdbl->listen();
/**
* Uncommenting this line waits for a remote debugger to