From owner-freebsd-current@FreeBSD.ORG Mon Feb 23 21:03:05 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DAEF3106566B; Mon, 23 Feb 2009 21:03:05 +0000 (UTC) (envelope-from davidch@broadcom.com) Received: from mms1.broadcom.com (mms1.broadcom.com [216.31.210.17]) by mx1.freebsd.org (Postfix) with ESMTP id AF89C8FC1B; Mon, 23 Feb 2009 21:03:05 +0000 (UTC) (envelope-from davidch@broadcom.com) Received: from [10.9.200.133] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Mon, 23 Feb 2009 12:48:39 -0800 X-Server-Uuid: 02CED230-5797-4B57-9875-D5D2FEE4708A Received: from IRVEXCHCCR01.corp.ad.broadcom.com ([10.252.49.30]) by IRVEXCHHUB02.corp.ad.broadcom.com ([10.9.200.133]) with mapi; Mon, 23 Feb 2009 12:49:58 -0800 From: "David Christensen" To: "John Baldwin" , "Scott Long" Date: Mon, 23 Feb 2009 12:51:18 -0800 Thread-Topic: Hopefully Simple Question on Debugging Kernel Modules Thread-Index: AcmV4D6ZH7EIsmqTSvKOoZWQxOXxzQAGAR5w Message-ID: <5D267A3F22FD854F8F48B3D2B52381933950E91B04@IRVEXCHCCR01.corp.ad.broadcom.com> References: <5D267A3F22FD854F8F48B3D2B5238193394588D54D@IRVEXCHCCR01.corp.ad.broadcom.com> <200902231119.54925.jhb@freebsd.org> <49A2D86F.1000509@samsco.org> <200902231257.28060.jhb@freebsd.org> In-Reply-To: <200902231257.28060.jhb@freebsd.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-WSS-ID: 65BDD42D1RW1947145-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Cc: "freebsd-current@freebsd.org" Subject: RE: Hopefully Simple Question on Debugging Kernel Modules X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Feb 2009 21:03:06 -0000 > > > Just use gdb on bce.ko (built with debug symbols): > > > > > > gdb /path/to/if_bce.ko > > > (gdb) l *bce_intr+0x8df > > > > > > If you get a crashdump you can run kgdb on it and just walk up to > the > relevant > > > stack frame and use 'l' there to get a listing. > > > > > > > One thing that I've never figured out is how debugging symbols are > > handled in module builds these days. If I go to /sys/modules/bce and > > do 'make', it generates a .ko and explicitly strips it. I wind up > > having to re-run the link command by hand so I get symbols. What is > > the correct way to do this? Note that I'm not interested in answers > > that involve "go to /usr/src and run make buildkernel" =3D-) >=20 > make DEBUG_FLAGS=3D-g is what I use. The same thing works for userland > tools > and the kernel (usually we put 'makeoptions DEBUG_FLAGS=3D-g' in a kernel > config so it is "automatic" for kernels though). So is the use of COPTS=3D-g mentioned in the Developer's Handbook (http://www.freebsd.org/doc/en/books/developers-handbook/kerneldebug-kld.ht= ml) deprecated? I wasn't able to build with symbols until I used DEBUG_FLAGS= =3D'g. Dave