]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
gdbstub/user: rename and use bool for running_state
authorAlex Bennée <alex.bennee@linaro.org>
Tue, 3 Feb 2026 11:52:01 +0000 (11:52 +0000)
committerAlex Bennée <alex.bennee@linaro.org>
Fri, 6 Feb 2026 12:43:07 +0000 (12:43 +0000)
This is just a clean-up to document what we using the running variable
for in user-mode.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260203115201.2387721-12-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
gdbstub/user.c

index a16f37616b1e624cc6d00c1a07786c9a83a2a669..97eb13e796a9169035d513b1376dce3f1925d7eb 100644 (file)
@@ -87,7 +87,11 @@ enum GDBForkMessage {
 typedef struct {
     int fd;
     char *socket_path;
-    int running_state;
+    /*
+     * running state of the guest, when we process a packet that restarts
+     * the guest we set this to true.
+     */
+    bool running;
     /*
      * Store syscalls mask without memory allocation in order to avoid
      * implementing synchronization.
@@ -241,8 +245,8 @@ int gdb_handlesig(CPUState *cpu, int sig, const char *reason, void *siginfo,
 
     sig = 0;
     gdbserver_state.state = RS_IDLE;
-    gdbserver_user_state.running_state = 0;
-    while (gdbserver_user_state.running_state == 0) {
+    gdbserver_user_state.running = false;
+    while (!gdbserver_user_state.running) {
         char buf[256];
         int n = read(gdbserver_user_state.fd, buf, 256);
         if (n > 0) {
@@ -611,11 +615,11 @@ void gdbserver_fork_end(CPUState *cpu, pid_t pid)
 
     gdbserver_state.state = RS_IDLE;
     gdbserver_state.allow_stop_reply = false;
-    gdbserver_user_state.running_state = 0;
+    gdbserver_user_state.running = false;
     for (;;) {
         switch (gdbserver_user_state.fork_state) {
         case GDB_FORK_ENABLED:
-            if (gdbserver_user_state.running_state) {
+            if (gdbserver_user_state.running) {
                 close(fd);
                 return;
             }
@@ -728,7 +732,7 @@ void gdb_handle_query_attached(GArray *params, void *user_ctx)
 
 void gdb_continue(void)
 {
-    gdbserver_user_state.running_state = 1;
+    gdbserver_user_state.running = true;
     trace_gdbstub_op_continue();
 }
 
@@ -750,7 +754,7 @@ int gdb_continue_partial(char *newstates)
             cpu_single_step(cpu, gdbserver_state.sstep_flags);
         }
     }
-    gdbserver_user_state.running_state = 1;
+    gdbserver_user_state.running = true;
     return res;
 }