From 5af88677deb8606aef4c70833d1b5dc2aa1a3cd1 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Tue, 18 Aug 2020 20:59:10 +0000 Subject: [PATCH] gdb(4): Support empty qSupported queries Technically a client may send a qSupported query without specifying any client features. We should respond with our supported list in that case instead of bailing with error. Reported by: rlibby Reviewed by: emaste, rlibby, vangyzen Sponsored by: Isilon Differential Revision: https://reviews.freebsd.org/D26115 --- sys/gdb/gdb_main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c index 0944de14eff..e184928b044 100644 --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -204,8 +204,14 @@ gdb_do_qsupported(uint32_t *feat) /* Parse supported host features */ *feat = 0; - if (gdb_rx_char() != ':') + switch (gdb_rx_char()) { + case ':': + break; + case EOF: + goto nofeatures; + default: goto error; + } while (gdb_rxsz > 0) { tok = gdb_rxp; @@ -250,6 +256,7 @@ gdb_do_qsupported(uint32_t *feat) *feat |= BIT(i); } +nofeatures: /* Send a supported feature list back */ gdb_tx_begin(0); -- 2.45.0