From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rnuud-0000fg-4y for qemu-devel@nongnu.org; Thu, 19 Jan 2012 11:32:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnuuX-0007Hl-1u for qemu-devel@nongnu.org; Thu, 19 Jan 2012 11:32:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22428) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnuuW-0007HR-RS for qemu-devel@nongnu.org; Thu, 19 Jan 2012 11:32:25 -0500 Message-ID: <4F18458B.50509@redhat.com> Date: Thu, 19 Jan 2012 09:32:11 -0700 From: Eric Blake MIME-Version: 1.0 References: <4F1784EE.2040800@cn.fujitsu.com> <4F1788DD.2040301@cn.fujitsu.com> In-Reply-To: <4F1788DD.2040301@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigED94C1D8766ED51A446DA4F8" Subject: Re: [Qemu-devel] [RFC][PATCH 09/15] introduce a new monitor command 'dump' to dump guest's memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang Cc: Jan Kiszka , HATAYAMA Daisuke , Dave Anderson , qemu-devel , Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigED94C1D8766ED51A446DA4F8 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 01/18/2012 08:07 PM, Wen Congyang wrote: > Signed-off-by: Wen Congyang > --- > Makefile.target | 8 +- > dump.c | 590 ++++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > dump.h | 3 + > hmp-commands.hx | 16 ++ > hmp.c | 9 + > hmp.h | 1 + > monitor.c | 3 + > qapi-schema.json | 13 ++ > qmp-commands.hx | 26 +++ > 9 files changed, 665 insertions(+), 4 deletions(-) > create mode 100644 dump.c >=20 > +void qmp_dump(const char *file, Error **errp) > +{ > + const char *p; > + int fd =3D -1; > + DumpState *s; > + > +#if !defined(WIN32) > + if (strstart(file, "fd:", &p)) { > + fd =3D qemu_get_fd(p); > + if (fd =3D=3D -1) { > + error_set(errp, QERR_FD_NOT_FOUND, p); > + return; > + } > + } > +#endif Thanks for implementing fd support off the bat. > + > + if (strstart(file, "file:", &p)) { > + fd =3D open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY); Use of O_CREAT requires that you pass a third argument to open() specifying the mode_t to use. > +++ b/hmp-commands.hx > @@ -828,6 +828,22 @@ new parameters (if specified) once the vm migratio= n finished successfully. > ETEXI > =20 > { > + .name =3D "dump", > + .args_type =3D "file:s", > + .params =3D "file", > + .help =3D "dump to file", > + .user_print =3D monitor_user_noop, > + .mhandler.cmd =3D hmp_dump, > + }, What if I want to dump only a fraction of the memory? I think you need optional start and length parameters, to limit how much memory to be dumped, rather than forcing me to dump all memory at once. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigED94C1D8766ED51A446DA4F8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPGEWLAAoJEKeha0olJ0Nqf3YIAJQii1vd8+ahumXDjLFY7kmU WC5kvAI/N133x9JTY2Ajxg/XN4vfkbxcygNUUPq8aHFMolP/OBf2q1HZnisUj5rJ MEMfGhrualtNpsh0Ah4YZmsV2XEI0KWcMJrj8mZlGNtRgOmIPzehgBKnHyGwiqXR bOrIdmFuPqTjrSsQtD4OrWa3OIVBD8ilsxuTj2djCA/GMT3zfDcJ0s4+rfGbRR5m 47+P9tVDJDhLO17jAOtWtIUraMN0HQBPt6RrXDmvhwN16h+v1OCupw2HHsKlm6gr uCuRwEw5q9cf0G2mSjB/yAcqHEpuS92R3Sc2DPkhQZbihSfeaA0R3GjrpSIhTjw= =95Ly -----END PGP SIGNATURE----- --------------enigED94C1D8766ED51A446DA4F8--