Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Sep 2001 01:50:46 -0500
From:      Mike Meyer <mwm@mired.org>
To:        Andrew J Caines <A.J.Caines@halplant.com>, kbstew99@hotmail.com, questions@freebsd.org
Subject:   Re: Tracking down libpng.so.4 package dependency
Message-ID:  <15285.28486.734884.618330@guru.mired.org>
In-Reply-To: <15285.24729.959309.725432@guru.mired.org>
References:  <15284.53157.808642.644254@guru.mired.org> <3BB4D224.99CA89CF@owt.com> <103067005@toto.iv> <20010929001552.V39250@hal9000.servehttp.com> <15285.24729.959309.725432@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Mike Meyer <mwm@mired.org> types:
> Andrew J Caines <A.J.Caines@halplant.com> types:
> > What a reall need is a treelike ldd output. From ldd(1)
> Yup. Patches welcome :-); it looks like more than a one-evening hack.

While a tree is hard, doing something that gives you the information
you want is pretty easy. Here's a patch to src/libexec/rtld-elf/rtld.c
that will do this. You need to invoke ldd in an sh-like shell as

	LD_TRACE_LOADED_OBJECTS_ALL=1 ldd <progname>

to get get enable this. I'll eventually PR this along with patches for
ldd to make it more usable.

	<mike

--- rtld.c-orig	Sat Sep 29 00:17:36 2001
+++ rtld.c	Sat Sep 29 01:32:21 2001
@@ -1956,7 +1956,7 @@
 static void
 trace_loaded_objects(Obj_Entry *obj)
 {
-    char	*fmt1, *fmt2, *fmt, *main_local;
+    char	*fmt1, *fmt2, *fmt, *main_local, *list_containers;
     int		c;
 
     if ((main_local = getenv("LD_TRACE_LOADED_OBJECTS_PROGNAME")) == NULL)
@@ -1968,14 +1968,17 @@
     if ((fmt2 = getenv("LD_TRACE_LOADED_OBJECTS_FMT2")) == NULL)
 	fmt2 = "\t%o (%x)\n";
 
+    list_containers = getenv("LD_TRACE_LOADED_OBJECTS_ALL");
+
     for (; obj; obj = obj->next) {
 	Needed_Entry		*needed;
 	char			*name, *path;
 	bool			is_lib;
 
+	if (list_containers) printf("%s:\n", obj->path);
 	for (needed = obj->needed; needed; needed = needed->next) {
 	    if (needed->obj != NULL) {
-		if (needed->obj->traced)
+		if (needed->obj->traced && !list_containers)
 		    continue;
 		needed->obj->traced = true;
 		path = needed->obj->path;


--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Q: How do you make the gods laugh?		A: Tell them your plans.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15285.28486.734884.618330>