From: Ramiro Polla <ramiro.po...@gmail.com>

Since the '!' packet is not handled by the new infrastructure,
gdb_handle_packet() would call run_cmd_parser() with a NULL cmd_parser
value, which would lead to an unsupported packet ("$#00") being sent,
which could confuse the gdb client.

This also has a side-effect of speeding up the initial connection with
gdb.

Fixes: 3e2c12615b52 ("gdbstub: Implement deatch (D pkt) with new infra")
Signed-off-by: Ramiro Polla <ramiro.po...@gmail.com>
Message-Id: <20190805190901.14072-1-ramiro.po...@gmail.com>
Signed-off-by: Alex Bennée <alex.ben...@linaro.org>

diff --git a/gdbstub.c b/gdbstub.c
index b92ba59e4df..5c067594bae 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2588,7 +2588,9 @@ static int gdb_handle_packet(GDBState *s, const char 
*line_buf)
         break;
     }
 
-    run_cmd_parser(s, line_buf, cmd_parser);
+    if (cmd_parser) {
+        run_cmd_parser(s, line_buf, cmd_parser);
+    }
 
     return RS_IDLE;
 }
-- 
2.20.1


Reply via email to