From owner-freebsd-current@FreeBSD.ORG Mon Feb 23 20:17:30 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 A991D106566B; Mon, 23 Feb 2009 20:17:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 44F2C8FC0A; Mon, 23 Feb 2009 20:17:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id DAC3846B51; Mon, 23 Feb 2009 15:17:29 -0500 (EST) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n1NKHNhr018051; Mon, 23 Feb 2009 15:17:23 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Scott Long Date: Mon, 23 Feb 2009 14:17:07 -0500 User-Agent: KMail/1.9.7 References: <5D267A3F22FD854F8F48B3D2B5238193394588D54D@IRVEXCHCCR01.corp.ad.broadcom.com> <49A2F01E.4080409@FreeBSD.org> <49A2F13F.7060407@samsco.org> In-Reply-To: <49A2F13F.7060407@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200902231417.08537.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 23 Feb 2009 15:17:23 -0500 (EST) X-Virus-Scanned: ClamAV 0.94.2/9034/Mon Feb 23 12:41:23 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: David Christensen , Doug Barton , 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:17:31 -0000 On Monday 23 February 2009 1:55:59 pm Scott Long wrote: > Doug Barton wrote: > > Scott Long wrote: > >> Ah, I was still using 'CFLAGS+= -g". Thanks to you and Mr. Campbell for > >> the tip. > > > > IME in order to make sure I get debug symbols in everything (base and > > ports) I need to include both of these: > > > > CFLAGS+= -ggdb > > DEBUG_FLAGS+= -ggdb DEBUG_FLAGS alone should be sufficient. It is automatically added to CFLAGS when building things in bsd.*.mk. It also has the side effect of disabling strip if it is non-empty. > > BTW, I've always used -ggdb out of habit, is using just -g preferable > > for some reason? > > > > > > hope this I helps, > > > > Doug > > > > Never heard of -ggdb =-) One other tip is to compile with -O0 or > -fno_inline so that kdb doesn't get fooled by all of the foolish > auto-inlining that gcc wants to do. gdb is able to handle it, but > I still find it a good practice to do. gdb can choke on the inline stuff, too. Mostly it loses knowledge of function parameters and local variables for either the inlined routine or the calling routine (can't remember which) which is very annoying. I just use 'DEBUG_FLAGS="-g -fno-inline"' when I run into that. -- John Baldwin