}
}
+int
+GDBListener::getPort() const
+{
+ panic_if(!listener.islistening(),
+ "Remote GDB port is unknown until GDBListener::listen() has "
+ "been called.\n");
+
+ return port;
+}
+
BaseRemoteGDB::InputEvent::InputEvent(BaseRemoteGDB *g, int fd, int e)
: PollEvent(fd, e), gdb(g)
{}
void accept();
void listen();
std::string name();
+
+ int getPort() const;
};
#endif /* __REMOTE_GDB_H__ */
profile = Param.Latency('0ns', "trace the kernel stack")
do_quiesce = Param.Bool(True, "enable quiesce instructions")
+ wait_for_remote_gdb = Param.Bool(False,
+ "Wait for a remote GDB connection");
+
workload = VectorParam.Process([], "processes to run")
if buildEnv['TARGET_ISA'] == 'sparc':
functionEntryTick = curTick();
}
}
+
+bool
+BaseCPU::waitForRemoteGDB() const
+{
+ return params()->wait_for_remote_gdb;
+}
return &addressMonitor[tid];
}
+ bool waitForRemoteGDB() const;
+
Cycles syscallRetryLatency;
};
#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"
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)
{
GDBListener *gdbl = new GDBListener(rgdb, port + id);
gdbl->listen();
- if (rgdb_wait != -1 && rgdb_wait == id)
- gdbl->accept();
+ BaseCPU *cpu = tc->getCpuPtr();
+ if (cpu->waitForRemoteGDB()) {
+ inform("%s: Waiting for a remote GDB connection on port %d.\n",
+ cpu->name(), gdbl->getPort());
+ gdbl->accept();
+ }
if (remoteGDB.size() <= id) {
remoteGDB.resize(id + 1);
}