From owner-freebsd-hackers Fri Jun 8 10:23:50 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from superconductor.rush.net (superconductor.rush.net [208.9.155.8]) by hub.freebsd.org (Postfix) with ESMTP id DFCAC37B401 for ; Fri, 8 Jun 2001 10:23:45 -0700 (PDT) (envelope-from bright@superconductor.rush.net) Received: (from bright@localhost) by superconductor.rush.net (8.11.2/8.11.2) id f58HNL024696; Fri, 8 Jun 2001 13:23:21 -0400 (EDT) Date: Fri, 8 Jun 2001 13:23:21 -0400 From: Alfred Perlstein To: Kevin Day Cc: Dan Nelson , hackers@FreeBSD.ORG Subject: Re: Access to symbol table(including dynamics) at runtime Message-ID: <20010608132320.F1832@superconductor.rush.net> References: <20010608121616.A23647@dan.emsphone.com> <200106081720.MAA43236@temphost.dragondata.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0us In-Reply-To: <200106081720.MAA43236@temphost.dragondata.com>; from toasty@temphost.dragondata.com on Fri, Jun 08, 2001 at 12:20:26PM -0500 X-all-your-base: are belong to us. Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Kevin Day [010608 13:21] wrote: > > > > In the last episode (Jun 08), Kevin Day said: > > > Is there a simple way that I can lookup a symbol name(by address) > > > during runtime? > > > > > > I know I can exec nm, look up for the address I need, and get local > > > symbols, but it would be really nice if I could get addresses of > > > functions in dynamic libraries as well. I know I could use ldd to get > > > offsets of each .so and calculate from there, but I'm starting to > > > think I'm reproducing work that was done somewhere else. > > > > > > If someone could point me at a man page to something that can do what > > > I need, tell me of a library that does something similar, or tell me > > > why this can't be done, i'd be very thankful. :) > > > > Would dladdr() do what you want? > > > AHH! YES! > > I'll buy a beer to the first person who adds dladdr(3) to the SEE ALSO > section of dlopen's man page. If you want to be able to see symbols in your main executable you _may_ need to also compile it with -export-dynamic or something like that. -- -Alfred Perlstein [alfred@freebsd.org] Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message