From 8de9dfe03c29800eeb5da53b4666a864e42d1b97 Mon Sep 17 00:00:00 2001 Message-Id: <8de9dfe03c29800eeb5da53b4666a864e42d1b97.1349774431.git.minovotn@redhat.com> In-Reply-To: References: From: Luiz Capitulino Date: Fri, 5 Oct 2012 17:46:33 +0200 Subject: [PATCH 21/21] hmp: dump-guest-memory: hardcode protocol argument to "file:" RH-Author: Luiz Capitulino Message-id: <1349459193-18226-20-git-send-email-lcapitulino@redhat.com> Patchwork-id: 42767 O-Subject: [RHEL6.4 qemu-kvm PATCH 19/19] hmp: dump-guest-memory: hardcode protocol argument to "file:" Bugzilla: 832458 RH-Acked-by: Marcelo Tosatti RH-Acked-by: Markus Armbruster RH-Acked-by: Paolo Bonzini Today, it's necessary to specify the protocol you want to use when dumping the guest memory, for example: (qemu) dump-guest-memory file:/tmp/guest-memory This has a few issues: 1. It's cumbersome to type 2. We loose file path autocompletion 3. Being able to specify fd:X in HMP makes little sense for humans Because of these reasons, hardcode the 'protocol' argument to 'file:' in HMP. Signed-off-by: Luiz Capitulino Reviewed-by: Eric Blake Reviewed-by: Markus Armbruster (cherry picked from commit 753637695bcf6b80ea96614de5d31161603ad50f) Conflicts: hmp-commands.hx Signed-off-by: Luiz Capitulino --- hmp.c | 7 +++++-- qemu-monitor.hx | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) Signed-off-by: Michal Novotny --- hmp.c | 7 +++++-- qemu-monitor.hx | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hmp.c b/hmp.c index 7f1bcba..2cb59c2 100644 --- a/hmp.c +++ b/hmp.c @@ -90,11 +90,12 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) { Error *errp = NULL; int paging = qdict_get_try_bool(qdict, "paging", 0); - const char *file = qdict_get_str(qdict, "protocol"); + const char *file = qdict_get_str(qdict, "filename"); bool has_begin = qdict_haskey(qdict, "begin"); bool has_length = qdict_haskey(qdict, "length"); int64_t begin = 0; int64_t length = 0; + char *prot; if (has_begin) { begin = qdict_get_int(qdict, "begin"); @@ -103,7 +104,9 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict) length = qdict_get_int(qdict, "length"); } - qmp_dump_guest_memory(paging, file, has_begin, begin, has_length, length, + prot = g_strconcat("file:", file, NULL); + qmp_dump_guest_memory(paging, prot, has_begin, begin, has_length, length, &errp); hmp_handle_error(mon, &errp); + g_free(prot); } diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 90ab73b..112fc5c 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -1233,8 +1233,8 @@ EQMP #if defined(CONFIG_HAVE_CORE_DUMP) { .name = "dump-guest-memory", - .args_type = "paging:-p,protocol:s,begin:i?,length:i?", - .params = "[-p] protocol [begin] [length]", + .args_type = "paging:-p,filename:F,begin:i?,length:i?", + .params = "[-p] filename [begin] [length]", .help = "dump guest memory to file" "\n\t\t\t begin(optional): the starting physical address" "\n\t\t\t length(optional): the memory size, in bytes", @@ -1247,8 +1247,7 @@ STEXI @findex dump-guest-memory Dump guest memory to @var{protocol}. The file can be processed with crash or gdb. - protocol: destination file(started with "file:") or destination file - descriptor (started with "fd:") + filename: dump file name paging: do paging to get guest's memory mapping begin: the starting physical address. It's optional, and should be specified with length together. -- 1.7.11.4