Gabe Black has submitted this change. (
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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44613
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/base/remote_gdb.cc
M src/base/remote_gdb.hh
2 files changed, 13 insertions(+), 4 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 589e144..0592b77 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);
}
@@ -503,6 +502,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);
@@ -971,6 +974,11 @@
if (!any && tid != tc->contextId()) {
if (!selectThreadContext(tid))
throw CmdError("E04");
+ // Line up on an instruction boundary in the new thread.
+ threadSwitching = true;
+ trapEvent.id(tid);
+ scheduleInstCommitEvent(&trapEvent, 0);
+ return false;
}
} else {
throw CmdError("E05");
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index bfaaddf..231ca62 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: 8
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s