Blame SOURCES/ltrace-0.7.91-unwind-elfutils.patch

8d9cfe
Common subdirectories: ltrace-0.7.91/config and ltrace-0.7.91-pm/config
8d9cfe
diff -u ltrace-0.7.91/configure.ac ltrace-0.7.91-pm/configure.ac
8d9cfe
--- ltrace-0.7.91/configure.ac	2015-01-09 00:38:17.977190726 +0100
8d9cfe
+++ ltrace-0.7.91-pm/configure.ac	2015-01-09 00:37:40.261910548 +0100
8d9cfe
@@ -128,6 +128,51 @@
8d9cfe
 AC_CHECK_HEADERS(selinux/selinux.h)
8d9cfe
 AC_CHECK_LIB(selinux, security_get_boolean_active)
8d9cfe
 
8d9cfe
+dnl Whether (and which) elfutils libdw.so to use for unwinding.
8d9cfe
+AC_ARG_WITH(elfutils,
8d9cfe
+  AS_HELP_STRING([--with-elfutils], [Use elfutils libdwfl unwinding support]),
8d9cfe
+  [case "${withval}" in
8d9cfe
+  (yes|no) enable_elfutils=$withval;;
8d9cfe
+  (*) enable_elfutils=yes
8d9cfe
+    AM_CPPFLAGS="${AM_CPPFLAGS} -I${withval}/include"
8d9cfe
+    AM_LDFLAGS="${AM_LDFLAGS} -L${withval}/lib"
8d9cfe
+    elfutils_LD_LIBRARY_PATH="${withval}/lib:${withval}/lib/elfutils"
8d9cfe
+    ;;
8d9cfe
+esac],[enable_elfutils=maybe])
8d9cfe
+
8d9cfe
+dnl Check whether we have the elfutils libdwfl.h header installed.
8d9cfe
+saved_CPPFLAGS="${CPPFLAGS}"
8d9cfe
+CPPFLAGS="${CPPFLAGS} ${AM_CPPFLAGS}"
8d9cfe
+AC_CHECK_HEADERS([elfutils/libdwfl.h],[have_libdwfl_h=yes])
8d9cfe
+CPPFLAGS="${saved_CPPFLAGS}"
8d9cfe
+
8d9cfe
+dnl And whether libdw.so provides the unwinding functions.
8d9cfe
+saved_LDFLAGS="${LDFLAGS}"
8d9cfe
+LDFLAGS="${LDFLAGS} ${AM_LDFLAGS}"
8d9cfe
+AC_CHECK_LIB([dw], [dwfl_getthread_frames], [have_libdw_dwfl_frames=yes])
8d9cfe
+LDFLAGS="${saved_LDFLAGS}"
8d9cfe
+
8d9cfe
+AC_MSG_CHECKING([whether to use elfutils libdwfl unwinding support])
8d9cfe
+case "${enable_elfutils}" in
8d9cfe
+(yes|maybe)
8d9cfe
+  if test x$have_libdwfl_h = xyes -a x$have_libdw_dwfl_frames = xyes; then
8d9cfe
+    enable_elfutils=yes
8d9cfe
+  elif test $enable_elfutils = maybe; then
8d9cfe
+    enable_elfutils=no
8d9cfe
+  else
8d9cfe
+    AC_MSG_RESULT([$enable_elfutils])
8d9cfe
+    AC_MSG_ERROR([Missing elfutils/libdwfl.h or dwfl_getthread_frames not in libdw.so])
8d9cfe
+  fi
8d9cfe
+  ;;
8d9cfe
+(*) ;;
8d9cfe
+esac
8d9cfe
+AC_MSG_RESULT([$enable_elfutils])
8d9cfe
+
8d9cfe
+if test x"$enable_elfutils" = xyes; then
8d9cfe
+  libdw_LIBS=-ldw
8d9cfe
+  AC_SUBST(libdw_LIBS)
8d9cfe
+  AC_DEFINE([HAVE_LIBDW], [1], [we have elfutils libdw])
8d9cfe
+fi
8d9cfe
 
8d9cfe
 # HAVE_LIBUNWIND
