aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-04-28 12:56:33 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-04-28 12:56:34 +0100
commit13de54eedd40a1b01fa7176dfb96d1c22c5cfa71 (patch)
tree6662ce703da44cec201298be591d4a263d027999 /hmp.c
parenta41b2c995b52b2ce26c171c52ac7dc11c7dccd99 (diff)
parent0b9f0e2fd7c5070fa06cd6bd5ec69055e3a7d2b1 (diff)
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp: monitor: fix qmp_getfd() fd leak in error case HMP: support specifying dump format for dump-guest-memory HMP: fix doc of dump-guest-memory qmp: object-add: Validate class before creating object monitor: Add device_add and device_del completion. monitor: Add command_completion callback to mon_cmd_t. monitor: Fix drive_del id argument type completion. error: Remove some unused headers qerror.h: Replace QERR_NOT_SUPPORTED with QERR_UNSUPPORTED qerror.h: Remove QERR defines that are only used once qerror.h: Remove unused error classes error: Print error_report() to stderr if using qmp monitor: Remove unused monitor_print_filename error: Privatize error_print_loc vnc: Remove default_mon usage slirp: Remove default_mon usage Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/hmp.c b/hmp.c
index 2f279c4ff2..ca869bafa8 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1308,16 +1308,35 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
{
Error *errp = NULL;
int paging = qdict_get_try_bool(qdict, "paging", 0);
+ int zlib = qdict_get_try_bool(qdict, "zlib", 0);
+ int lzo = qdict_get_try_bool(qdict, "lzo", 0);
+ int snappy = qdict_get_try_bool(qdict, "snappy", 0);
const char *file = qdict_get_str(qdict, "filename");
bool has_begin = qdict_haskey(qdict, "begin");
bool has_length = qdict_haskey(qdict, "length");
- /* kdump-compressed format is not supported for HMP */
- bool has_format = false;
int64_t begin = 0;
int64_t length = 0;
enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
char *prot;
+ if (zlib + lzo + snappy > 1) {
+ error_setg(&errp, "only one of '-z|-l|-s' can be set");
+ hmp_handle_error(mon, &errp);
+ return;
+ }
+
+ if (zlib) {
+ dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
+ }
+
+ if (lzo) {
+ dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
+ }
+
+ if (snappy) {
+ dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
+ }
+
if (has_begin) {
begin = qdict_get_int(qdict, "begin");
}
@@ -1328,7 +1347,7 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
prot = g_strconcat("file:", file, NULL);
qmp_dump_guest_memory(paging, prot, has_begin, begin, has_length, length,
- has_format, dump_format, &errp);
+ true, dump_format, &errp);
hmp_handle_error(mon, &errp);
g_free(prot);
}