Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/44613 )
Change subject: base: When switching remote GDB threads, re-align on an
inst boundary.
......................................................................
base: When switching remote GDB threads, re-align on an inst boundary.
Change-Id: I199542d6e815f05b25a92d1c5ce0f6b5436dc16a
---
M src/base/remote_gdb.cc
M src/base/remote_gdb.hh
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 96b09be..69e28ee 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -351,8 +351,7 @@
BaseRemoteGDB::BaseRemoteGDB(System *_system, ThreadContext *c, int
_port) :
connectEvent(nullptr), dataEvent(nullptr), _port(_port), fd(-1),
- active(false), attached(false), sys(_system),
- trapEvent(this), singleStepEvent(*this)
+ sys(_system), trapEvent(this), singleStepEvent(*this)
{
addThreadContext(c);
}
@@ -498,6 +497,10 @@
*/
if (!active) {
active = true;
+ } else if (threadSwitching) {
+ threadSwitching = false;
+ // Tell GDB the thread switch has completed.
+ send("OK");
} else {
// Tell remote host that an exception has occurred.
send("S%02x", type);
@@ -965,6 +968,10 @@
if (!any && tid != tc->contextId()) {
if (!selectThreadContext(tid))
throw CmdError("E04");
+ // Line up on an instruction boundary in the new thread.
+ threadSwitching = true;
+ scheduleInstCommitEvent(&trapEvent, 0);
+ return false;
}
} else {
throw CmdError("E05");
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index 93a6026..3371a95 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -225,8 +225,9 @@
/*
* Simulator side debugger state.
*/
- bool active;
- bool attached;
+ bool active = false;
+ bool attached = false;
+ bool threadSwitching = false;
System *sys;
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44613
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: I199542d6e815f05b25a92d1c5ce0f6b5436dc16a
Gerrit-Change-Number: 44613
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s