From owner-freebsd-amd64@FreeBSD.ORG Thu May 1 14:36:15 2008 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08AF31065676 for ; Thu, 1 May 2008 14:36:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id E70E48FC32 for ; Thu, 1 May 2008 14:36:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (unknown [208.65.91.234]) by elvis.mu.org (Postfix) with ESMTP id 6339A1A4D82; Thu, 1 May 2008 07:36:14 -0700 (PDT) From: John Baldwin To: freebsd-amd64@freebsd.org Date: Thu, 1 May 2008 10:14:34 -0400 User-Agent: KMail/1.9.7 References: <20080501105138.GA30798@saturn.kn-bremen.de> In-Reply-To: <20080501105138.GA30798@saturn.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200805011014.34348.jhb@freebsd.org> Cc: Juergen Lock Subject: Re: kernel/kld debugging on amd64 (qemu gdbstub, gdbinit, asf(1)...) X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 May 2008 14:36:15 -0000 On Thursday 01 May 2008 06:51:38 am Juergen Lock wrote: > Before I forget, here are some things I found out while debugging the > kqemu amd64 SMP issue... > > 1. I used a patched kgdb to be able to use it with qemu's gdbstub > (kgdb -r 127.1:1234 kernel.debug), that patch I already posted: > http://docs.freebsd.org/cgi/mid.cgi?20080304213153.GB15959 > (Yeah you can also used regular gdb or gdb66 from ports with qemu's > gdbstub, but those don't understand kernel stack frames and maybe > other things...) This patch just went into the tree (a variant of it) in the commits to kgdb in HEAD earlier this week. > 2. the ps and kldstat macros from src/tools/debugscripts/gdbinit.kernel > (and probably others) use %08x for pointers, so on 64 bit archs like amd64 > the upper half gets chopped off. I didn't fix this correctly tho, but > instead defined my own ps64 and kldstat64 macros using %016lx... Try using macros at www.freebsd.org/~jhb/gdb/gdb6 instead as they handle 64-bit vs 32-bit. > 3. asf(1) also didn't work correctly for amd64 (bss and data were wrong), > here is the patch I ended up using: (maybe you want to ifdef for amd64 > instead of checking for zero VMA tho) I haven't seen this, but I also haven't used asf(8) on amd64. You can grab the kgdb sources from HEAD though and then you can use kgdb's native kld support (i.e. add-kld and the shared library stuff) for remote targets to load symbols. -- John Baldwin