[2/3] rsp: add 'E' to escaped characters

Message ID 2a5a812b358bcf4b329971279cf1380281270fe2.1710343840.git.tankut.baris.aktemur@intel.com
State New
Headers
Series Introduce the 'x' RSP packet |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Aktemur, Tankut Baris March 13, 2024, 3:35 p.m. UTC
  Add 'E' to the list of escaped characters when sending/receiving
binary data.  This is a preparation for the next patch, to be able to
distinguish an error response from binary data that starts with 'E'.
---
 gdbsupport/rsp-low.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Tom Tromey March 13, 2024, 7:17 p.m. UTC | #1
>>>>> Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> writes:

> Add 'E' to the list of escaped characters when sending/receiving
> binary data.  This is a preparation for the next patch, to be able to
> distinguish an error response from binary data that starts with 'E'.

While this escaping isn't needed for vFile packets, I suppose it's also
not all that harmful -- just a slight increase in traffic.  So I tend to
think this is ok.

Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdbsupport/rsp-low.cc b/gdbsupport/rsp-low.cc
index 37dce9d5c74..0a11adc78e5 100644
--- a/gdbsupport/rsp-low.cc
+++ b/gdbsupport/rsp-low.cc
@@ -171,7 +171,7 @@  bin2hex (const gdb_byte *bin, int count)
 static int
 needs_escaping (gdb_byte b)
 {
-  return b == '$' || b == '#' || b == '}' || b == '*';
+  return b == '$' || b == '#' || b == '}' || b == '*' || b == 'E';
 }
 
 /* See rsp-low.h.  */