From owner-freebsd-arch@freebsd.org Wed Aug 5 00:09:43 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47A3A9B3950 for ; Wed, 5 Aug 2015 00:09:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26432198B for ; Wed, 5 Aug 2015 00:09:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (75-48-78-19.lightspeed.cncrca.sbcglobal.net [75.48.78.19]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3A42FB926; Tue, 4 Aug 2015 20:09:42 -0400 (EDT) From: John Baldwin To: John-Mark Gurney Cc: 'freebsd-arch' Subject: Re: Supporting cross-debugging vmcores in libkvm Date: Tue, 04 Aug 2015 17:09:39 -0700 Message-ID: <2016463.jQeq4BdiyV@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20150804190058.GM78154@funkthat.com> References: <3121152.ujdxFEovO3@ralph.baldwin.cx> <20150804190058.GM78154@funkthat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 04 Aug 2015 20:09:42 -0400 (EDT) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2015 00:09:43 -0000 On Tuesday, August 04, 2015 12:00:59 PM John-Mark Gurney wrote: > John Baldwin wrote this message on Tue, Aug 04, 2015 at 10:56 -0700: > > Many debuggers (recent gdb and lldb) support cross-architecture debugging > > just fine. My current WIP port of kgdb to gdb7 supports cross-debugging for > > remote targets already, but I wanted it to also support cross-debugging for > > vmcores. > > Have you looked at the work the my GSoC student, Daniel Lovasko, is > doing: > https://wiki.freebsd.org/SummerOfCode2015/TypeAwareKernelVirtualMemoryAccess > > This uses libctf to completely abstract out the accessing of data > in libkvm so that it can be used w/ any arch as long as you have ctf > data... This means you could use netstat on amd64 on an armeb vmcore > w/o issues... > > It does look like some of this is still useful, but want to make sure > that we aren't reproducing tons of work... > > For example, he's working on procstat right now: > https://github.com/lovasko/taprocstat That doesn't seem to address the need of how you parse the actual vmcore file itself to resolve a virtual address to a location in the vmcore file. (e.g. on "plain" dumps on i386 this means walking the page tables whereas for minidumps it means parsing a special set of PTEs and bitmap at the start of the file). To be clear, all that my work enables is doing a kvm_read() of a foreign vmcore. All the logic to decide how many bytes to read and at what address (and then decoding those appropriately) happens in the debugger (gdb/lldb, etc.). The project here seems to be using CTF instead of dwarf to do the sort of things the debugger does when you 'p *foo', but you still need a way to find the 'foo' in the vmcore file. -- John Baldwin