8d9cfe
 AC_ARG_WITH(libunwind,
8d9cfe
@@ -193,6 +238,13 @@
8d9cfe
   LDFLAGS="${saved_LDFLAGS}"
8d9cfe
 fi
8d9cfe
 
8d9cfe
+if test x"$enable_elfutils" = xyes -a x"$enable_libunwind" = xyes; then
8d9cfe
+  AC_MSG_ERROR([Cannot enable both --with-libunwind and --with-elfutils])
8d9cfe
+fi
8d9cfe
+
8d9cfe
+if test x"$enable_elfutils" = xyes -o x"$enable_libunwind" = xyes; then
8d9cfe
+  AC_DEFINE([HAVE_UNWINDER], [1], [we have an unwinder available])
8d9cfe
+fi
8d9cfe
 
8d9cfe
 saved_CPPFLAGS="${CPPFLAGS}"
8d9cfe
 saved_LDFLAGS="${LDFLAGS}"
8d9cfe
@@ -340,6 +392,7 @@
8d9cfe
 AC_SUBST(AM_CFLAGS)
8d9cfe
 AC_SUBST(AM_LDFLAGS)
8d9cfe
 AC_SUBST(libelf_LD_LIBRARY_PATH)
8d9cfe
+AC_SUBST(elfutils_LD_LIBRARY_PATH)
8d9cfe
 AC_SUBST(libunwind_LD_LIBRARY_PATH)
8d9cfe
 
8d9cfe
 AC_CONFIG_FILES([
8d9cfe
Common subdirectories: ltrace-0.7.91/debian and ltrace-0.7.91-pm/debian
8d9cfe
Common subdirectories: ltrace-0.7.91/etc and ltrace-0.7.91-pm/etc
8d9cfe
diff -u ltrace-0.7.91/ltrace.1 ltrace-0.7.91-pm/ltrace.1
8d9cfe
--- ltrace-0.7.91/ltrace.1	2015-01-09 00:38:17.975190764 +0100
8d9cfe
+++ ltrace-0.7.91-pm/ltrace.1	2015-01-09 00:37:40.261910548 +0100
8d9cfe
@@ -196,7 +196,8 @@
8d9cfe
 correct execution of setuid and/or setgid binaries.
8d9cfe
 .IP "\-w, --where \fInr"
8d9cfe
 Show backtrace of \fInr\fR stack frames for each traced function. This
8d9cfe
-option enabled only if libunwind support was enabled at compile time.
8d9cfe
+option enabled only if elfutils or libunwind support was enabled at compile
8d9cfe
+time.
8d9cfe
 .IP "\-x \fIfilter"
8d9cfe
 A qualifying expression which modifies which symbol table entry points
8d9cfe
 to trace.  The format of the filter expression is described in the
8d9cfe
Only in ltrace-0.7.91-pm/: ltrace.1.orig
8d9cfe
diff -u ltrace-0.7.91/Makefile.am ltrace-0.7.91-pm/Makefile.am
8d9cfe
--- ltrace-0.7.91/Makefile.am	2015-01-09 00:38:17.965190955 +0100
8d9cfe
+++ ltrace-0.7.91-pm/Makefile.am	2015-01-09 00:37:40.260910568 +0100
8d9cfe
@@ -40,6 +40,7 @@
8d9cfe
 	$(liberty_LIBS) \
8d9cfe
 	$(libsupcxx_LIBS) \
8d9cfe
 	$(libstdcxx_LIBS) \
8d9cfe
+	$(libdw_LIBS) \
8d9cfe
 	$(libunwind_LIBS) \
8d9cfe
 	sysdeps/libos.la
8d9cfe
 
8d9cfe
diff -u ltrace-0.7.91/options.c ltrace-0.7.91-pm/options.c
8d9cfe
--- ltrace-0.7.91/options.c	2015-01-09 00:38:17.974190783 +0100
8d9cfe
+++ ltrace-0.7.91-pm/options.c	2015-01-09 00:37:40.261910548 +0100
8d9cfe
@@ -107,9 +107,9 @@
8d9cfe
 		"  -T                  show the time spent inside each call.\n"
8d9cfe
 		"  -u USERNAME         run command with the userid, groupid of username.\n"
8d9cfe
 		"  -V, --version       output version information and exit.\n"
8d9cfe
-#if defined(HAVE_LIBUNWIND)
8d9cfe
+#if defined(HAVE_UNWINDER)
8d9cfe
 		"  -w, --where=NR      print backtrace showing NR stack frames at most.\n"
8d9cfe
-#endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
+#endif /* defined(HAVE_UNWINDER) */
8d9cfe
 		"  -x FILTER           modify which static functions to trace.\n"
8d9cfe
 		"\nReport bugs to ltrace-devel@lists.alioth.debian.org\n",
8d9cfe
 		progname);
8d9cfe
@@ -519,9 +519,9 @@
8d9cfe
 	progname = argv[0];
8d9cfe
 	options.output = stderr;
8d9cfe
 	options.no_signals = 0;
8d9cfe
-#if defined(HAVE_LIBUNWIND)
8d9cfe
+#if defined(HAVE_UNWINDER)
8d9cfe
 	options.bt_depth = -1;
8d9cfe
-#endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
+#endif /* defined(HAVE_UNWINDER) */
8d9cfe
 
8d9cfe
 	guess_cols();
8d9cfe
 
8d9cfe
@@ -545,9 +545,9 @@
8d9cfe
 			{"output", 1, 0, 'o'},
8d9cfe
 			{"version", 0, 0, 'V'},
8d9cfe
 			{"no-signals", 0, 0, 'b'},
8d9cfe
-# if defined(HAVE_LIBUNWIND)
8d9cfe
+# if defined(HAVE_UNWINDER)
8d9cfe
 			{"where", 1, 0, 'w'},
8d9cfe
-# endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
+# endif /* defined(HAVE_UNWINDER) */
8d9cfe
 			{0, 0, 0, 0}
8d9cfe
 		};
8d9cfe
 #endif
8d9cfe
@@ -556,7 +556,7 @@
8d9cfe
 #ifdef USE_DEMANGLE
8d9cfe
 			"C"
8d9cfe
 #endif
8d9cfe
-#if defined(HAVE_LIBUNWIND)
8d9cfe
+#if defined(HAVE_UNWINDER)
8d9cfe
 			"w:"
8d9cfe
 #endif
8d9cfe
 			"cfhiLrStTVba:A:D:e:F:l:n:o:p:s:u:x:X:";
8d9cfe
@@ -681,11 +681,11 @@
8d9cfe
 			       "There is NO WARRANTY, to the extent permitted by law.\n");
