diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2020-09-30 14:55:54 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2020-09-30 14:55:54 +0000 |
commit | a91812f69fb2a959cb702c5571b1e9f22699181d (patch) | |
tree | 5d7697e8f6b518061520e234ca79b9f932a7ab1b | |
parent | d9bc41a1c2e8e39f642db9c8f2bad196512ec152 (diff) |
Notes
-rw-r--r-- | sys/gdb/gdb_main.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c index e184928b04453..70ffe0719c455 100644 --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -361,9 +361,7 @@ init_qXfer_ctx(struct qXfer_context *qx, uintmax_t len) } /* - * dst must be 2x strlen(max_src) + 1. - * - * Squashes invalid XML characters down to _. Sorry. Then escapes for GDB. + * Squashes special XML and GDB characters down to _. Sorry. */ static void qXfer_escape_xmlattr_str(char *dst, size_t dstlen, const char *src) @@ -384,8 +382,18 @@ qXfer_escape_xmlattr_str(char *dst, size_t dstlen, const char *src) /* GDB escape. */ if (strchr(forbidden, c) != NULL) { + /* + * It would be nice to escape these properly, but to do + * it correctly we need to escape them in the transmit + * layer, potentially doubling our buffer requirements. + * For now, avoid breaking the protocol by squashing + * them to underscore. + */ +#if 0 *dst++ = '}'; c ^= 0x20; +#endif + c = '_'; } *dst++ = c; } |