From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlKDA-0007Wa-VN for qemu-devel@nongnu.org; Fri, 16 May 2014 11:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WlKD3-0000YY-5w for qemu-devel@nongnu.org; Fri, 16 May 2014 11:38:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlKD2-0000YD-V9 for qemu-devel@nongnu.org; Fri, 16 May 2014 11:38:09 -0400 Message-ID: <537630DB.2070500@redhat.com> Date: Fri, 16 May 2014 17:38:03 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <20140516090322.78f174a3@bahia.local> <20140516115158.301d8fc7@bahia.local> <5375F6D8.3080006@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] dump-guest-memory command? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Koi Cc: "qemu-devel@nongnu.org" , Greg Kurz On 05/16/14 15:01, Jun Koi wrote: > > > > On Fri, May 16, 2014 at 7:30 PM, Laszlo Ersek > wrote: > > On 05/16/14 11:59, Jun Koi wrote: > > > - is it true that dump-guest-memory just write down physical memory > > page, and does not consider the virtual-memory concept? > > No, it isn't. > > Basically, "dump-guest-memory" supports two modes of operation, "paging > enabled" and "paging disabled". > > Many (most?) people dump for the "crash" utility, which is super smart, > and extra paging info is not needed. For "crash" we just dump the > guest-phys memory ranges the way the guest sees them, and that's it; > "crash" figures out everything from that. > > If you want to use "gdb" rather than "crash", or need the guest-virtual > addresses in the ELF vmcore for some other reason, then you should > invoke "dump-guest-memory" with paging enabled. > > Enter "help dump-guest-memory" at the qemu monitor prompt, and look for > the "-p" option. > > > so i suppose this works for all kind of OS in guest VM, not only Linux > guest? far as I remember, it should; the virtual mappings "in effect" are searched starting from cr3: qmp_dump_guest_memory() [dump.c] dump_init() qemu_get_guest_memory_mapping() [memory_mapping.c] for (almost) all VCPUs: cpu_get_memory_mapping() [qom/cpu.c] x86_cpu_get_memory_mapping() [target-i386/arch_memory_mapping.c] check cr3, cr4; walk page tables etc There are some caveats / limitations: search "qapi-schema.json" for the string "dump-guest-memory", and read that section. Laszlo