8d9cfe
 			exit(0);
8d9cfe
 			break;
8d9cfe
-#if defined(HAVE_LIBUNWIND)
8d9cfe
+#if defined(HAVE_UNWINDER)
8d9cfe
 		case 'w':
8d9cfe
 			options.bt_depth = parse_int(optarg, 'w', 1, 0);
8d9cfe
 			break;
8d9cfe
-#endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
+#endif /* defined(HAVE_UNWINDER) */
8d9cfe
 
8d9cfe
 		case 'x':
8d9cfe
 			parse_filter_chain(optarg, &options.static_filter);
8d9cfe
Only in ltrace-0.7.91-pm/: options.c.orig
8d9cfe
diff -u ltrace-0.7.91/options.h ltrace-0.7.91-pm/options.h
8d9cfe
--- ltrace-0.7.91/options.h	2015-01-09 00:38:17.966190936 +0100
8d9cfe
+++ ltrace-0.7.91-pm/options.h	2015-01-09 00:37:40.261910548 +0100
8d9cfe
@@ -44,9 +44,9 @@
8d9cfe
 	size_t strlen;     /* default maximum # of bytes printed in strings */
8d9cfe
 	int follow;     /* trace child processes */
8d9cfe
 	int no_signals; /* don't print signals */
8d9cfe
-#if defined(HAVE_LIBUNWIND)
8d9cfe
+#if defined(HAVE_UNWINDER)
8d9cfe
 	int bt_depth;	 /* how may levels of stack frames to show */
8d9cfe
-#endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
+#endif /* defined(HAVE_UNWINDER) */
8d9cfe
 	struct filter *plt_filter;
8d9cfe
 	struct filter *static_filter;
8d9cfe
 
8d9cfe
diff -u ltrace-0.7.91/output.c ltrace-0.7.91-pm/output.c
8d9cfe
--- ltrace-0.7.91/output.c	2015-01-09 00:38:17.966190936 +0100
8d9cfe
+++ ltrace-0.7.91-pm/output.c	2015-01-09 00:37:40.261910548 +0100
8d9cfe
@@ -33,6 +33,7 @@
8d9cfe
 #include <unistd.h>
8d9cfe
 #include <errno.h>
8d9cfe
 #include <assert.h>
8d9cfe
+#include <inttypes.h>
8d9cfe
 
