From owner-freebsd-hackers Thu Dec 19 4:23:50 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A65137B401 for ; Thu, 19 Dec 2002 04:23:48 -0800 (PST) Received: from ftp.translate.ru (ftp.translate.ru [195.131.4.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 295E543ED4 for ; Thu, 19 Dec 2002 04:23:42 -0800 (PST) (envelope-from lev@serebryakov.spb.ru) Received: from 127.0.0.1 (ftp.translate.ru [195.131.4.140]) (authenticated bits=0) by ftp.translate.ru (8.12.6/8.12.6) with ESMTP id gBJCMktT090423; Thu, 19 Dec 2002 15:22:46 +0300 (MSK) (envelope-from lev@serebryakov.spb.ru) Date: Thu, 19 Dec 2002 15:20:17 +0300 From: Lev Serebryakov X-Mailer: The Bat! (v1.53d) Reply-To: Lev Serebryakov X-Priority: 3 (Normal) Message-ID: <165246107764.20021219152017@serebryakov.spb.ru> To: Ferruccio Vitale , hackers@freebsd.org Subject: Re[2]: dlinfo() from sunOS, _DYNAMIC from Linux: did we have something like this? In-Reply-To: <20021219120240.48ac3416.freebsd@cs.tin.it> References: <45792625.20021218000337@serebryakov.spb.ru> <20021219120240.48ac3416.freebsd@cs.tin.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 Hello Ferruccio, Thursday, December 19, 2002, 2:02:40 PM, you wrote: >> Here is very good profiler (IMHO, better than `gcc -g' + `gprof'): >> FunctionCheck. But it need information about each module in program. >> It uses dlinfo() function on SunOS and _DYNAMIC variable on Linux to >> access all ELF symbol tables in loaded program. Did FreeBSD (4.x) >> have something like this? FV> try 'dladdr'. Unfortunately, it is not solution. Here is code, which uses dlinfo()/_DYNAMIC, and I could not understand, how could dladdr() be used here: /* try to find out about dynamically loaded objects */ #if HAVE_DECL__DYNAMIC == 1 dyn = _DYNAMIC; #else dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lm); #if HAVE_ELF32_DYN_ == 1 dyn = (Elf32_Dyn*)lm->l_ld; #elif HAVE_ELF64_DYN_ == 1 dyn = (Elf64_Dyn*)lm->l_ld; #else dyn = NULL; #endif #endif if (dyn != NULL) { for (; dyn->d_tag != DT_NULL; dyn++) { if (dyn->d_tag == DT_DEBUG) { rdb = (struct r_debug *)dyn->d_un.d_ptr; break; } } } -- Best regards, Lev mailto:lev@serebryakov.spb.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message