From owner-freebsd-current Tue Sep 7 22:12:36 1999 Delivered-To: freebsd-current@freebsd.org Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (Postfix) with ESMTP id 34B71156B0 for ; Tue, 7 Sep 1999 22:12:33 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.3/8.9.1) with ESMTP id WAA03817; Tue, 7 Sep 1999 22:12:06 -0700 (PDT) (envelope-from jdp@polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.9.3/8.9.1) id WAA06436; Tue, 7 Sep 1999 22:12:06 -0700 (PDT) (envelope-from jdp@polstra.com) Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <199909071620.KAA21936@mt.sri.com> Date: Tue, 07 Sep 1999 22:12:05 -0700 (PDT) Organization: Polstra & Co., Inc. From: John Polstra To: Nate Williams Subject: RE: java too? (was Re: Perl still broken in 4.0-CURRENT) Cc: current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG OK, sorry for the delay. Here's what I'd recommend for Java: 1. To determine whether the dynamic linker implements dladdr(): #define PATH_RTLD "/usr/libexec/ld-elf.so.1" if ((handle = dlopen(PATH_RTLD, RTLD_LAZY)) == NULL) err(1, "Can't dlopen %s: %s", PATH_RTLD, dlerror()); if (dlsym(handle, "dladdr") != NULL) printf("%s implements dladdr()\n", PATH_RTLD); else printf("%s doesn't implement dladdr()\n", PATH_RTLD); If the dynamic linker does implement dladdr() you can call it from your own dladdr() wrapper via the pointer returned from the dlsym call. Otherwise ... 2. If the dynamic linker doesn't implement dladdr(): #include struct r_debug r_debug; /* "handle" is the dlopen handle for the dynamic linker (see above) */ if ((r_debug = dlsym(handle, "r_debug")) == NULL) err(1, "Can't dlsym r_debug", dlerror()); See for the details of "r_debug". It contains a member "r_map" which is the head of a linked list of "link_map" structures. They contain (I think) all the information you need to implement dladdr's functionality. These data structures are safer to use because they're published interfaces that are used by GDB. Let me know if it seems like this won't do the job. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "No matter how cynical I get, I just can't keep up." -- Nora Ephron To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message