8d9cfe
 #include "output.h"
8d9cfe
 #include "demangle.h"
8d9cfe
@@ -567,6 +568,73 @@
8d9cfe
 	stel->out.need_delim = need_delim;
8d9cfe
 }
8d9cfe
 
8d9cfe
+#if defined(HAVE_LIBDW)
8d9cfe
+/* Prints information about one frame of a thread.  Called by
8d9cfe
+   dwfl_getthread_frames in output_right.  Returns 1 when done (max
8d9cfe
+   number of frames reached).  Returns -1 on error.  Returns 0 on
8d9cfe
+   success (if there are more frames in the thread, call us again).  */
8d9cfe
+static int
8d9cfe
+frame_callback (Dwfl_Frame *state, void *arg)
8d9cfe
+{
8d9cfe
+	Dwarf_Addr pc;
8d9cfe
+	bool isactivation;
8d9cfe
+
8d9cfe
+	int *frames = (int *) arg;
8d9cfe
+
8d9cfe
+	if (!dwfl_frame_pc(state, &pc, &isactivation))
8d9cfe
+		return -1;
8d9cfe
+
8d9cfe
+	if (!isactivation)
8d9cfe
+		pc--;
8d9cfe
+
8d9cfe
+	Dwfl *dwfl = dwfl_thread_dwfl(dwfl_frame_thread(state));
8d9cfe
+	Dwfl_Module *mod = dwfl_addrmodule(dwfl, pc);
8d9cfe
+	const char *modname = NULL;
8d9cfe
+	const char *symname = NULL;
8d9cfe
+	GElf_Off off = 0;
8d9cfe
+	if (mod != NULL) {
8d9cfe
+		GElf_Sym sym;
8d9cfe
+		modname = dwfl_module_info(mod, NULL, NULL, NULL, NULL,
8d9cfe
+					   NULL, NULL, NULL);
8d9cfe
+		symname = dwfl_module_addrinfo(mod, pc, &off, &sym,
8d9cfe
+					       NULL, NULL, NULL);
8d9cfe
+	}
8d9cfe
+
8d9cfe
+	/* This mimics the output produced by libunwind below.  */
8d9cfe
+	fprintf(options.output, " > %s(%s+0x%" PRIx64 ") [%" PRIx64 "]\n",
8d9cfe
+		modname, symname, off, pc);
8d9cfe
+
8d9cfe
+	/* See if we can extract the source line too and print it on
8d9cfe
+	   the next line if we can find it.  */
8d9cfe
+	if (mod != NULL) {
8d9cfe
+		Dwfl_Line *l = dwfl_module_getsrc(mod, pc);
8d9cfe
+		if (l != NULL) {
8d9cfe
+			int line, col;
8d9cfe
+			line = col = -1;
8d9cfe
+			const char *src = dwfl_lineinfo(l, NULL, &line, &col,
8d9cfe
+							NULL, NULL);
8d9cfe
+			if (src != NULL) {
8d9cfe
+				fprintf(options.output, "\t%s", src);
8d9cfe
+				if (line > 0) {
8d9cfe
+					fprintf(options.output, ":%d", line);
8d9cfe
+					if (col > 0)
8d9cfe
+			                        fprintf(options.output,
8d9cfe
+							":%d", col);
8d9cfe
+				}
8d9cfe
+				fprintf(options.output, "\n");
8d9cfe
+			}
8d9cfe
+
8d9cfe
+		}
8d9cfe
+	}
8d9cfe
+
8d9cfe
+	/* Max number of frames to print reached? */
8d9cfe
+	if ((*frames)-- == 0)
8d9cfe
+		return 1;
8d9cfe
+
8d9cfe
+	return 0;
8d9cfe
+}
8d9cfe
+#endif /* defined(HAVE_LIBDW) */
8d9cfe
+
8d9cfe
 void
8d9cfe
 output_right(enum tof type, struct process *proc, struct library_symbol *libsym,
8d9cfe
 	     struct timedelta *spent)
8d9cfe
@@ -694,6 +762,24 @@
8d9cfe
 	}
8d9cfe
 #endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
 
