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