dump-hmp-cmds.c (374f63f6810a2f99254cdf32af67035d951301c8) dump-hmp-cmds.c (187c614767cdb3407bc67acf77b9b1a0d985a39d)
1/*
2 * Human Monitor Interface commands
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7
8#include "qemu/osdep.h"

--- 18 unchanged lines hidden (view full) ---

27 int64_t begin = 0;
28 int64_t length = 0;
29 bool detach = false;
30 enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
31 char *prot;
32
33 if (zlib + lzo + snappy + win_dmp > 1) {
34 error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
1/*
2 * Human Monitor Interface commands
3 *
4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7
8#include "qemu/osdep.h"

--- 18 unchanged lines hidden (view full) ---

27 int64_t begin = 0;
28 int64_t length = 0;
29 bool detach = false;
30 enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
31 char *prot;
32
33 if (zlib + lzo + snappy + win_dmp > 1) {
34 error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
35 hmp_handle_error(mon, &err);
35 hmp_handle_error(mon, err);
36 return;
37 }
38
39 if (win_dmp) {
40 dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
41 }
42
43 if (zlib) {

--- 17 unchanged lines hidden (view full) ---

61 if (has_detach) {
62 detach = qdict_get_bool(qdict, "detach");
63 }
64
65 prot = g_strconcat("file:", file, NULL);
66
67 qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
68 has_length, length, true, dump_format, &err);
36 return;
37 }
38
39 if (win_dmp) {
40 dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
41 }
42
43 if (zlib) {

--- 17 unchanged lines hidden (view full) ---

61 if (has_detach) {
62 detach = qdict_get_bool(qdict, "detach");
63 }
64
65 prot = g_strconcat("file:", file, NULL);
66
67 qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
68 has_length, length, true, dump_format, &err);
69 hmp_handle_error(mon, &err);
69 hmp_handle_error(mon, err);
70 g_free(prot);
71}
72
73void hmp_info_dump(Monitor *mon, const QDict *qdict)
74{
75 DumpQueryResult *result = qmp_query_dump(NULL);
76
77 assert(result && result->status < DUMP_STATUS__MAX);
78 monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
79
80 if (result->status == DUMP_STATUS_ACTIVE) {
81 float percent = 0;
82 assert(result->total != 0);
83 percent = 100.0 * result->completed / result->total;
84 monitor_printf(mon, "Finished: %.2f %%\n", percent);
85 }
86
87 qapi_free_DumpQueryResult(result);
88}
70 g_free(prot);
71}
72
73void hmp_info_dump(Monitor *mon, const QDict *qdict)
74{
75 DumpQueryResult *result = qmp_query_dump(NULL);
76
77 assert(result && result->status < DUMP_STATUS__MAX);
78 monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
79
80 if (result->status == DUMP_STATUS_ACTIVE) {
81 float percent = 0;
82 assert(result->total != 0);
83 percent = 100.0 * result->completed / result->total;
84 monitor_printf(mon, "Finished: %.2f %%\n", percent);
85 }
86
87 qapi_free_DumpQueryResult(result);
88}