8d9cfe
+#if defined(HAVE_LIBDW)
8d9cfe
+	if (options.bt_depth > 0 && proc->leader->dwfl != NULL) {
8d9cfe
+		int frames = options.bt_depth;
8d9cfe
+		if (dwfl_getthread_frames(proc->leader->dwfl, proc->pid,
8d9cfe
+					  frame_callback, &frames) < 0) {
8d9cfe
+			// Only print an error if we couldn't show anything.
8d9cfe
+			// Otherwise just show there might be more...
8d9cfe
+			if (frames == options.bt_depth)
8d9cfe
+				fprintf(stderr,
8d9cfe
+					"dwfl_getthread_frames tid %d: %s\n",
8d9cfe
+					proc->pid, dwfl_errmsg(-1));
8d9cfe
+			else
8d9cfe
+				fprintf(options.output, " > [...]\n");
8d9cfe
+		}
8d9cfe
+		fprintf(options.output, "\n");
8d9cfe
+	  }
8d9cfe
+#endif /* defined(HAVE_LIBDW) */
8d9cfe
+
8d9cfe
 	current_proc = NULL;
8d9cfe
 	current_column = 0;
8d9cfe
 }
8d9cfe
Only in ltrace-0.7.91-pm/: output.c.orig
8d9cfe
diff -u ltrace-0.7.91/proc.c ltrace-0.7.91-pm/proc.c
8d9cfe
--- ltrace-0.7.91/proc.c	2015-01-09 00:38:17.981190650 +0100
8d9cfe
+++ ltrace-0.7.91-pm/proc.c	2015-01-09 00:37:40.261910548 +0100
8d9cfe
@@ -111,6 +111,11 @@
8d9cfe
 	if (proc->unwind_as != NULL)
8d9cfe
 		unw_destroy_addr_space(proc->unwind_as);
8d9cfe
 #endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
+
8d9cfe
+#if defined(HAVE_LIBDW)
8d9cfe
+	if (proc->dwfl != NULL)
8d9cfe
+		dwfl_end(proc->dwfl);
8d9cfe
+#endif /* defined(HAVE_LIBDW) */
8d9cfe
 }
8d9cfe
 
8d9cfe
 static int
8d9cfe
@@ -172,6 +177,10 @@
8d9cfe
 	}
8d9cfe
 #endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
 
8d9cfe
+#if defined(HAVE_LIBDW)
8d9cfe
+	proc->dwfl = NULL; /* Initialize for leader only on first library.  */
8d9cfe
+#endif /* defined(HAVE_LIBDW) */
8d9cfe
+
8d9cfe
 	return 0;
8d9cfe
 }
8d9cfe
 
8d9cfe
@@ -887,6 +896,59 @@
8d9cfe
 	debug(DEBUG_PROCESS, "added library %s@%p (%s) to %d",
8d9cfe
 	      lib->soname, lib->base, lib->pathname, proc->pid);
8d9cfe
 
8d9cfe
+#if defined(HAVE_LIBDW)
8d9cfe
+	if (options.bt_depth > 0) {
8d9cfe
+		/* Setup module tracking for libdwfl unwinding.  */
8d9cfe
+		struct process *leader = proc->leader;
8d9cfe
+		Dwfl *dwfl = leader->dwfl;
8d9cfe
+		if (dwfl == NULL) {
8d9cfe
+			static const Dwfl_Callbacks proc_callbacks = {
8d9cfe
+				.find_elf = dwfl_linux_proc_find_elf,
8d9cfe
+				.find_debuginfo = dwfl_standard_find_debuginfo
8d9cfe
+			};
8d9cfe
+			dwfl = dwfl_begin(&proc_callbacks);
8d9cfe
+			if (dwfl == NULL)
8d9cfe
+				fprintf(stderr,
8d9cfe
+					"Couldn't initialize libdwfl unwinding "
8d9cfe
+					"for process %d: %s\n", leader->pid,
8d9cfe
+					dwfl_errmsg (-1));
8d9cfe
+		}
8d9cfe
+
8d9cfe
+		if (dwfl != NULL) {
8d9cfe
+			dwfl_report_begin_add(dwfl);
8d9cfe
+			if (dwfl_report_elf(dwfl, lib->soname,
8d9cfe
+					    lib->pathname, -1,
8d9cfe
+					    (GElf_Addr) lib->base,
8d9cfe
+					    false) == NULL)
8d9cfe
+				fprintf(stderr,
8d9cfe
+					"dwfl_report_elf %s@%p (%s) %d: %s\n",
8d9cfe
+					lib->soname, lib->base, lib->pathname,
8d9cfe
+					proc->pid, dwfl_errmsg (-1));
8d9cfe
+			dwfl_report_end(dwfl, NULL, NULL);
8d9cfe
+
8d9cfe
+			if (leader->dwfl == NULL) {
8d9cfe
+				int r = dwfl_linux_proc_attach(dwfl,
8d9cfe
+							       leader->pid,
8d9cfe
+							       true);
8d9cfe
+				if (r == 0)
8d9cfe
+					leader->dwfl = dwfl;
8d9cfe
+				else {
8d9cfe
+					const char *msg;
8d9cfe
+					dwfl_end(dwfl);
8d9cfe
+					if (r < 0)
8d9cfe
+						msg = dwfl_errmsg(-1);
8d9cfe
+					else
8d9cfe
+						msg = strerror(r);
8d9cfe
+					fprintf(stderr, "Couldn't initialize "
8d9cfe
+						"libdwfl unwinding for "
8d9cfe
+						"process %d: %s\n",
8d9cfe
+						leader->pid, msg);
8d9cfe
+				}
8d9cfe
+			}
8d9cfe
+		}
8d9cfe
+	}
8d9cfe
+#endif /* defined(HAVE_LIBDW) */
8d9cfe
+
8d9cfe
 	/* Insert breakpoints for all active (non-latent) symbols.  */
