Quentin Forcioli has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/63528?usp=email )
Change subject: base: Adding stop reason and T Packet to the GDB stub
......................................................................
base: Adding stop reason and T Packet to the GDB stub
The remote protocol describes 2 type of stop respond packet.
S packets (which are the one that where used before) and T packets.
T packet support multiple fields to give more information about:
- thread/core which stopped
- registers values
- A stopReason string that are predefined value and that can
differentiate between different types of break that would
issue the same signal.
Change-Id: Id8ed7115898bf825dd14395f586c393d6f5aa2bc
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63528
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
Reviewed-by: Bobby Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/base/remote_gdb.cc
M src/base/remote_gdb.hh
2 files changed, 49 insertions(+), 6 deletions(-)
Approvals:
kokoro: Regressions pass
Bobby Bruce: Looks good to me, approved; Looks good to me, approved
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 2cc8402..6c8d272 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -192,7 +192,7 @@
DPRINTF(GDBMisc, "handling hardware breakpoint at %#x\n", pc());
if (tc == gdb->tc)
- gdb->trap(tc->contextId(), SIGTRAP);
+ gdb->trap(tc->contextId(), SIGTRAP,"");
}
};
@@ -516,7 +516,7 @@
// makes sense to use POSIX errno values, because that is what the
// gdb/remote.c functions want to return.
void
-BaseRemoteGDB::trap(ContextID id, int signum)
+BaseRemoteGDB::trap(ContextID id, int signum,const std::string& stopReason)
{
if (!attached)
return;
@@ -536,7 +536,7 @@
send("OK");
} else {
// Tell remote host that an exception has occurred.
- send("S%02x", signum);
+ sendTPacket(signum,id,stopReason);
}
processCommands(signum);
@@ -904,6 +904,21 @@
}
void
+BaseRemoteGDB::sendTPacket(int errnum, ContextID id,
+ const std::string& stopReason)
+{
+ if (!stopReason.empty()){
+ send("T%02xcore:%x;thread:%x;%s;",errnum,id + 1,id + 1,stopReason);
+ }else{
+ send("T%02xcore:%x;thread:%x;",errnum,id + 1,id + 1);
+ }
+}
+void
+BaseRemoteGDB::sendSPacket(int errnum){
+ send("S%02x",errnum);
+}
+
+void
BaseRemoteGDB::scheduleInstCommitEvent(Event *ev, int delta)
{
if (delta == 0 && tc->status() != ThreadContext::Active) {
@@ -1004,7 +1019,7 @@
bool
BaseRemoteGDB::cmdSignal(GdbCommand::Context &ctx)
{
- send("S%02x", ctx.type);
+ sendTPacket(ctx.type,tc->contextId(),"");
return true;
}
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index d0c4781..6f3cbe3 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -171,7 +171,7 @@
void replaceThreadContext(ThreadContext *_tc);
bool selectThreadContext(ContextID id);
- void trap(ContextID id, int signum);
+ void trap(ContextID id, int signum,const std::string& stopReason="");
/** @} */ // end of api_remote_gdb
@@ -280,6 +280,7 @@
protected:
int _type;
ContextID _id;
+ std::string _stopReason;
BaseRemoteGDB *gdb;
public:
@@ -287,8 +288,9 @@
{}
void type(int t) { _type = t; }
+ void stopReason(std::string s) {_stopReason = s; }
void id(ContextID id) { _id = id; }
- void process() { gdb->trap(_id, _type); }
+ void process() { gdb->trap(_id, _type,_stopReason); }
} trapEvent;
/*
@@ -320,6 +322,8 @@
void insertHardBreak(Addr addr, size_t kind);
void removeHardBreak(Addr addr, size_t kind);
+ void sendTPacket(int errnum, ContextID id,const std::string&
stopReason);
+ void sendSPacket(int errnum);
/*
* GDB commands.
*/
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/63528?usp=email
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: Id8ed7115898bf825dd14395f586c393d6f5aa2bc
Gerrit-Change-Number: 63528
Gerrit-PatchSet: 9
Gerrit-Owner: Quentin Forcioli <quentin.forci...@telecom-paris.fr>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Quentin Forcioli <quentin.forci...@telecom-paris.fr>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org