Skip to contentSkip to conversation

linux-user: Exit with an error if we couldn't set up gdbserver

PATCH New Peter Maydell 1 participant 1 message Sep 6, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Exit with an error if we couldn't set up gdbserver

If gdbserver_start() fails (usually because we couldn't bind to the requested TCP port) then exit qemu rather than blithely continuing. This brings the linux-user behaviour in to line with system mode.

---
 linux-user/main.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
linux-user/main.c +5 -1
index 89a51d7..7268997 100644
@@ -3568,7 +3568,11 @@ int main(int argc, char **argv, char **envp)
 #endif
 
     if (gdbstub_port) {
-        gdbserver_start (gdbstub_port);
+        if (gdbserver_start(gdbstub_port) < 0) {
+            fprintf(stderr, "qemu: could not open gdbserver on port %d\n",
+                    gdbstub_port);
+            exit(1);
+        }
         gdb_handlesig(env, 0);
     }
     cpu_loop(env);
Signature · 1 line
1.7.1