8d9cfe
 	struct library_symbol *libsym = NULL;
8d9cfe
 	while ((libsym = library_each_symbol(lib, libsym,
8d9cfe
diff -u ltrace-0.7.91/proc.c.orig ltrace-0.7.91-pm/proc.c.orig
8d9cfe
--- ltrace-0.7.91/proc.h	2015-01-09 00:38:17.966190936 +0100
8d9cfe
+++ ltrace-0.7.91-pm/proc.h	2015-01-09 00:37:40.261910548 +0100
8d9cfe
@@ -28,6 +28,10 @@
8d9cfe
 #include <sys/time.h>
8d9cfe
 #include <stdint.h>
8d9cfe
 
8d9cfe
+#if defined(HAVE_LIBDW)
8d9cfe
+# include <elfutils/libdwfl.h>
8d9cfe
+#endif
8d9cfe
+
8d9cfe
 #if defined(HAVE_LIBUNWIND)
8d9cfe
 # include <libunwind.h>
8d9cfe
 #endif /* defined(HAVE_LIBUNWIND) */
8d9cfe
@@ -113,6 +117,11 @@
8d9cfe
 	short e_machine;
8d9cfe
 	char e_class;
8d9cfe
 
8d9cfe
+#if defined(HAVE_LIBDW)
8d9cfe
+	/* Unwind info for leader, NULL for non-leader procs. */
8d9cfe
+	Dwfl *dwfl;
8d9cfe
+#endif /* defined(HAVE_LIBDW) */
8d9cfe
+
8d9cfe
 #if defined(HAVE_LIBUNWIND)
8d9cfe
 	/* libunwind address space */
8d9cfe
 	unw_addr_space_t unwind_as;
8d9cfe
Only in ltrace-0.7.91-pm/: proc.h.orig
8d9cfe
Common subdirectories: ltrace-0.7.91/sysdeps and ltrace-0.7.91-pm/sysdeps
8d9cfe
Common subdirectories: ltrace-0.7.91/testsuite and ltrace-0.7.91-pm/testsuite
8d9cfe
diff -up ltrace-0.7.91/proc.c\~ ltrace-0.7.91/proc.c
8d9cfe
--- ltrace-0.7.91/proc.c~	2015-01-09 01:55:38.289864078 +0100
8d9cfe
+++ ltrace-0.7.91/proc.c	2015-01-09 01:56:29.818881935 +0100
8d9cfe
@@ -918,7 +918,8 @@ proc_add_library(struct process *proc, s
8d9cfe
 			dwfl_report_begin_add(dwfl);
8d9cfe
 			if (dwfl_report_elf(dwfl, lib->soname,
8d9cfe
 					    lib->pathname, -1,
8d9cfe
-					    (GElf_Addr) lib->base,
8d9cfe
+					    /* XXX double cast */
8d9cfe
+					    (GElf_Addr) (uintptr_t) lib->base,
8d9cfe
 					    false) == NULL)
8d9cfe
 				fprintf(stderr,
8d9cfe
 					"dwfl_report_elf %s@%p (%s) %d: %s\n",