From owner-freebsd-amd64@FreeBSD.ORG Thu May 1 15:57:46 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 CD47B1065677; Thu, 1 May 2008 15:57:46 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: from gwyn.kn-bremen.de (gwyn.kn-bremen.de [212.63.36.242]) by mx1.freebsd.org (Postfix) with ESMTP id 804C58FC19; Thu, 1 May 2008 15:57:46 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: by gwyn.kn-bremen.de (Postfix, from userid 10) id 4FCD42CB000; Thu, 1 May 2008 17:57:45 +0200 (CEST) Received: from saturn.kn-bremen.de (nox@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.14.2/8.13.8) with ESMTP id m41FTana003141; Thu, 1 May 2008 17:29:36 +0200 (CEST) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.14.2/8.13.6/Submit) id m41FTZUN003140; Thu, 1 May 2008 17:29:35 +0200 (CEST) (envelope-from nox) From: Juergen Lock Date: Thu, 1 May 2008 17:29:35 +0200 To: John Baldwin Message-ID: <20080501152935.GA2940@saturn.kn-bremen.de> Mail-Followup-To: John Baldwin , freebsd-amd64@freebsd.org, grog@freebsd.org References: <20080501105138.GA30798@saturn.kn-bremen.de> <200805011014.34348.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200805011014.34348.jhb@freebsd.org> User-Agent: Mutt/1.5.16 (2007-06-09) X-Mailman-Approved-At: Thu, 01 May 2008 16:07:59 +0000 Cc: freebsd-amd64@freebsd.org 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 15:57:46 -0000 On Thu, May 01, 2008 at 10:14:34AM -0400, John Baldwin wrote: > 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. > Ah cool! > > 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. > Ah, good to know for next time... > > 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. > OK, will try next time. :) Thanx, Juergen