From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EEUIB-0005WJ-7j for qemu-devel@nongnu.org; Sun, 11 Sep 2005 12:02:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EEUI8-0005V4-9J for qemu-devel@nongnu.org; Sun, 11 Sep 2005 12:02:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EEUI8-0005ML-2o for qemu-devel@nongnu.org; Sun, 11 Sep 2005 12:02:52 -0400 Received: from [65.74.133.11] (helo=mail.codesourcery.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EETyk-0004U1-SA for qemu-devel@nongnu.org; Sun, 11 Sep 2005 11:42:51 -0400 From: Paul Brook Date: Sun, 11 Sep 2005 16:42:20 +0100 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_dBFJDUmGyNrzRB5" Message-Id: <200509111642.21213.paul@codesourcery.com> Subject: [Qemu-devel] [patch] User-mode gdbserver port number Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --Boundary-00=_dBFJDUmGyNrzRB5 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline The attached patch makes the qemu-user -g commandline option take a port number. There isn't a standard port number for running gdbserver, so a single hardcoded value doesn't make a great deal of sense, particularly on multiuser machines. Paul --Boundary-00=_dBFJDUmGyNrzRB5 Content-Type: text/x-diff; charset="us-ascii"; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch" Index: linux-user/main.c =================================================================== RCS file: /cvsroot/qemu/qemu/linux-user/main.c,v retrieving revision 1.70 diff -u -p -r1.70 main.c --- linux-user/main.c 24 Jul 2005 18:44:56 -0000 1.70 +++ linux-user/main.c 11 Sep 2005 15:31:17 -0000 @@ -978,7 +978,7 @@ void usage(void) "Linux CPU emulator (compiled for %s emulation)\n" "\n" "-h print this help\n" - "-g wait gdb connection to port %d\n" + "-g port wait gdb connection to port\n" "-L path set the elf interpreter prefix (default=%s)\n" "-s size set the stack size in bytes (default=%ld)\n" "\n" @@ -989,7 +989,6 @@ void usage(void) "-d options activate log (logfile=%s)\n" "-p pagesize set the host page size to 'pagesize'\n", TARGET_ARCH, - DEFAULT_GDBSTUB_PORT, interp_prefix, x86_stack_size, DEBUG_LOGFILE); @@ -1013,7 +1012,7 @@ int main(int argc, char **argv) CPUState *env; int optind; const char *r; - int use_gdbstub = 0; + int gdbstub_port = 0; if (argc <= 1) usage(); @@ -1068,7 +1067,7 @@ int main(int argc, char **argv) exit(1); } } else if (!strcmp(r, "g")) { - use_gdbstub = 1; + gdbstub_port = atoi(argv[optind++]); } else #ifdef USE_CODE_COPY if (!strcmp(r, "no-code-copy")) { @@ -1247,8 +1246,8 @@ int main(int argc, char **argv) #error unsupported target CPU #endif - if (use_gdbstub) { - gdbserver_start (DEFAULT_GDBSTUB_PORT); + if (gdbstub_port) { + gdbserver_start (gdbstub_port); gdb_handlesig(env, 0); } cpu_loop(env); --Boundary-00=_dBFJDUmGyNrzRB5--