Jan Vrany has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/48182 )
Change subject: base: handle initial communication with GDB in `attach()`
......................................................................
base: handle initial communication with GDB in `attach()`
When remote GDB attaches to gem5, handle the initial communication
(`qSupported` and alike) right away instead of scheduling a `DataEvent`
and firing the simulation loop in hope that GDB will be quick enough to
send initial packets before instructions are dispatched.
This seems to fix the race described in 44612 [1]
[1]: https://gem5-review.googlesource.com/c/public/gem5/+/44612
Change-Id: I33b2922ba017205acabd51b6a8be3e6fb2d6409a
---
M src/base/remote_gdb.cc
M src/base/remote_gdb.hh
2 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 26aff5c..a6c569e 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -419,18 +419,19 @@
{
fd = f;
- dataEvent = new DataEvent(this, fd, POLLIN);
- pollQueue.schedule(dataEvent);
-
attached = true;
DPRINTFN("remote gdb attached\n");
+
+ processCommands();
+
+ dataEvent = new DataEvent(this, fd, POLLIN);
+ pollQueue.schedule(dataEvent);
}
void
BaseRemoteGDB::detach()
{
attached = false;
- active = false;
clearSingleStep();
close(fd);
fd = -1;
@@ -496,19 +497,7 @@
clearSingleStep();
- /*
- * The first entry to this function is normally through
- * a breakpoint trap in kgdb_connect(), in which case we
- * must advance past the breakpoint because gdb will not.
- *
- * On the first entry here, we expect that gdb is not yet
- * listening to us, so just enter the interaction loop.
- * After the debugger is "active" (connected) it will be
- * waiting for a "signaled" message from us.
- */
- if (!active) {
- active = true;
- } else if (threadSwitching) {
+ if (threadSwitching) {
threadSwitching = false;
// Tell GDB the thread switch has completed.
send("OK");
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index 6f57ae0..dbf3774 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -248,7 +248,6 @@
/*
* Simulator side debugger state.
*/
- bool active = false;
bool attached = false;
bool threadSwitching = false;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48182
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I33b2922ba017205acabd51b6a8be3e6fb2d6409a
Gerrit-Change-Number: 48182
Gerrit-PatchSet: 1
Gerrit-Owner: Jan Vrany <jan.vr...@labware.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s