Error reporting patches for 2016-02-19

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWxw72AAoJEDhwtADrkYZT4Y8P/jyMnI6Cp8HK/rRz1mK7SzxL
 66R4ut+ShuvLUGXq/OwSvm4zPewehY0QV2s6XjNd/RgscmC9EW5FMeKLN2WzvJm1
 CzBx4jK7LEGiSFjdUbP984Sx2Rqz9BK10Y7R/3t/f1JATL3OBPfn6nGwlW/8UYaO
 RzM9stpGsfJXi/vuDOkSk28k233co0b79N5FsIVXrDyhxxXQxK9gFpQgAbo2ZAC8
 g2/wAZTi6L056X66+aNDvOvCMjOtpeSFoZjtjcfB8Os9h2P1KpyW+0xsR1vbTdVH
 bPc+vSjN2KTdksKOBEhsbtmkbaDvrnEsX6fscMmUUyFbGpichtNvpd+E+9mQ9m/v
 /MlDdjQ2E7Fu62HHOAZRr4+lTFyNtISFZTS6OOQzZG63Vd/rxvou8VEYsygBCInP
 BW7pG70KX8mmRpUnZFPJ/OSSJwXAmi1Cx8GEsegB3DbY0MSZu3u+sJYI4JFBglwo
 Gaf42ouDsw/Z5XFlHEuqYAF4p0J2ytwUhGaHPPzlXlTsNOJUIi7UEGCndh812j+4
 Nq1+fIPeERR7pDnedR6K3cE9mZopUqlvS/2Kh2pfuXeIEVz7WLlpSYpYP+CGRc4r
 PiaS6fyBVRCMYVATrQRJ0/mRjSmJTRQYD9W+nSVvkWlD8nN5lGhbWMBaT+1QC0z5
 0RLkLvHQrsR8235kLwVu
 =15cD
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-02-19' into staging

Error reporting patches for 2016-02-19

# gpg: Signature made Fri 19 Feb 2016 12:47:50 GMT using RSA key ID EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>"
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>"

* remotes/armbru/tags/pull-error-2016-02-19:
  vl: Clean up machine selection in main().
  vl: Set error location when parsing memory options
  replay: Set error location properly when parsing options
  vl: Reset location after handling command-line arguments
  vl.c: Fix regression in machine error message

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2016-02-19 15:19:13 +00:00
commit 1b3337bb1d
2 changed files with 49 additions and 14 deletions

View File

@ -262,6 +262,14 @@ void replay_configure(QemuOpts *opts)
const char *fname;
const char *rr;
ReplayMode mode = REPLAY_MODE_NONE;
Location loc;
if (!opts) {
return;
}
loc_push_none(&loc);
qemu_opts_loc_restore(opts);
rr = qemu_opt_get(opts, "rr");
if (!rr) {
@ -283,6 +291,8 @@ void replay_configure(QemuOpts *opts)
}
replay_enable(fname, mode);
loc_pop(&loc);
}
void replay_start(void)

53
vl.c
View File

@ -2762,6 +2762,33 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
return popt;
}
static MachineClass *select_machine(void)
{
MachineClass *machine_class = find_default_machine();
const char *optarg;
QemuOpts *opts;
Location loc;
loc_push_none(&loc);
opts = qemu_get_machine_opts();
qemu_opts_loc_restore(opts);
optarg = qemu_opt_get(opts, "type");
if (optarg) {
machine_class = machine_parse(optarg);
}
if (!machine_class) {
error_report("No machine specified, and there is no default");
error_printf("Use -machine help to list supported machines\n");
exit(1);
}
loc_pop(&loc);
return machine_class;
}
static int machine_set_property(void *opaque,
const char *name, const char *value,
Error **errp)
@ -2838,6 +2865,10 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
const char *maxmem_str, *slots_str;
const ram_addr_t default_ram_size = mc->default_ram_size;
QemuOpts *opts = qemu_find_opts_singleton("memory");
Location loc;
loc_push_none(&loc);
qemu_opts_loc_restore(opts);
sz = 0;
mem_str = qemu_opt_get(opts, "size");
@ -2912,6 +2943,8 @@ static void set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
"'%s' option", slots_str ? "maxmem" : "slots");
exit(EXIT_FAILURE);
}
loc_pop(&loc);
}
int main(int argc, char **argv, char **envp)
@ -3000,7 +3033,6 @@ int main(int argc, char **argv, char **envp)
os_setup_early_signal_handling();
module_call_init(MODULE_INIT_MACHINE);
machine_class = find_default_machine();
cpu_model = NULL;
snapshot = 0;
cyls = heads = secs = 0;
@ -3983,25 +4015,18 @@ int main(int argc, char **argv, char **envp)
}
}
}
/*
* Clear error location left behind by the loop.
* Best done right after the loop. Do not insert code here!
*/
loc_set_none();
replay_configure(icount_opts);
opts = qemu_get_machine_opts();
optarg = qemu_opt_get(opts, "type");
if (optarg) {
machine_class = machine_parse(optarg);
}
if (machine_class == NULL) {
error_report("No machine specified, and there is no default");
error_printf("Use -machine help to list supported machines\n");
exit(1);
}
machine_class = select_machine();
set_memory_options(&ram_slots, &maxram_size, machine_class);
loc_set_none();
os_daemonize();
if (qemu_init_main_loop(&main_loop_err)) {