Quentin Forcioli has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/63529?usp=email )
(
8 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: base: adding support for O packet
......................................................................
base: adding support for O packet
O packet allow the GDB stub to send a message to display for the GDB
remote.
This function could be used to implement certains specific command
response.
Change-Id: I1c9a1ca956efcf19c93a8503d97c1fb27f555966
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63529
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, 57 insertions(+), 1 deletion(-)
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 6c8d272..4835f00 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -232,6 +232,39 @@
return -1;
}
+//convert a hex to a char
+char
+hex2c(char c0,char c1)
+{
+ char temp[3] = {c0,c1,'\0'};
+ return std::stoi(temp,0,16);
+}
+
+//this function will be used in a future patch
+//convert a encoded string to a string
+[[maybe_unused]] std::string
+hexS2string(std::string hex_in)
+{
+ std::string out="";
+ for (unsigned int i = 0; i + 1 < hex_in.length();i += 2){
+ out.push_back(hex2c(hex_in[i],hex_in[i+1]));
+ }
+ return out;
+}
+
+//convert a string to a hex encoded string
+std::string
+string2hexS(std::string in)
+{
+ std::string out = "";
+ for (auto ch : in){
+ char temp[3] = " ";
+ std::snprintf(temp,3,"%02hhx",ch);
+ out.append(temp);
+ }
+ return out;
+}
+
// Convert the low 4 bits of an integer into an hex digit.
char
i2digit(int n)
@@ -917,7 +950,10 @@
BaseRemoteGDB::sendSPacket(int errnum){
send("S%02x",errnum);
}
-
+void
+BaseRemoteGDB::sendOPacket(const std::string message){
+ send("O" + string2hexS(message));
+}
void
BaseRemoteGDB::scheduleInstCommitEvent(Event *ev, int delta)
{
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index 6f3cbe3..d51268a 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -324,6 +324,8 @@
void sendTPacket(int errnum, ContextID id,const std::string&
stopReason);
void sendSPacket(int errnum);
+ //The OPacket allow to send string to be displayed by the remote GDB
+ void sendOPacket(const std::string message);
/*
* GDB commands.
*/
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/63529?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: I1c9a1ca956efcf19c93a8503d97c1fb27f555966
Gerrit-Change-Number: 63529
Gerrit-PatchSet: 10
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