From owner-freebsd-net@FreeBSD.ORG Mon May 5 16:32:59 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72C79106564A for ; Mon, 5 May 2008 16:32:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from anti-4.kiev.sovam.com (anti-4.kiev.sovam.com [62.64.120.202]) by mx1.freebsd.org (Postfix) with ESMTP id 0C0218FC15 for ; Mon, 5 May 2008 16:32:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [212.82.216.226] (helo=skuns.kiev.zoral.com.ua) by anti-4.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1Jt3cW-0008uP-PW for freebsd-net@freebsd.org; Mon, 05 May 2008 19:32:57 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m45GWqeQ068970 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 May 2008 19:32:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m45GWnHQ013645; Mon, 5 May 2008 19:32:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.2/8.14.2/Submit) id m45GWn93013644; Mon, 5 May 2008 19:32:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 5 May 2008 19:32:49 +0300 From: Kostik Belousov To: David Christensen Message-ID: <20080505163249.GU18958@deviant.kiev.zoral.com.ua> References: <5D267A3F22FD854F8F48B3D2B523819324F09D65FA@IRVEXCHCCR01.corp.ad.broadcom.com> <3c0b01820805021315i482fe0acg3e9238a2f412770e@mail.gmail.com> <5D267A3F22FD854F8F48B3D2B523819324F09D6896@IRVEXCHCCR01.corp.ad.broadcom.com> <3c0b01820805030750k2fc389b0y500914c36069e6cf@mail.gmail.com> <5D267A3F22FD854F8F48B3D2B523819324F09D6A52@IRVEXCHCCR01.corp.ad.broadcom.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="so5AfiLIG9hb9aKM" Content-Disposition: inline In-Reply-To: <5D267A3F22FD854F8F48B3D2B523819324F09D6A52@IRVEXCHCCR01.corp.ad.broadcom.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on skuns.kiev.zoral.com.ua X-Scanner-Signature: b11a0dd960b728cbee92fea3b4ac1d10 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2780 [May 05 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release Cc: Alexander Sack , "freebsd-net@freebsd.org" Subject: Re: Not All Symbols Present in a Loadable Kernel Module X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 May 2008 16:32:59 -0000 --so5AfiLIG9hb9aKM Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 05, 2008 at 09:27:10AM -0700, David Christensen wrote: > > > Yes, I'm building a debug kernel. I have the line listed above as > > well > > > as the following: > > > > > > options KDB > > > options DDB > > > options GDB > > > options INVARIANTS > > > options INVARIANT_SUPPORT > > > options WITNESS > > > options WITNESS_SKIPSPIN > > > > Dave: > > > > What symbols can you not access exactly and how are you > > installing/setting up debugging? > > > > I just built a RELENG_7 with DDB and I'm able to access bce symbols > > without a problem. I can examine them and call them. I'm not using > > options GDB however, only KDB/DDB. > > > > I would: > > > > - Make sure you have the right if_bce.ko/if_bce.ko.symbols files > > generated/installed which contains the debug sections of your ko (from > > the objcopy calls during the build - the binary is stripped with a > > section pointer to the if_bce.ko.symbols file for debugging > > information I believe) > > - If you are using GDB, make sure its pointed to the right source base > > so it can retrieve symbol information correctly > > - If you are using GDB, stub it out and just use DDB to verify that > > your build is sane (it works for me!) > > - If all else fails, you can always build bce statically (just to move > > forward etc.) >=20 > - Enable the kernel debugger as described above > - Build the driver in the /usr/src/sys/modules/bce directory with the > command "make". > - Run the command "nm if_bce.ko | grep dump_stat" in the same directory > with the kernel module just built. >=20 > In my case I only see a symbol for bce_dump_status_block, but there is a > second routine called bce_dump_stats_block. In my working build there > are 23 functions that start with "bce_dump" but only 8 are displayed with > the command "nm if_bce.ko | grep bce_dump". Of course, I also get the > symbol not present error when I try to use any of those missing symbols > through a "call" command in the debugger. Most likely, they are optimized out, gcc likes to inline once-called static functions. Aside from playing with the optimization options, the easiest way seems to use functions somewhere else, e.g., put the addresses into some table. Just guessing. --so5AfiLIG9hb9aKM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkgfNrAACgkQC3+MBN1Mb4jvtACbB4Z0pjNk6umgyYCM6qFrc9Bh 6e8AoOt11f12NIIUCj4i4O4vVrALSl2l =RRrF -----END PGP SIGNATURE----- --so5AfiLIG9hb9aKM--