提交 ef0c4a0d 编写于 作者: M Markus Armbruster 提交者: Anthony Liguori

gdbstub: Error locations for -gdb

Stash away the option argument with add_device_config(), so we still
have its location when we get around to parsing it.

This doesn't improve any messages I can see just yet, but that'll
change shortly.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 d9a5954d
...@@ -1857,6 +1857,7 @@ struct device_config { ...@@ -1857,6 +1857,7 @@ struct device_config {
DEV_PARALLEL, /* -parallel */ DEV_PARALLEL, /* -parallel */
DEV_VIRTCON, /* -virtioconsole */ DEV_VIRTCON, /* -virtioconsole */
DEV_DEBUGCON, /* -debugcon */ DEV_DEBUGCON, /* -debugcon */
DEV_GDB, /* -gdb, -s */
} type; } type;
const char *cmdline; const char *cmdline;
Location loc; Location loc;
...@@ -2182,7 +2183,6 @@ int qemu_init_main_loop(void) ...@@ -2182,7 +2183,6 @@ int qemu_init_main_loop(void)
int main(int argc, char **argv, char **envp) int main(int argc, char **argv, char **envp)
{ {
const char *gdbstub_dev = NULL;
int i; int i;
int snapshot, linux_boot; int snapshot, linux_boot;
const char *icount_option = NULL; const char *icount_option = NULL;
...@@ -2607,10 +2607,10 @@ int main(int argc, char **argv, char **envp) ...@@ -2607,10 +2607,10 @@ int main(int argc, char **argv, char **envp)
log_file = optarg; log_file = optarg;
break; break;
case QEMU_OPTION_s: case QEMU_OPTION_s:
gdbstub_dev = "tcp::" DEFAULT_GDBSTUB_PORT; add_device_config(DEV_GDB, "tcp::" DEFAULT_GDBSTUB_PORT);
break; break;
case QEMU_OPTION_gdb: case QEMU_OPTION_gdb:
gdbstub_dev = optarg; add_device_config(DEV_GDB, optarg);
break; break;
case QEMU_OPTION_L: case QEMU_OPTION_L:
data_dir = optarg; data_dir = optarg;
...@@ -3500,9 +3500,7 @@ int main(int argc, char **argv, char **envp) ...@@ -3500,9 +3500,7 @@ int main(int argc, char **argv, char **envp)
} }
text_consoles_set_display(ds); text_consoles_set_display(ds);
if (gdbstub_dev && gdbserver_start(gdbstub_dev) < 0) { if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
fprintf(stderr, "qemu: could not open gdbserver on device '%s'\n",
gdbstub_dev);
exit(1); exit(1);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册