mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-13 18:59:27 +00:00
gdbserver fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2393 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
84f2e8ef05
commit
c636bb66cc
14
gdbstub.c
14
gdbstub.c
@ -1234,4 +1234,18 @@ int gdbserver_start(CharDriverState *chr)
|
|||||||
qemu_add_vm_stop_handler(gdb_vm_stopped, s);
|
qemu_add_vm_stop_handler(gdb_vm_stopped, s);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int gdbserver_start_port(int port)
|
||||||
|
{
|
||||||
|
CharDriverState *chr;
|
||||||
|
char gdbstub_port_name[128];
|
||||||
|
|
||||||
|
snprintf(gdbstub_port_name, sizeof(gdbstub_port_name),
|
||||||
|
"tcp::%d,nowait,nodelay,server", port);
|
||||||
|
chr = qemu_chr_open(gdbstub_port_name);
|
||||||
|
if (!chr)
|
||||||
|
return -EIO;
|
||||||
|
return gdbserver_start(chr);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,6 +14,7 @@ void gdb_exit(CPUState *, int);
|
|||||||
int gdbserver_start(int);
|
int gdbserver_start(int);
|
||||||
#else
|
#else
|
||||||
int gdbserver_start(CharDriverState *chr);
|
int gdbserver_start(CharDriverState *chr);
|
||||||
|
int gdbserver_start_port(int port);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -423,7 +423,7 @@ static void do_gdbserver(int has_port, int port)
|
|||||||
{
|
{
|
||||||
if (!has_port)
|
if (!has_port)
|
||||||
port = DEFAULT_GDBSTUB_PORT;
|
port = DEFAULT_GDBSTUB_PORT;
|
||||||
if (gdbserver_start(port) < 0) {
|
if (gdbserver_start_port(port) < 0) {
|
||||||
qemu_printf("Could not open gdbserver socket on port %d\n", port);
|
qemu_printf("Could not open gdbserver socket on port %d\n", port);
|
||||||
} else {
|
} else {
|
||||||
qemu_printf("Waiting gdb connection on port %d\n", port);
|
qemu_printf("Waiting gdb connection on port %d\n", port);
|
||||||
|
23
vl.c
23
vl.c
@ -6499,8 +6499,7 @@ static BOOL WINAPI qemu_ctrl_handler(DWORD type)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_GDBSTUB
|
#ifdef CONFIG_GDBSTUB
|
||||||
int use_gdbstub;
|
int use_gdbstub, gdbstub_port;
|
||||||
char gdbstub_port_name[128];
|
|
||||||
#endif
|
#endif
|
||||||
int i, cdrom_index;
|
int i, cdrom_index;
|
||||||
int snapshot, linux_boot;
|
int snapshot, linux_boot;
|
||||||
@ -6568,7 +6567,7 @@ int main(int argc, char **argv)
|
|||||||
bios_size = BIOS_SIZE;
|
bios_size = BIOS_SIZE;
|
||||||
#ifdef CONFIG_GDBSTUB
|
#ifdef CONFIG_GDBSTUB
|
||||||
use_gdbstub = 0;
|
use_gdbstub = 0;
|
||||||
sprintf(gdbstub_port_name, "%d", DEFAULT_GDBSTUB_PORT);
|
gdbstub_port = DEFAULT_GDBSTUB_PORT;
|
||||||
#endif
|
#endif
|
||||||
snapshot = 0;
|
snapshot = 0;
|
||||||
nographic = 0;
|
nographic = 0;
|
||||||
@ -6812,7 +6811,7 @@ int main(int argc, char **argv)
|
|||||||
use_gdbstub = 1;
|
use_gdbstub = 1;
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_p:
|
case QEMU_OPTION_p:
|
||||||
pstrcpy(gdbstub_port_name, sizeof(gdbstub_port_name), optarg);
|
gdbstub_port = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case QEMU_OPTION_L:
|
case QEMU_OPTION_L:
|
||||||
@ -7220,19 +7219,13 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
#ifdef CONFIG_GDBSTUB
|
#ifdef CONFIG_GDBSTUB
|
||||||
if (use_gdbstub) {
|
if (use_gdbstub) {
|
||||||
CharDriverState *chr;
|
/* XXX: use standard host:port notation and modify options
|
||||||
int port;
|
accordingly. */
|
||||||
|
if (gdbserver_start_port(gdbstub_port) < 0) {
|
||||||
port = atoi(gdbstub_port_name);
|
fprintf(stderr, "qemu: could not open gdbstub device on port '%d'\n",
|
||||||
if (port != 0)
|
gdbstub_port);
|
||||||
sprintf(gdbstub_port_name, "tcp::%d,nowait,nodelay,server", port);
|
|
||||||
chr = qemu_chr_open(gdbstub_port_name);
|
|
||||||
if (!chr) {
|
|
||||||
fprintf(stderr, "qemu: could not open gdbstub device '%s'\n",
|
|
||||||
gdbstub_port_name);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
gdbserver_start(chr);
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (loadvm)
|
if (loadvm)
|
||||||
|
Loading…
Reference in New Issue
Block a user