Hi, This is a small patch to gdbstub rather insignificant at first sight: fix null pointer dereference. It actually allows to take benefit of gdb features (breakpoints/sstep) internally (ie. special purpose board) without connecting a gdb client to the Qemu instance gdbserver stub.
Regards, Signed-off-by: Stephane Duverger <stephane.duver...@gmail.com> --- gdbstub.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gdbstub.c b/gdbstub.c index d6ab95006c..788fd625ab 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1412,6 +1412,9 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) void gdb_set_stop_cpu(CPUState *cpu) { + if (!gdbserver_state) { + return; + } gdbserver_state->c_cpu = cpu; gdbserver_state->g_cpu = cpu; } -- 2.14.1