aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index 3c2ce059d9..a1686ef6c4 100644
--- a/vl.c
+++ b/vl.c
@@ -2931,6 +2931,7 @@ int main(int argc, char **argv, char **envp)
1024 * 1024;
ram_addr_t maxram_size = default_ram_size;
uint64_t ram_slots = 0;
+ FILE *vmstate_dump_file = NULL;
atexit(qemu_run_exit_notifiers);
error_set_progname(argv[0]);
@@ -3937,6 +3938,13 @@ int main(int argc, char **argv, char **envp)
}
configure_msg(opts);
break;
+ case QEMU_OPTION_dump_vmstate:
+ vmstate_dump_file = fopen(optarg, "w");
+ if (vmstate_dump_file == NULL) {
+ fprintf(stderr, "open %s: %s\n", optarg, strerror(errno));
+ exit(1);
+ }
+ break;
default:
os_parse_cmd_args(popt->index, optarg);
}
@@ -4488,6 +4496,11 @@ int main(int argc, char **argv, char **envp)
}
qdev_prop_check_global();
+ if (vmstate_dump_file) {
+ /* dump and exit */
+ dump_vmstate_json_to_file(vmstate_dump_file);
+ return 0;
+ }
if (incoming) {
Error *local_err = NULL;