Andreas Sandberg has uploaded this change for review. (
https://gem5-review.googlesource.com/3963
Change subject: cpu, sim: Add param to force CPUs to wait for GDB
......................................................................
cpu, sim: Add param to force CPUs to wait for GDB
By setting the BaseCPU parameter wait_for_dbg_connection, the GDB
server blocks during initialisation waiting for the remote debugger to
connect before starting the simulated CPU.
Change-Id: I4d62c68ce9adf69344bccbb44f66e30b33715a1c
Signed-off-by: Andreas Sandberg <andreas.sandb...@arm.com>
---
M src/cpu/BaseCPU.py
M src/cpu/base.cc
M src/cpu/base.hh
M src/sim/system.cc
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/cpu/BaseCPU.py b/src/cpu/BaseCPU.py
index 550ba62..da5bd66 100644
--- a/src/cpu/BaseCPU.py
+++ b/src/cpu/BaseCPU.py
@@ -151,6 +151,9 @@
profile = Param.Latency('0ns', "trace the kernel stack")
do_quiesce = Param.Bool(True, "enable quiesce instructions")
+ wait_for_dbg_connection = Param.Bool(False,
+ "Wait for a remote debugger connection");
+
workload = VectorParam.Process([], "processes to run")
if buildEnv['TARGET_ISA'] == 'sparc':
diff --git a/src/cpu/base.cc b/src/cpu/base.cc
index 6f460d3..020ba88 100644
--- a/src/cpu/base.cc
+++ b/src/cpu/base.cc
@@ -783,3 +783,9 @@
functionEntryTick = curTick();
}
}
+
+bool
+BaseCPU::waitForRemoteDebugger() const
+{
+ return params()->wait_for_dbg_connection;
+}
diff --git a/src/cpu/base.hh b/src/cpu/base.hh
index 14dfc26..b583e18 100644
--- a/src/cpu/base.hh
+++ b/src/cpu/base.hh
@@ -589,6 +589,8 @@
return &addressMonitor[tid];
}
+ bool waitForRemoteDebugger() const;
+
Cycles syscallRetryLatency;
};
diff --git a/src/sim/system.cc b/src/sim/system.cc
index e46c356..f3f0271 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -58,6 +58,7 @@
#include "cpu/kvm/base.hh"
#include "cpu/kvm/vm.hh"
#endif
+#include "cpu/base.hh"
#include "cpu/thread_context.hh"
#include "debug/Loader.hh"
#include "debug/WorkItems.hh"
@@ -221,13 +222,6 @@
return false;
}
-/**
- * Setting rgdb_wait to a positive integer waits for a remote debugger to
- * connect to that context ID before continuing. This should really
- be a parameter on the CPU object or something...
- */
-int rgdb_wait = -1;
-
ContextID
System::registerThreadContext(ThreadContext *tc, ContextID assigned)
{
@@ -259,9 +253,13 @@
GDBListener *gdbl = new GDBListener(rgdb, port + id);
gdbl->listen();
- if (rgdb_wait != -1 && rgdb_wait == id)
- gdbl->accept();
+ BaseCPU *cpu = tc->getCpuPtr();
+ if (cpu->waitForRemoteDebugger()) {
+ inform("Waiting for a remote GDB connection to CPU with
id %d\n",
+ tc->cpuId());
+ gdbl->accept();
+ }
if (remoteGDB.size() <= id) {
remoteGDB.resize(id + 1);
}
--
To view, visit https://gem5-review.googlesource.com/3963
To unsubscribe, visit https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d62c68ce9adf69344bccbb44f66e30b33715a1c
Gerrit-Change-Number: 3963
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <andreas.sandb...@arm.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev