From owner-freebsd-current@FreeBSD.ORG Mon Feb 23 20:51:14 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 31A7B1065676; Mon, 23 Feb 2009 20:51:14 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id D5BA88FC1A; Mon, 23 Feb 2009 20:51:13 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local ([192.168.254.200]) (authenticated bits=0) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id n1NKp8Oc033942; Mon, 23 Feb 2009 13:51:08 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <49A30C3C.1040005@samsco.org> Date: Mon, 23 Feb 2009 13:51:08 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: David Christensen References: <5D267A3F22FD854F8F48B3D2B5238193394588D54D@IRVEXCHCCR01.corp.ad.broadcom.com> <200902231119.54925.jhb@freebsd.org> <49A2D86F.1000509@samsco.org> <200902231257.28060.jhb@freebsd.org> <5D267A3F22FD854F8F48B3D2B52381933950E91B04@IRVEXCHCCR01.corp.ad.broadcom.com> In-Reply-To: <5D267A3F22FD854F8F48B3D2B52381933950E91B04@IRVEXCHCCR01.corp.ad.broadcom.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org 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 20:51:14 -0000 David Christensen wrote: >>>> 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" =-) >> make DEBUG_FLAGS=-g is what I use. The same thing works for userland >> tools >> and the kernel (usually we put 'makeoptions DEBUG_FLAGS=-g' in a kernel >> config so it is "automatic" for kernels though). > > So is the use of COPTS=-g mentioned in the Developer's Handbook > (http://www.freebsd.org/doc/en/books/developers-handbook/kerneldebug-kld.html) > deprecated? I wasn't able to build with symbols until I used DEBUG_FLAGS='g. > Yes, it appears that the developers handbook is several years out of date. Scott