From owner-freebsd-hackers Fri Jan 9 14:58:42 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA22359 for hackers-outgoing; Fri, 9 Jan 1998 14:58:42 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp02.primenet.com (smtp02.primenet.com [206.165.6.132]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id OAA22350 for ; Fri, 9 Jan 1998 14:58:28 -0800 (PST) (envelope-from tlambert@usr04.primenet.com) Received: (from daemon@localhost) by smtp02.primenet.com (8.8.8/8.8.8) id PAA23568; Fri, 9 Jan 1998 15:57:45 -0700 (MST) Received: from usr04.primenet.com(206.165.6.204) via SMTP by smtp02.primenet.com, id smtpd023498; Fri Jan 9 15:57:36 1998 Received: (from tlambert@localhost) by usr04.primenet.com (8.8.5/8.8.5) id PAA00886; Fri, 9 Jan 1998 15:57:33 -0700 (MST) From: Terry Lambert Message-Id: <199801092257.PAA00886@usr04.primenet.com> Subject: Re: dladdr hax To: hasty@rah.star-gate.com (Amancio Hasty) Date: Fri, 9 Jan 1998 22:57:33 +0000 (GMT) Cc: dap@damon.com, hasty@rah.star-gate.com, freebsd-hackers@FreeBSD.ORG, nate@mt.sri.com, tlambert@primenet.com In-Reply-To: <199801082328.PAA04229@rah.star-gate.com> from "Amancio Hasty" at Jan 8, 98 03:28:24 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk > Well, the exec part is component the other is that dladdr is used > to locate where a library was loaded from. Again, for the command path > argv[0] clearly tells you where the command got executed from. Yes. This is pretty much never used, at least in java. The argv[0] is what is returned. The information is the information known to the crt0 and/or the ld.so.1 (Sun versions their ld.so becuase they are smarter than we are. 8-) 8-)). > If I am not mistaken the command execution portion should be also > in the U area or some clever location for the ps to be able to > display it. No kernel work is really needed. > My wild guess is that ld.so should keep an internal table of > start - end address plus path of library . The dladdr should > be a simple exercise to locate the address range where a variable > lies in. If we don't want to implement dladdr if the table > is accessible to the program we can do the library lookup 8) Yes. The actual thing it does is dlsym the address to get the symbol before the address. Actually, for multiple shared libraries, if there were no start/end symbols spanning the full library address space, it would "erroneously" report the last symbol of the previously contiguous address space (either the library before, or the program address space, or 0, if the page containing the address wasn't mapped). Heh. This is fun... Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.