diff --git a/.gitignore b/.gitignore index 94e6d6c..6374c2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ ltrace-0.5-svn45.tar.gz ltrace-*/ +/ltrace-0.6.0.tar.bz2 diff --git a/ltrace-0.4-exec.patch b/ltrace-0.4-exec.patch deleted file mode 100644 index 6526ea8..0000000 --- a/ltrace-0.4-exec.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- process_event.c 2006-02-20 16:48:07.000000000 -0500 -+++ process_event.fix 2006-07-04 04:20:27.000000000 -0400 -@@ -239,7 +239,6 @@ static void process_sysret(struct event - sysname(event->proc, event->e_un.sysnum)); - } - if (exec_p(event->proc, event->e_un.sysnum)) { -- if (gimme_arg(LT_TOF_SYSCALLR, event->proc, -1) == 0) { - pid_t saved_pid; - event->proc->mask_32bit = 0; - event->proc->personality = 0; -@@ -251,8 +250,6 @@ static void process_sysret(struct event - event->proc->pid = 0; - breakpoints_init(event->proc); - event->proc->pid = saved_pid; -- } else -- enable_all_breakpoints(event->proc); - } - continue_process(event->proc->pid); - } diff --git a/ltrace-0.4-fork.patch b/ltrace-0.4-fork.patch deleted file mode 100644 index ada2fbc..0000000 --- a/ltrace-0.4-fork.patch +++ /dev/null @@ -1,199 +0,0 @@ -diff -Naurp ltrace-0.4/ltrace.h ltrace-0.4-Getmsg/ltrace.h ---- ltrace-0.4/ltrace.h 2006-02-20 16:48:07.000000000 -0500 -+++ ltrace-0.4-Getmsg/ltrace.h 2006-07-18 02:23:36.000000000 -0400 -@@ -12,6 +12,7 @@ - #include "sysdep.h" - - #define MAX_LIBRARY 30 -+#define TRACE_FORK 1 - - #if defined HAVE_LIBIBERTY || defined HAVE_LIBSUPC__ - # define USE_DEMANGLE -@@ -170,7 +171,7 @@ extern void show_summary(void); - - /* Arch-dependent stuff: */ - extern char *pid2name(pid_t pid); --extern void trace_set_options(struct process *proc, pid_t pid); -+extern void trace_set_options(struct process *proc, pid_t pid, int option); - extern void trace_me(void); - extern int trace_pid(pid_t pid); - extern void untrace_pid(pid_t pid); -@@ -198,5 +199,5 @@ extern void *plt2addr(struct process *, - #if 0 /* not yet */ - extern int umoven(struct process *proc, void *addr, int len, void *laddr); - #endif -- -+extern ulong get_child_pid(pid_t pid); - #endif -diff -Naurp ltrace-0.4/proc.c ltrace-0.4-Getmsg/proc.c ---- ltrace-0.4/proc.c 2006-02-20 16:48:07.000000000 -0500 -+++ ltrace-0.4-Getmsg/proc.c 2006-07-17 06:00:36.000000000 -0400 -@@ -22,10 +22,11 @@ struct process *open_program(char *filen - } - proc->filename = filename; - proc->breakpoints_enabled = -1; -+ proc->pid = 0; -+ breakpoints_init(proc); - if (pid) { - proc->pid = pid; - } -- breakpoints_init(proc); - - proc->next = list_of_processes; - list_of_processes = proc; -@@ -37,11 +38,13 @@ void open_pid(pid_t pid, int verbose) - struct process *proc; - char *filename; - -+#if 0 - if (trace_pid(pid) < 0) { - fprintf(stderr, "Cannot attach to pid %u: %s\n", pid, - strerror(errno)); - return; - } -+#endif - - filename = pid2name(pid); - -@@ -54,7 +57,6 @@ void open_pid(pid_t pid, int verbose) - return; - } - #endif -- - proc = open_program(filename, pid); -- proc->breakpoints_enabled = 1; -+ proc->breakpoints_enabled = -1; - } -diff -Naurp ltrace-0.4/process_event.c ltrace-0.4-Getmsg/process_event.c ---- ltrace-0.4/process_event.c 2006-02-20 16:48:07.000000000 -0500 -+++ ltrace-0.4-Getmsg/process_event.c 2006-07-18 03:05:16.000000000 -0400 -@@ -223,16 +223,6 @@ static void process_sysret(struct event - if (opt_T || opt_c) { - calc_time_spent(event->proc); - } -- if (fork_p(event->proc, event->e_un.sysnum)) { -- if (opt_f) { -- pid_t child = -- gimme_arg(LT_TOF_SYSCALLR, event->proc, -1); -- if (child > 0) { -- open_pid(child, 0); -- } -- } -- enable_all_breakpoints(event->proc); -- } - callstack_pop(event->proc); - if (opt_S) { - output_right(LT_TOF_SYSCALLR, event->proc, -diff -Naurp ltrace-0.4/sysdeps/linux-gnu/trace.c ltrace-0.4-Getmsg/sysdeps/linux-gnu/trace.c ---- ltrace-0.4/sysdeps/linux-gnu/trace.c 2006-02-20 16:48:07.000000000 -0500 -+++ ltrace-0.4-Getmsg/sysdeps/linux-gnu/trace.c 2006-07-18 02:49:35.000000000 -0400 -@@ -90,7 +90,7 @@ int trace_pid(pid_t pid) - return 0; - } - --void trace_set_options(struct process *proc, pid_t pid) -+void trace_set_options(struct process *proc, pid_t pid, int option) - { - #ifndef PTRACE_SETOPTIONS - #define PTRACE_SETOPTIONS 0x4200 -@@ -101,10 +101,21 @@ void trace_set_options(struct process *p - #ifndef PTRACE_O_TRACESYSGOOD - #define PTRACE_O_TRACESYSGOOD 0x00000001 - #endif -+#ifndef PTRACE_O_TRACEFORK -+#define PTRACE_O_TRACEFORK 0x00000002 -+#endif -+ -+ ulong setoptions = 0; -+ - if (proc->tracesysgood & 0x80) - return; -- if (ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD) < 0 && -- ptrace(PTRACE_OLDSETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD) < 0) { -+ -+ setoptions |= PTRACE_O_TRACESYSGOOD; -+ if (TRACE_FORK == option){ -+ setoptions |= PTRACE_O_TRACEFORK; -+ } -+ if (ptrace(PTRACE_SETOPTIONS, pid, 0, setoptions) < 0 && -+ ptrace(PTRACE_OLDSETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD) < 0){ - perror("PTRACE_SETOPTIONS"); - return; - } -@@ -175,3 +186,18 @@ int umovestr(struct process *proc, void - *(char *)(laddr + offset) = '\0'; - return 0; - } -+ -+ulong get_child_pid(pid_t pid) -+{ -+#ifndef PTRACE_GETEVENTMSG -+#define PTRACE_GETEVENTMSG 0x4201 -+#endif -+ ulong child_pid = 9999; -+ -+ if( ptrace(PTRACE_GETEVENTMSG, pid, 0, &child_pid) < 0) { -+ perror("PTRACE_GETEVENTMSG"); -+ return 0; -+ } -+ return child_pid; -+} -+ -diff -Naurp ltrace-0.4/wait_for_something.c ltrace-0.4-Getmsg/wait_for_something.c ---- ltrace-0.4/wait_for_something.c 2006-02-20 16:48:07.000000000 -0500 -+++ ltrace-0.4-Getmsg/wait_for_something.c 2006-07-18 02:32:26.000000000 -0400 -@@ -14,15 +14,17 @@ - #include "options.h" - #include "debug.h" - -+#define FORK_MASK 0x00010000 - static struct event event; - - /* This should also update `current_process' */ - - static struct process *pid2proc(int pid); -+void verify(int sig_status); - - struct event *wait_for_something(void) - { -- pid_t pid; -+ pid_t pid, child_pid; - int status; - int tmp; - -@@ -54,7 +56,11 @@ struct event *wait_for_something(void) - if (event.proc->breakpoints_enabled == -1) { - enable_all_breakpoints(event.proc); - event.thing = LT_EV_NONE; -- trace_set_options(event.proc, event.proc->pid); -+ if(opt_f){ -+ trace_set_options(event.proc, event.proc->pid, TRACE_FORK); -+ }else{ -+ trace_set_options(event.proc, event.proc->pid, 0); -+ } - continue_process(event.proc->pid); - return &event; - } -@@ -92,6 +98,17 @@ struct event *wait_for_something(void) - event.e_un.signum = WSTOPSIG(status); - return &event; - } -+ if((WSTOPSIG(status) == SIGTRAP) && (status & FORK_MASK)) { -+ event.thing = LT_EV_NONE; -+ event.e_un.signum = WSTOPSIG(status); -+ child_pid = (pid_t) get_child_pid(event.proc->pid); -+ if (child_pid){ -+ open_pid(child_pid,0); -+ } -+ enable_all_breakpoints(event.proc); -+ continue_after_signal(event.proc->pid, event.e_un.signum); -+ return &event; -+ } - event.thing = LT_EV_BREAKPOINT; - if (!event.proc->instruction_pointer) { - event.proc->instruction_pointer = -@@ -115,3 +132,4 @@ static struct process *pid2proc(pid_t pi - } - return NULL; - } -+ diff --git a/ltrace-0.5-a2bp.patch b/ltrace-0.5-a2bp.patch deleted file mode 100644 index 1ae822b..0000000 --- a/ltrace-0.5-a2bp.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff -Bburp ltrace-0.5/breakpoints.c ltrace-0.5-pm/breakpoints.c ---- ltrace-0.5/breakpoints.c 2006-08-30 08:03:25.000000000 -0400 -+++ ltrace-0.5-pm/breakpoints.c 2006-08-30 08:02:39.000000000 -0400 -@@ -20,6 +20,10 @@ - - struct breakpoint *address2bpstruct(struct process *proc, void *addr) - { -+ if (!proc->breakpoints) { -+ proc->breakpoints = -+ dict_init(dict_key2hash_int, dict_key_cmp_int); -+ } - return dict_find_entry(proc->breakpoints, addr); - } - -@@ -33,7 +39,6 @@ insert_breakpoint(struct process *proc, - if (!proc->breakpoints) { - proc->breakpoints = - dict_init(dict_key2hash_int, dict_key_cmp_int); -- /* atexit(brk_dict_clear); *//* why bother to do this on exit? */ - } - - if (!addr) diff --git a/ltrace-0.5-attach.patch b/ltrace-0.5-attach.patch deleted file mode 100644 index cef1aab..0000000 --- a/ltrace-0.5-attach.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -Bburp ltrace-0.5-orig/ltrace-0.5/proc.c ltrace-0.5/proc.c ---- ltrace-0.5-orig/ltrace-0.5/proc.c 2006-09-04 13:58:46.000000000 +0200 -+++ ltrace-0.5/proc.c 2006-09-04 14:22:24.000000000 +0200 -@@ -38,13 +38,11 @@ void open_pid(pid_t pid, int verbose) - struct process *proc; - char *filename; - --#if 0 - if (trace_pid(pid) < 0) { - fprintf(stderr, "Cannot attach to pid %u: %s\n", pid, - strerror(errno)); - return; - } --#endif - - filename = pid2name(pid); - -@@ -57,6 +55,6 @@ void open_pid(pid_t pid, int verbose) - return; - } - #endif -- proc = open_program(filename, pid); -- proc->breakpoints_enabled = -1; -+ proc = open_program(filename, 0); -+ proc->pid = pid; - } -Only in ltrace-0.5: proc.c~ diff --git a/ltrace-0.5-build.patch b/ltrace-0.5-build.patch deleted file mode 100644 index d6d9c21..0000000 --- a/ltrace-0.5-build.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -Burp ltrace-0.5/Makefile.in ltrace-0.5-pm/Makefile.in ---- ltrace-0.5/Makefile.in 2007-10-08 20:28:35.000000000 +0200 -+++ ltrace-0.5-pm/Makefile.in 2007-10-08 20:27:07.000000000 +0200 -@@ -34,6 +34,7 @@ VERSION = @PACKAGE_VERSION@ - - all: ltrace - -+$(OBJ): | sysdeps/sysdep.o - ltrace: sysdeps/sysdep.o $(OBJ) - $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ - diff --git a/ltrace-0.5-exec-stripped.patch b/ltrace-0.5-exec-stripped.patch deleted file mode 100644 index 51d8a33..0000000 --- a/ltrace-0.5-exec-stripped.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- ltrace-0.5/elf.c~ 2010-03-25 14:07:20.000000000 +0100 -+++ ltrace-0.5/elf.c 2010-03-31 13:11:35.000000000 +0200 -@@ -435,6 +435,7 @@ struct library_symbol *read_elf(struct p - struct library_symbol *library_symbols = NULL; - struct ltelf lte[MAX_LIBRARY + 1]; - size_t i; -+ struct opt_x_t *opt_x_loc = opt_x; - struct opt_x_t *xptr; - struct library_symbol **lib_tail = NULL; - struct opt_x_t *main_cheat; -@@ -502,11 +503,11 @@ struct library_symbol *read_elf(struct p - main_cheat = (struct opt_x_t *)malloc(sizeof(struct opt_x_t)); - if (main_cheat == NULL) - error(EXIT_FAILURE, 0, "Couldn't allocate memory"); -- main_cheat->next = opt_x; -+ main_cheat->next = opt_x_loc; - main_cheat->found = 0; - main_cheat->name = PLTs_initialized_by_here; - -- for (xptr = opt_x; xptr; xptr = xptr->next) -+ for (xptr = opt_x_loc; xptr; xptr = xptr->next) - if (strcmp(xptr->name, PLTs_initialized_by_here) == 0 - && main_cheat) { - free(main_cheat); -@@ -514,7 +515,7 @@ struct library_symbol *read_elf(struct p - break; - } - if (main_cheat) -- opt_x = main_cheat; -+ opt_x_loc = main_cheat; - } - #endif - -@@ -533,7 +534,7 @@ struct library_symbol *read_elf(struct p - if (!addr) - continue; - -- for (xptr = opt_x; xptr; xptr = xptr->next) -+ for (xptr = opt_x_loc; xptr; xptr = xptr->next) - if (xptr->name && strcmp(xptr->name, name) == 0) { - /* FIXME: Should be able to use &library_symbols as above. But - when you do, none of the real library symbols cause breaks. */ -@@ -543,7 +544,7 @@ struct library_symbol *read_elf(struct p - break; - } - } -- for (xptr = opt_x; xptr; xptr = xptr->next) -+ for (xptr = opt_x_loc; xptr; xptr = xptr->next) - if ( ! xptr->found) { - char *badthing = "WARNING"; - #ifdef PLT_REINITALISATION_BP - -Diff finished. Wed Mar 31 13:12:38 2010 diff --git a/ltrace-0.5-exec-tests.patch b/ltrace-0.5-exec-tests.patch deleted file mode 100644 index e992d8c..0000000 --- a/ltrace-0.5-exec-tests.patch +++ /dev/null @@ -1,74 +0,0 @@ -diff -BurpN ltrace-0.5-orig/testsuite/ltrace.minor/trace-exec1.c ltrace-0.5/testsuite/ltrace.minor/trace-exec1.c ---- ltrace-0.5-orig/testsuite/ltrace.minor/trace-exec1.c 1969-12-31 19:00:00.000000000 -0500 -+++ ltrace-0.5/testsuite/ltrace.minor/trace-exec1.c 2006-12-06 16:39:06.000000000 -0500 -@@ -0,0 +1,6 @@ -+#include -+int main (void) -+{ -+ printf("Hello, World.\n"); -+ return 0; -+} -diff -BurpN ltrace-0.5-orig/testsuite/ltrace.minor/trace-exec.c ltrace-0.5/testsuite/ltrace.minor/trace-exec.c ---- ltrace-0.5-orig/testsuite/ltrace.minor/trace-exec.c 1969-12-31 19:00:00.000000000 -0500 -+++ ltrace-0.5/testsuite/ltrace.minor/trace-exec.c 2006-12-06 16:51:45.000000000 -0500 -@@ -0,0 +1,8 @@ -+#include -+#include -+ -+int main (int argc, char ** argv) -+{ -+ execl (argv[1], argv[1], NULL); -+ abort (); -+} -diff -BurpN ltrace-0.5-orig/testsuite/ltrace.minor/trace-exec.exp ltrace-0.5/testsuite/ltrace.minor/trace-exec.exp ---- ltrace-0.5-orig/testsuite/ltrace.minor/trace-exec.exp 1969-12-31 19:00:00.000000000 -0500 -+++ ltrace-0.5/testsuite/ltrace.minor/trace-exec.exp 2006-12-06 16:57:30.000000000 -0500 -@@ -0,0 +1,48 @@ -+set testfile "trace-exec" -+set srcfile ${testfile}.c -+set binfile ${testfile} -+ -+verbose "compiling first source file now....." -+# Build the shared libraries this test case needs. -+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}.c" "${srcdir}/${subdir}/${binfile}" executable {debug} ] != "" } { -+ send_user "Testcase compile failed, so all tests in this file will automatically fail.\n" -+} -+ -+verbose "compiling second source file now....." -+# Build the shared libraries this test case needs. -+if { [ ltrace_compile "${srcdir}/${subdir}/${testfile}1.c" "${srcdir}/${subdir}/${binfile}1" executable {debug} ] != "" } { -+ send_user "Testcase compile failed, so all tests in this file will automatically fail.\n" -+} -+ -+global LTRACE -+set exec_output "" -+ -+#Run PUT for ltarce. -+spawn $LTRACE -f $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1 -+set timeout 4 -+expect timeout { -+ fail "Time out! Maybe caused by ltrace segment fault or improper timeout value here!" -+ return -+} -+ -+catch "exec $LTRACE -f $srcdir/$subdir/$testfile $srcdir/$subdir/${testfile}1" exec_output -+ -+#check the output of this program. -+verbose "ltrace runtest output: $exec_output\n" -+if [regexp {ELF from incompatible architecture} $exec_output] { -+ fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!" -+ return -+} elseif [ regexp {Couldn't get .hash data} $exec_output ] { -+ fail "Couldn't get .hash data!" -+ return -+} -+ -+ltrace_saveoutput "${exec_output}" ${srcdir}/${subdir}/${testfile}.ltrace -+ -+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {'^execl'} 1 -+ -+# assume glibc and see we really trace both binaries -+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {'^__libc_start_main'} 2 -+ -+# and that we trace printf from the second binary -+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace {'^(puts|printf)'} 1 diff --git a/ltrace-0.5-exec.patch b/ltrace-0.5-exec.patch deleted file mode 100644 index 82da4cc..0000000 --- a/ltrace-0.5-exec.patch +++ /dev/null @@ -1,58 +0,0 @@ -diff -urp ltrace-0.5-1/process_event.c ltrace-0.5/process_event.c ---- ltrace-0.5-1/process_event.c 2008-10-07 12:09:14.000000000 +0200 -+++ ltrace-0.5/process_event.c 2008-10-07 12:09:37.000000000 +0200 -@@ -228,19 +228,6 @@ static void process_sysret(struct event - output_right(LT_TOF_SYSCALLR, event->proc, - sysname(event->proc, event->e_un.sysnum)); - } -- if (exec_p(event->proc, event->e_un.sysnum)) { -- pid_t saved_pid; -- event->proc->mask_32bit = 0; -- event->proc->personality = 0; -- /* FIXME: Leak, should have arch_dep_free. -- But we are leaking here much more than that. */ -- event->proc->arch_ptr = NULL; -- event->proc->filename = pid2name(event->proc->pid); -- saved_pid = event->proc->pid; -- event->proc->pid = 0; -- breakpoints_init(event->proc); -- event->proc->pid = saved_pid; -- } - continue_process(event->proc->pid); - } - -Only in ltrace-0.5: process_event.c.orig -diff -urp ltrace-0.5-1/wait_for_something.c ltrace-0.5/wait_for_something.c ---- ltrace-0.5-1/wait_for_something.c 2008-10-07 12:09:14.000000000 +0200 -+++ ltrace-0.5/wait_for_something.c 2008-10-07 12:09:37.000000000 +0200 -@@ -110,6 +110,29 @@ struct event *wait_for_something(void) - continue_after_signal(event.proc->pid, event.e_un.signum); - return &event; - } -+ if (WSTOPSIG(status) == SIGTRAP){ -+ /* Check whether this SIGTRAP is received just after execve is called for this process */ -+ struct callstack_element *elem; -+ elem = &event.proc->callstack[event.proc->callstack_depth - 1]; -+ if( elem && elem->is_syscall && exec_p(event.proc, elem->c_un.syscall)){ -+ pid_t saved_pid; -+ -+ event.thing = LT_EV_NONE; -+ event.e_un.signum = WSTOPSIG(status); -+ debug(1,"Placing breakpoints for the new program"); -+ event.proc->mask_32bit = 0; -+ event.proc->personality = 0; -+ event.proc->arch_ptr = NULL; -+ event.proc->filename = pid2name(event.proc->pid); -+ saved_pid = event.proc->pid; -+ event.proc->pid = 0; -+ breakpoints_init(event.proc); -+ event.proc->pid = saved_pid; -+ continue_process(event.proc->pid); -+ return &event; -+ } -+ } -+ - event.thing = LT_EV_BREAKPOINT; - if (!event.proc->instruction_pointer) { - event.proc->instruction_pointer = -Only in ltrace-0.5: wait_for_something.c.orig diff --git a/ltrace-0.5-fork-earlychild.patch b/ltrace-0.5-fork-earlychild.patch deleted file mode 100644 index 4bc8e1c..0000000 --- a/ltrace-0.5-fork-earlychild.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff -urp ltrace-0.5/ltrace.h ltrace-0.5-pm/ltrace.h ---- ltrace-0.5/ltrace.h 2009-03-03 02:07:44.000000000 +0100 -+++ ltrace-0.5-pm/ltrace.h 2009-03-03 02:07:19.000000000 +0100 -@@ -107,6 +107,9 @@ struct process { - int mask_32bit; /* 1 if 64-bit ltrace is tracing 32-bit process. */ - unsigned int personality; - int tracesysgood; /* signal indicating a PTRACE_SYSCALL trap */ -+ int early; /* for consistency checks, this is true for -+ * children whose TRAP was delivered before -+ * the fork message of the parent. */ - - int callstack_depth; - struct callstack_element callstack[MAX_CALLDEPTH]; -@@ -173,7 +176,7 @@ extern void reinitialize_breakpoints(str - - extern struct process *open_program(char *filename, pid_t pid); - extern void open_pid(pid_t pid, int verbose); --extern void open_forked_pid(pid_t pid); -+extern void open_forked_pid(pid_t pid, int early); - extern void show_summary(void); - - /* Arch-dependent stuff: */ -diff -urp ltrace-0.5/proc.c ltrace-0.5-pm/proc.c ---- ltrace-0.5/proc.c 2009-03-03 02:07:44.000000000 +0100 -+++ ltrace-0.5-pm/proc.c 2009-03-03 02:07:19.000000000 +0100 -@@ -59,10 +59,11 @@ void open_pid(pid_t pid, int verbose) - proc->pid = pid; - } - --void open_forked_pid(pid_t pid) -+void open_forked_pid(pid_t pid, int early) - { - char *filename = pid2name(pid); - struct process *proc = open_program(filename, 0); - proc->pid = pid; - proc->breakpoints_enabled = -1; -+ proc->early = early; - } -diff -urp ltrace-0.5/wait_for_something.c ltrace-0.5-pm/wait_for_something.c ---- ltrace-0.5/wait_for_something.c 2009-03-03 02:07:44.000000000 +0100 -+++ ltrace-0.5-pm/wait_for_something.c 2009-03-03 02:07:19.000000000 +0100 -@@ -45,10 +45,24 @@ struct event *wait_for_something(void) - perror("wait"); - exit(1); - } -+ - event.proc = pid2proc(pid); - if (!event.proc) { -- fprintf(stderr, "signal from wrong pid %u ?!?\n", pid); -- exit(1); -+ if(!opt_f) { -+ fprintf(stderr, "signal from wrong pid %u ?!?\n", pid); -+ exit(1); -+ } else { -+ /* Parent forked, but we got child's STOP -+ * signal first. */ -+ debug (1, "signal from forked child delivered ahead of time?"); -+ -+ event.thing = LT_EV_NONE; -+ event.e_un.signum = WSTOPSIG(status); -+ open_forked_pid(pid, 1); -+ event.proc = pid2proc(pid); -+ continue_after_signal(event.proc->pid, event.e_un.signum); -+ return &event; -+ } - } - get_arch_dep(event.proc); - event.proc->instruction_pointer = NULL; -@@ -104,7 +118,18 @@ struct event *wait_for_something(void) - child_pid = (pid_t) get_child_pid(event.proc->pid); - if (child_pid){ - debug (3, "fork: get_child_pid gave us %d", child_pid); -- open_forked_pid(child_pid); -+ -+ struct process *it = list_of_processes; -+ for (; it != NULL; it = it->next) -+ if (it->pid == child_pid) { -+ if (!it->early) -+ fprintf (stderr, -+ "Child %d re-delivered.\n", -+ child_pid); -+ break; -+ } -+ if (!it) -+ open_forked_pid(child_pid, 0); - } - enable_all_breakpoints(event.proc); - continue_after_signal(event.proc->pid, event.e_un.signum); diff --git a/ltrace-0.5-fork-ppc64.patch b/ltrace-0.5-fork-ppc64.patch deleted file mode 100644 index 567aac6..0000000 --- a/ltrace-0.5-fork-ppc64.patch +++ /dev/null @@ -1,90 +0,0 @@ -diff -urp ltrace-0.5/breakpoints.c ltrace-0.5-pm/breakpoints.c ---- ltrace-0.5/breakpoints.c 2009-03-02 19:43:27.000000000 -0500 -+++ ltrace-0.5-pm/breakpoints.c 2009-03-02 18:46:25.000000000 -0500 -@@ -98,8 +101,11 @@ void enable_all_breakpoints(struct proce - a = ptrace(PTRACE_PEEKTEXT, proc->pid, - sym2addr(proc, proc->list_of_symbols), - 0); -- if (a == 0x0) -+ if (a == 0x0) { -+ debug(2, "Not enabling breakpoints for pid %u " -+ "yet, PLT is not populated.", proc->pid); - return; -+ } - } - #endif - -@@ -178,6 +178,7 @@ void breakpoints_init(struct process *pr - } - proc->callstack_depth = 0; - proc->breakpoints_enabled = -1; -+ proc->old = 0; - } - - void reinitialize_breakpoints(struct process *proc) -diff -urp ltrace-0.5/ltrace.h ltrace-0.5-pm/ltrace.h ---- ltrace-0.5/ltrace.h 2009-03-02 19:43:27.000000000 -0500 -+++ ltrace-0.5-pm/ltrace.h 2009-03-02 19:06:43.000000000 -0500 -@@ -110,6 +110,7 @@ struct process { - int early; /* for consistency checks, this is true for - * children whose TRAP was delivered before - * the fork message of the parent. */ -+ int old; - - int callstack_depth; - struct callstack_element callstack[MAX_CALLDEPTH]; -diff -urp ltrace-0.5/proc.c ltrace-0.5-pm/proc.c ---- ltrace-0.5/proc.c 2009-03-02 19:43:27.000000000 -0500 -+++ ltrace-0.5-pm/proc.c 2009-03-02 19:07:50.000000000 -0500 -@@ -22,11 +22,8 @@ struct process *open_program(char *filen - } - proc->filename = filename; - proc->breakpoints_enabled = -1; -- proc->pid = 0; - breakpoints_init(proc); -- if (pid) { -- proc->pid = pid; -- } -+ proc->pid = pid; - - proc->next = list_of_processes; - list_of_processes = proc; -@@ -63,6 +60,9 @@ void open_forked_pid(pid_t pid, int earl - char *filename = pid2name(pid); - struct process *proc = open_program(filename, 0); - proc->pid = pid; -- proc->breakpoints_enabled = -1; -+#ifdef __powerpc__ -+ breakpoints_init(proc); -+ proc->breakpoints_enabled = 1; -+#endif - proc->early = early; - } -diff -urp ltrace-0.5/wait_for_something.c ltrace-0.5-pm/wait_for_something.c ---- ltrace-0.5/wait_for_something.c 2009-03-02 19:43:27.000000000 -0500 -+++ ltrace-0.5-pm/wait_for_something.c 2009-03-02 19:07:21.000000000 -0500 -@@ -46,6 +46,7 @@ struct event *wait_for_something(void) - exit(1); - } - -+ debug(3, "signal from pid %u, status %#x", pid, status); - event.proc = pid2proc(pid); - if (!event.proc) { - if(!opt_f) { -@@ -66,9 +67,13 @@ struct event *wait_for_something(void) - } - get_arch_dep(event.proc); - event.proc->instruction_pointer = NULL; -- debug(3, "signal from pid %u", pid); -- if (event.proc->breakpoints_enabled == -1) { -- enable_all_breakpoints(event.proc); -+ if (!event.proc->old) { -+ event.proc->old = 1; -+ if (event.proc->breakpoints_enabled == -1) { -+ debug (2, "BRANCH: enable breakpoints for the first time"); -+ enable_all_breakpoints(event.proc); -+ debug (2, "BRANCH: done enabling breakpoints for the first time"); -+ } - event.thing = LT_EV_NONE; - if(opt_f){ - trace_set_options(event.proc, event.proc->pid, TRACE_FORK); diff --git a/ltrace-0.5-fork.patch b/ltrace-0.5-fork.patch deleted file mode 100644 index a059dda..0000000 --- a/ltrace-0.5-fork.patch +++ /dev/null @@ -1,103 +0,0 @@ -diff -urp ltrace-0.5-1/ltrace.h ltrace-0.5/ltrace.h ---- ltrace-0.5-1/ltrace.h 2008-10-07 12:05:57.000000000 +0200 -+++ ltrace-0.5/ltrace.h 2008-10-07 12:06:20.000000000 +0200 -@@ -173,6 +173,7 @@ extern void reinitialize_breakpoints(str - - extern struct process *open_program(char *filename, pid_t pid); - extern void open_pid(pid_t pid, int verbose); -+extern void open_forked_pid(pid_t pid); - extern void show_summary(void); - - /* Arch-dependent stuff: */ -diff -urp ltrace-0.5-1/ltrace.h.orig ltrace-0.5/ltrace.h.orig ---- ltrace-0.5-1/ltrace.h.orig 2006-06-14 06:55:21.000000000 +0200 -+++ ltrace-0.5/ltrace.h.orig 2008-10-07 12:06:19.000000000 +0200 -@@ -12,6 +12,7 @@ - #include "sysdep.h" - - #define MAX_LIBRARY 30 -+#define TRACE_FORK 1 - - #if defined HAVE_LIBIBERTY || defined HAVE_LIBSUPC__ - # define USE_DEMANGLE -@@ -176,7 +177,7 @@ extern void show_summary(void); - - /* Arch-dependent stuff: */ - extern char *pid2name(pid_t pid); --extern void trace_set_options(struct process *proc, pid_t pid); -+extern void trace_set_options(struct process *proc, pid_t pid, int option); - extern void trace_me(void); - extern int trace_pid(pid_t pid); - extern void untrace_pid(pid_t pid); -@@ -204,5 +205,5 @@ extern void *sym2addr(struct process *, - #if 0 /* not yet */ - extern int umoven(struct process *proc, void *addr, int len, void *laddr); - #endif -- -+extern ulong get_child_pid(pid_t pid); - #endif -diff -urp ltrace-0.5-1/proc.c ltrace-0.5/proc.c ---- ltrace-0.5-1/proc.c 2008-10-07 12:05:58.000000000 +0200 -+++ ltrace-0.5/proc.c 2008-10-07 12:06:20.000000000 +0200 -@@ -58,3 +58,11 @@ void open_pid(pid_t pid, int verbose) - proc = open_program(filename, 0); - proc->pid = pid; - } -+ -+void open_forked_pid(pid_t pid) -+{ -+ char *filename = pid2name(pid); -+ struct process *proc = open_program(filename, 0); -+ proc->pid = pid; -+ proc->breakpoints_enabled = -1; -+} -Only in ltrace-0.5: proc.c.orig -diff -urp ltrace-0.5-1/testsuite/lib/ltrace.exp ltrace-0.5/testsuite/lib/ltrace.exp ---- ltrace-0.5-1/testsuite/lib/ltrace.exp 2006-03-14 00:12:01.000000000 +0100 -+++ ltrace-0.5/testsuite/lib/ltrace.exp 2008-10-07 12:06:20.000000000 +0200 -@@ -260,7 +260,7 @@ proc ltrace_saveoutput { args } { - proc ltrace_verify_output { file_to_search pattern {instance_no 0}} { - - # compute the number of PATTERN in FILE_TO_SEARCH by grep and wc. -- catch "exec sh -c {grep $pattern $file_to_search | wc -l ;exit}" output -+ catch "exec sh -c {egrep $pattern $file_to_search | wc -l ;exit}" output - verbose "output = $output" - - if { $instance_no == 0 } then { -diff -urp ltrace-0.5-1/testsuite/ltrace.minor/trace-fork.exp ltrace-0.5/testsuite/ltrace.minor/trace-fork.exp ---- ltrace-0.5-1/testsuite/ltrace.minor/trace-fork.exp 2006-03-14 00:12:01.000000000 +0100 -+++ ltrace-0.5/testsuite/ltrace.minor/trace-fork.exp 2008-10-07 12:06:20.000000000 +0200 -@@ -35,6 +35,19 @@ if [regexp {ELF from incompatible archit - - ltrace_saveoutput "${exec_output}" ${srcdir}/${subdir}/${testfile}.ltrace - --set pattern "fork" -+if [ regexp {Cannot attach} $exec_output ] { -+ fail "Couldn't attach to forked process!" -+ return -+} -+ -+set pattern "^fork" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 - -+set pattern {'^\[pid [0-9]*\][ \t]*(printf|puts)'} -+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 2 -+ -+set pattern {'^\[pid [0-9]*\][ \t]*wait'} -+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 -+ -+set pattern {'^\[pid [0-9]*\][ \t]*sleep'} -+ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 -diff -urp ltrace-0.5-1/wait_for_something.c ltrace-0.5/wait_for_something.c ---- ltrace-0.5-1/wait_for_something.c 2008-10-07 12:05:57.000000000 +0200 -+++ ltrace-0.5/wait_for_something.c 2008-10-07 12:06:20.000000000 +0200 -@@ -103,7 +103,8 @@ struct event *wait_for_something(void) - event.e_un.signum = WSTOPSIG(status); - child_pid = (pid_t) get_child_pid(event.proc->pid); - if (child_pid){ -- open_pid(child_pid,0); -+ debug (3, "fork: get_child_pid gave us %d", child_pid); -+ open_forked_pid(child_pid); - } - enable_all_breakpoints(event.proc); - continue_after_signal(event.proc->pid, event.e_un.signum); diff --git a/ltrace-0.5-gnuhash.patch b/ltrace-0.5-gnuhash.patch deleted file mode 100644 index 23a5c54..0000000 --- a/ltrace-0.5-gnuhash.patch +++ /dev/null @@ -1,165 +0,0 @@ -diff -urpd ltrace-0.5-orig/elf.c ltrace-0.5/elf.c ---- ltrace-0.5-orig/elf.c 2006-07-14 12:28:32.000000000 -0400 -+++ ltrace-0.5/elf.c 2006-07-14 16:47:31.000000000 -0400 -@@ -169,6 +169,8 @@ static void do_init_elf(struct ltelf *lt - Elf_Data *data; - size_t j; - -+ lte->hash_type = SHT_HASH; -+ - data = elf_getdata(scn, NULL); - if (data == NULL || elf_getdata(scn, data) != NULL - || data->d_off || data->d_size != shdr.sh_size) -@@ -209,6 +211,30 @@ static void do_init_elf(struct ltelf *lt - error(EXIT_FAILURE, 0, - "Unknown .hash sh_entsize in \"%s\"", - filename); -+#ifdef SHT_GNU_HASH -+ } else if (shdr.sh_type == SHT_GNU_HASH -+ && lte->hash == NULL) { -+ Elf_Data *data; -+ size_t j; -+ -+ lte->hash_type = SHT_GNU_HASH; -+ -+ if (shdr.sh_entsize != 0 -+ && shdr.sh_entsize != 4) { -+ error(EXIT_FAILURE, 0, -+ ".gnu.hash sh_entsize in \"%s\" should be 4, but is %d", -+ filename, shdr.sh_entsize); -+ } -+ -+ data = elf_getdata(scn, NULL); -+ if (data == NULL || elf_getdata(scn, data) != NULL -+ || data->d_off || data->d_size != shdr.sh_size) -+ error(EXIT_FAILURE, 0, -+ "Couldn't get .gnu.hash data from \"%s\"", -+ filename); -+ -+ lte->hash = (Elf32_Word *) data->d_buf; -+#endif - } else if (shdr.sh_type == SHT_PROGBITS - || shdr.sh_type == SHT_NOBITS) { - if (strcmp(name, ".plt") == 0) { -@@ -300,34 +329,81 @@ add_library_symbol(GElf_Addr addr, const - static int in_load_libraries(const char *name, struct ltelf *lte) - { - size_t i; -- unsigned long hash; -+ unsigned long hash -+#ifdef SHT_GNU_HASH -+ , gnu_hash -+#endif -+ ; - - if (!library_num) - return 1; - - hash = elf_hash((const unsigned char *)name); -+#ifdef SHT_GNU_HASH -+ gnu_hash = elf_gnu_hash((const unsigned char *)name); -+#endif - for (i = 1; i <= library_num; ++i) { -- Elf32_Word nbuckets, symndx; -- Elf32_Word *buckets, *chain; -- - if (lte[i].hash == NULL) - continue; - -- nbuckets = lte[i].hash[0]; -- buckets = <e[i].hash[2]; -- chain = <e[i].hash[2 + nbuckets]; -- for (symndx = buckets[hash % nbuckets]; -- symndx != STN_UNDEF; symndx = chain[symndx]) { -- GElf_Sym sym; -+#ifdef SHT_GNU_HASH -+ if (lte[i].hash_type == SHT_GNU_HASH) { -+ Elf32_Word * hashbase = lte[i].hash; -+ Elf32_Word nbuckets = *hashbase++; -+ Elf32_Word symbias = *hashbase++; -+ Elf32_Word bitmask_nwords = *hashbase++; -+ Elf32_Word bitmask_idxbits = bitmask_nwords - 1; -+ Elf32_Word shift = *hashbase++; -+ Elf32_Word * buckets; -+ Elf32_Word * chain_zero; -+ Elf32_Word bucket; - -- if (gelf_getsym(lte[i].dynsym, symndx, &sym) == NULL) -- error(EXIT_FAILURE, 0, -- "Couldn't get symbol from .dynsym"); -+ hashbase += lte[i].ehdr.e_ident[EI_CLASS] * bitmask_nwords; -+ buckets = hashbase; -+ hashbase += nbuckets; -+ chain_zero = hashbase - symbias; -+ bucket = buckets[gnu_hash % nbuckets]; - -- if (sym.st_value != 0 -- && sym.st_shndx != SHN_UNDEF -- && strcmp(name, lte[i].dynstr + sym.st_name) == 0) -- return 1; -+ if (bucket != 0) { -+ const Elf32_Word *hasharr = &chain_zero[bucket]; -+ do -+ if ((*hasharr & ~1u) == (gnu_hash & ~1u)) { -+ int symidx = hasharr - chain_zero; -+ GElf_Sym sym; -+ -+ if (gelf_getsym(lte[i].dynsym, symidx, &sym) == NULL) -+ error(EXIT_FAILURE, 0, -+ "Couldn't get symbol from .dynsym"); -+ -+ if (sym.st_value != 0 -+ && sym.st_shndx != SHN_UNDEF -+ && strcmp(name, lte[i].dynstr + sym.st_name) == 0) -+ return 1; -+ } -+ while ((*hasharr++ & 1u) == 0); -+ } -+ } else -+#endif -+ { -+ Elf32_Word nbuckets, symndx; -+ Elf32_Word *buckets, *chain; -+ nbuckets = lte[i].hash[0]; -+ buckets = <e[i].hash[2]; -+ chain = <e[i].hash[2 + nbuckets]; -+ -+ for (symndx = buckets[hash % nbuckets]; -+ symndx != STN_UNDEF; symndx = chain[symndx]) { -+ GElf_Sym sym; -+ -+ if (gelf_getsym(lte[i].dynsym, symndx, &sym) == NULL) -+ error(EXIT_FAILURE, 0, -+ "Couldn't get symbol from .dynsym"); -+ -+ if (sym.st_value != 0 -+ && sym.st_shndx != SHN_UNDEF -+ && strcmp(name, lte[i].dynstr + sym.st_name) == 0) -+ return 1; -+ } - } - } - return 0; -diff -urpd ltrace-0.5-orig/elf.h ltrace-0.5/elf.h ---- ltrace-0.5-orig/elf.h 2006-07-14 12:28:32.000000000 -0400 -+++ ltrace-0.5/elf.h 2006-07-14 13:26:56.000000000 -0400 -@@ -24,6 +24,7 @@ struct ltelf { - GElf_Addr *opd_addr; - size_t opd_size; - Elf32_Word *hash; -+ int hash_type; - int lte_flags; - }; - -diff -urpd ltrace-0.5-orig/options.c ltrace-0.5/options.c ---- ltrace-0.5-orig/options.c 2006-07-14 12:28:32.000000000 -0400 -+++ ltrace-0.5/options.c 2006-07-14 16:46:01.000000000 -0400 -@@ -3,7 +3,7 @@ - #endif - - #ifndef PACKAGE_VERSION --# define PACKAGE_VERSION "0.3.32" -+# error need package version - #endif - - #include diff --git a/ltrace-0.5-ia64-sigill.patch b/ltrace-0.5-ia64-sigill.patch index 566594f..9dab07b 100644 --- a/ltrace-0.5-ia64-sigill.patch +++ b/ltrace-0.5-ia64-sigill.patch @@ -82,76 +82,3 @@ diff -Nurp ltrace-0.5-orig/testsuite/ltrace.torture/ia64-sigill.s ltrace-0.5/tes + .endp main# + .section .note.GNU-stack,"",@progbits + .ident "GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-3)" -diff -Nurp ltrace-0.5-orig/wait_for_something.c ltrace-0.5/wait_for_something.c ---- ltrace-0.5-orig/wait_for_something.c 2007-05-04 12:39:00.000000000 -0400 -+++ ltrace-0.5/wait_for_something.c 2007-05-04 13:53:30.000000000 -0400 -@@ -27,6 +27,7 @@ struct event *wait_for_something(void) - pid_t pid, child_pid; - int status; - int tmp; -+ int stop_signal; - - if (!list_of_processes) { - debug(1, "No more children"); -@@ -92,15 +93,38 @@ struct event *wait_for_something(void) - event.thing = LT_EV_UNKNOWN; - return &event; - } -- if ((WSTOPSIG(status) != (SIGTRAP | event.proc->tracesysgood)) && -- (WSTOPSIG(status) != SIGTRAP)) { -+ -+ stop_signal = WSTOPSIG(status); -+ event.thing = LT_EV_NONE; -+ -+ /* On some targets, breakpoints are signalled not using -+ SIGTRAP, but also with SIGILL, SIGSEGV or SIGEMT. Check -+ for these. */ -+ if (stop_signal == SIGSEGV -+ || stop_signal == SIGILL -+#ifdef SIGEMT -+ || stop_signal == SIGEMT -+#endif -+ ) { -+ // If we didn't need to know IP so far, get it now. -+ void * addr = opt_i -+ ? event.proc->instruction_pointer -+ : (event.proc->instruction_pointer = get_instruction_pointer (event.proc)); -+ -+ if (address2bpstruct(event.proc, addr)) -+ stop_signal = SIGTRAP; -+ } -+ -+ if (event.thing == LT_EV_NONE -+ && (stop_signal != (SIGTRAP | event.proc->tracesysgood)) -+ && (stop_signal != SIGTRAP)) { - event.thing = LT_EV_SIGNAL; -- event.e_un.signum = WSTOPSIG(status); -+ event.e_un.signum = stop_signal; - return &event; - } -- if((WSTOPSIG(status) == SIGTRAP) && (status & FORK_MASK)) { -+ if(stop_signal == SIGTRAP && (status & FORK_MASK)) { - event.thing = LT_EV_NONE; -- event.e_un.signum = WSTOPSIG(status); -+ event.e_un.signum = stop_signal; - child_pid = (pid_t) get_child_pid(event.proc->pid); - if (child_pid){ - debug (3, "fork: get_child_pid gave us %d", child_pid); -@@ -110,7 +134,7 @@ struct event *wait_for_something(void) - continue_after_signal(event.proc->pid, event.e_un.signum); - return &event; - } -- if (WSTOPSIG(status) == SIGTRAP){ -+ if (stop_signal == SIGTRAP){ - /* Check whether this SIGTRAP is received just after execve is called for this process */ - struct callstack_element *elem; - elem = &event.proc->callstack[event.proc->callstack_depth - 1]; -@@ -118,7 +142,7 @@ struct event *wait_for_something(void) - pid_t saved_pid; - - event.thing = LT_EV_NONE; -- event.e_un.signum = WSTOPSIG(status); -+ event.e_un.signum = stop_signal; - debug(1,"Placing breakpoints for the new program"); - event.proc->mask_32bit = 0; - event.proc->personality = 0; diff --git a/ltrace-0.5-man.patch b/ltrace-0.5-man.patch deleted file mode 100644 index 789b6e5..0000000 --- a/ltrace-0.5-man.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ru ltrace-0.5/ltrace.1 ltrace-0.5-PATCHED/ltrace.1 ---- ltrace-0.5/ltrace.1 2006-06-16 03:15:18.000000000 +0200 -+++ ltrace-0.5-PATCHED/ltrace.1 2007-01-25 14:28:44.000000000 +0100 -@@ -153,8 +153,6 @@ - .LP - It only works on Linux and in a small subset of architectures. - .LP --Only ELF32 binaries are supported. --.LP - Calls to dlopen()ed libraries will not be traced. - .PP - If you like to report a bug, send a notice to the author, or use the diff --git a/ltrace-0.5-o.patch b/ltrace-0.5-o.patch deleted file mode 100644 index 74e728b..0000000 --- a/ltrace-0.5-o.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -ur ltrace-0.5/summary.c ltrace-0.5-dasho/summary.c ---- ltrace-0.5/summary.c 2006-04-24 12:14:01.000000000 -0400 -+++ ltrace-0.5-dasho/summary.c 2008-05-19 15:22:13.000000000 -0400 -@@ -68,16 +68,17 @@ - - qsort(entries, num_entries, sizeof(*entries), compar); - -- printf("%% time seconds usecs/call calls function\n"); -- printf -- ("------ ----------- ----------- --------- --------------------\n"); -+ fprintf(output, -+ "%% time seconds usecs/call calls function\n"); -+ fprintf(output, -+ "------ ----------- ----------- --------- --------------------\n"); - for (i = 0; i < num_entries; i++) { - unsigned long long int c; - unsigned long long int p; - c = 1000000 * (int)entries[i].tv.tv_sec + - (int)entries[i].tv.tv_usec; - p = 100000 * c / tot_usecs + 5; -- printf("%3lu.%02lu %4d.%06d %11lu %9d %s\n", -+ fprintf(output, "%3lu.%02lu %4d.%06d %11lu %9d %s\n", - (unsigned long int)(p / 1000), - (unsigned long int)((p / 10) % 100), - (int)entries[i].tv.tv_sec, (int)entries[i].tv.tv_usec, -@@ -85,8 +86,8 @@ - entries[i].count, - opt_C ? my_demangle(entries[i].name) : entries[i].name); - } -- printf -- ("------ ----------- ----------- --------- --------------------\n"); -- printf("100.00 %4lu.%06lu %9d total\n", tot_usecs / 1000000, -- tot_usecs % 1000000, tot_count); -+ fprintf(output, -+ "------ ----------- ----------- --------- --------------------\n"); -+ fprintf(output, "100.00 %4lu.%06lu %9d total\n", -+ tot_usecs / 1000000, tot_usecs % 1000000, tot_count); - } -diff -urp ltrace-0.5/testsuite/ltrace.minor/count-record.exp ltrace-0.5-pm/testsuite/ltrace.minor/count-record.exp ---- ltrace-0.5/testsuite/ltrace.minor/count-record.exp 2006-03-14 00:12:01.000000000 +0100 -+++ ltrace-0.5-pm/testsuite/ltrace.minor/count-record.exp 2009-02-20 16:48:28.000000000 +0100 -@@ -27,8 +27,6 @@ if [regexp {ELF from incompatible archit - } - - --ltrace_saveoutput $exec_output $srcdir/$subdir/$binfile.ltrace -- - # - # This is a sample output and Verify the forth and fifth column. - # diff --git a/ltrace-0.5-opd.patch b/ltrace-0.5-opd.patch deleted file mode 100644 index 6a34220..0000000 --- a/ltrace-0.5-opd.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -urp ltrace-0.5/elf.c ltrace-0.5-pm/elf.c ---- ltrace-0.5/elf.c 2006-08-23 17:45:47.000000000 +0200 -+++ ltrace-0.5-pm/elf.c 2006-08-23 17:47:58.000000000 +0200 -@@ -342,12 +342,18 @@ static GElf_Addr opd2addr(struct ltelf * - if (!lte->opd) - return (GElf_Addr) (long) addr; - -+#ifdef __ia64__ -+ /* XXX: On Itaniums, gelf seems to return function address -+ instead of address of function descriptor. */ -+ ret_val = (GElf_Addr)addr; -+#else - base = (long)lte->opd->d_buf; - offset = (long)addr - (long)lte->opd_addr; - if (offset > lte->opd_size) - error(EXIT_FAILURE, 0, "static plt not in .opd"); - - ret_val = (GElf_Addr) * (long *)(base + offset); -+#endif - return ret_val; - } - -Only in ltrace-0.5-pm: elf.c~ diff --git a/ltrace-0.5-ppc-plt-glink.patch b/ltrace-0.5-ppc-plt-glink.patch deleted file mode 100644 index 570ecd3..0000000 --- a/ltrace-0.5-ppc-plt-glink.patch +++ /dev/null @@ -1,220 +0,0 @@ -diff -urp ltrace-0.5/elf.c ltrace-0.5-pm/elf.c ---- ltrace-0.5/elf.c 2010-05-17 14:49:20.004577987 -0400 -+++ ltrace-0.5-pm/elf.c 2010-05-17 14:54:31.841118855 -0400 -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - #include "ltrace.h" - #include "elf.h" -@@ -29,6 +30,114 @@ static GElf_Addr opd2addr(struct ltelf * - extern char *PLTs_initialized_by_here; - #endif - -+// xxx make it only appear on PPC -+#ifndef DT_PPC_GOT -+# define DT_PPC_GOT (DT_LOPROC + 0) -+#endif -+ -+#define PPC_PLT_STUB_SIZE 16 -+ -+static Elf_Data *loaddata(Elf_Scn *scn, GElf_Shdr *shdr) -+{ -+ Elf_Data *data = elf_getdata(scn, NULL); -+ if (data == NULL || elf_getdata(scn, data) != NULL -+ || data->d_off || data->d_size != shdr->sh_size) -+ return NULL; -+ return data; -+} -+ -+static int inside(GElf_Addr addr, GElf_Shdr *shdr) -+{ -+ return addr >= shdr->sh_addr -+ && addr < shdr->sh_addr + shdr->sh_size; -+} -+ -+static int maybe_pick_section(GElf_Addr addr, -+ Elf_Scn *in_sec, GElf_Shdr *in_shdr, -+ Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr) -+{ -+ if (inside (addr, in_shdr)) { -+ *tgt_sec = in_sec; -+ *tgt_shdr = *in_shdr; -+ return 1; -+ } -+ return 0; -+} -+ -+static int get_section_covering(struct ltelf *lte, GElf_Addr addr, -+ Elf_Scn **tgt_sec, GElf_Shdr *tgt_shdr) -+{ -+ int i; -+ for (i = 1; i < lte->ehdr.e_shnum; ++i) { -+ Elf_Scn *scn; -+ GElf_Shdr shdr; -+ -+ scn = elf_getscn(lte->elf, i); -+ if (scn == NULL || gelf_getshdr(scn, &shdr) == NULL) { -+ debug(1, "Couldn't read section or header."); -+ return 0; -+ } -+ -+ if (maybe_pick_section(addr, scn, &shdr, tgt_sec, tgt_shdr)) -+ return 1; -+ } -+ -+ return 0; -+} -+ -+static GElf_Addr read32be(Elf_Data *data, size_t offset) -+{ -+ if (data->d_size < offset + 4) { -+ debug(1, "Not enough data to read 32bit value at offset %z.", -+ offset); -+ return 0; -+ } -+ -+ unsigned char const *buf = data->d_buf + offset; -+ return ((Elf32_Word)buf[0] << 24) -+ | ((Elf32_Word)buf[1] << 16) -+ | ((Elf32_Word)buf[2] << 8) -+ | ((Elf32_Word)buf[3]); -+} -+ -+static GElf_Addr get_glink_vma(struct ltelf *lte, GElf_Addr ppcgot, -+ Elf_Data *plt_data) -+{ -+ Elf_Scn *ppcgot_sec = NULL; -+ GElf_Shdr ppcgot_shdr; -+ if (ppcgot != 0 -+ && !get_section_covering(lte, ppcgot, &ppcgot_sec, &ppcgot_shdr)) -+ // xxx should be the log out -+ fprintf(stderr, -+ "DT_PPC_GOT=%#llx, but no such section found.\n", -+ ppcgot); -+ -+ if (ppcgot_sec != NULL) { -+ Elf_Data *data = loaddata(ppcgot_sec, &ppcgot_shdr); -+ if (data == NULL -+ || data->d_size < 8 ) -+ debug(1, "Couldn't read GOT data."); -+ else { -+ // where PPCGOT begins in .got -+ size_t offset = ppcgot - ppcgot_shdr.sh_addr; -+ GElf_Addr glink_vma = read32be(data, offset + 4); -+ if (glink_vma != 0) { -+ debug(1, "PPC GOT glink_vma address: %#llx", -+ glink_vma); -+ return glink_vma; -+ } -+ } -+ } -+ -+ if (plt_data != NULL) { -+ GElf_Addr glink_vma = read32be(plt_data, 0); -+ debug(1, ".plt glink_vma address: %#llx", glink_vma); -+ return glink_vma; -+ } -+ -+ return 0; -+} -+ - static void do_init_elf(struct ltelf *lte, const char *filename) - { - int i; -@@ -74,6 +183,9 @@ static void do_init_elf(struct ltelf *lt - error(EXIT_FAILURE, 0, - "\"%s\" is ELF from incompatible architecture", filename); - -+ Elf_Data *plt_data = NULL; -+ GElf_Addr ppcgot = 0; -+ - for (i = 1; i < lte->ehdr.e_shnum; ++i) { - Elf_Scn *scn; - GElf_Shdr shdr; -@@ -164,6 +276,10 @@ static void do_init_elf(struct ltelf *lt - relplt_addr = dyn.d_un.d_ptr; - else if (dyn.d_tag == DT_PLTRELSZ) - relplt_size = dyn.d_un.d_val; -+ else if (dyn.d_tag == DT_PPC_GOT) { -+ ppcgot = dyn.d_un.d_val; -+ debug(1, "ppcgot %#llx", ppcgot); -+ } - } - } else if (shdr.sh_type == SHT_HASH) { - Elf_Data *data; -@@ -226,9 +342,8 @@ static void do_init_elf(struct ltelf *lt - filename, shdr.sh_entsize); - } - -- data = elf_getdata(scn, NULL); -- if (data == NULL || elf_getdata(scn, data) != NULL -- || data->d_off || data->d_size != shdr.sh_size) -+ data = loaddata(scn, &shdr); -+ if (data == NULL) - error(EXIT_FAILURE, 0, - "Couldn't get .gnu.hash data from \"%s\"", - filename); -@@ -243,6 +358,12 @@ static void do_init_elf(struct ltelf *lt - if (shdr.sh_flags & SHF_EXECINSTR) { - lte->lte_flags |= LTE_PLT_EXECUTABLE; - } -+ if (lte->ehdr.e_machine == EM_PPC) { -+ plt_data = loaddata(scn, &shdr); -+ if (plt_data == NULL) -+ fprintf(stderr, -+ "Can't load .plt data\n"); -+ } - } else if (strcmp(name, ".opd") == 0) { - lte->opd_addr = (GElf_Addr *) (long) shdr.sh_addr; - lte->opd_size = shdr.sh_size; -@@ -259,7 +380,22 @@ static void do_init_elf(struct ltelf *lt - debug(1, "%s has no PLT relocations", filename); - lte->relplt = NULL; - lte->relplt_count = 0; -+ } else if (relplt_size == 0) { -+ debug(1, "%s has unknown PLT size", filename); -+ lte->relplt = NULL; -+ lte->relplt_count = 0; - } else { -+ if (lte->ehdr.e_machine == EM_PPC) { -+ GElf_Addr glink_vma -+ = get_glink_vma(lte, ppcgot, plt_data); -+ -+ assert (relplt_size % 12 == 0); -+ size_t count = relplt_size / 12; // size of RELA entry -+ lte->plt_stub_vma = glink_vma -+ - (GElf_Addr)count * PPC_PLT_STUB_SIZE; -+ debug(1, "stub_vma is %#llx", lte->plt_stub_vma); -+ } -+ - for (i = 1; i < lte->ehdr.e_shnum; ++i) { - Elf_Scn *scn; - GElf_Shdr shdr; -@@ -482,6 +619,13 @@ struct library_symbol *read_elf(struct p - enum toplt pltt; - if (lte->ehdr.e_machine == EM_PPC) { - addr = sym.st_value; -+ /* If we have neither the symbol -+ * address, nor the PLT stub address, -+ * the tracing will probably fail. */ -+ if (addr == 0 && lte->plt_stub_vma != 0) { -+ addr = lte->plt_stub_vma -+ + PPC_PLT_STUB_SIZE * i; -+ } - pltt = LS_TOPLT_EXEC; - } - else { -diff -urp ltrace-0.5/elf.h ltrace-0.5-pm/elf.h ---- ltrace-0.5/elf.h 2010-05-17 14:49:19.844578787 -0400 -+++ ltrace-0.5-pm/elf.h 2010-05-17 14:00:52.844954178 -0400 -@@ -26,6 +26,7 @@ struct ltelf { - Elf32_Word *hash; - int hash_type; - int lte_flags; -+ GElf_Addr plt_stub_vma; - }; - - #define LTE_HASH_MALLOCED 1 diff --git a/ltrace-0.5-ppc-symval.patch b/ltrace-0.5-ppc-symval.patch deleted file mode 100644 index 94235ae..0000000 --- a/ltrace-0.5-ppc-symval.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -Burp ltrace-0.5-orig/elf.c ltrace-0.5/elf.c ---- ltrace-0.5-orig/elf.c 2006-08-30 02:38:17.000000000 +0200 -+++ ltrace-0.5/elf.c 2006-08-30 03:42:30.000000000 +0200 -@@ -478,10 +478,17 @@ struct library_symbol *read_elf(struct p - - name = lte->dynstr + sym.st_name; - if (in_load_libraries(name, lte)) { -- addr = arch_plt_sym_val(lte, i, &rela); -- add_library_symbol(addr, name, &library_symbols, -- (PLTS_ARE_EXECUTABLE(lte) -- ? LS_TOPLT_EXEC : LS_TOPLT_POINT), -+ enum toplt pltt; -+ if (lte->ehdr.e_machine == EM_PPC) { -+ addr = sym.st_value; -+ pltt = LS_TOPLT_EXEC; -+ } -+ else { -+ addr = arch_plt_sym_val(lte, i, &rela); -+ pltt = (PLTS_ARE_EXECUTABLE(lte) -+ ? LS_TOPLT_EXEC : LS_TOPLT_POINT); -+ } -+ add_library_symbol(addr, name, &library_symbols, pltt, - ELF64_ST_BIND(sym.st_info) == STB_WEAK); - if (!lib_tail) - lib_tail = &(library_symbols->next); diff --git a/ltrace-0.5-s390-31-on-64.patch b/ltrace-0.5-s390-31-on-64.patch deleted file mode 100644 index 213db03..0000000 --- a/ltrace-0.5-s390-31-on-64.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -urp ltrace-0.5/sysdeps/linux-gnu/s390/arch.h ltrace-0.5-64-31/sysdeps/linux-gnu/s390/arch.h ---- ltrace-0.5/sysdeps/linux-gnu/s390/arch.h 2006-04-24 16:06:23.000000000 -0400 -+++ ltrace-0.5-64-31/sysdeps/linux-gnu/s390/arch.h 2009-02-25 13:56:16.000000000 -0500 -@@ -12,6 +12,11 @@ - #define LT_ELF_MACHINE EM_S390 - #define LT_ELFCLASS2 ELFCLASS32 - #define LT_ELF_MACHINE2 EM_S390 -+ -+/* __NR_fork, __NR_clone, __NR_clone2, __NR_vfork and __NR_execve -+ from asm-s390/unistd.h. */ -+#define FORK_EXEC_SYSCALLS , { 2, 120, -1, 190, 11 } -+ - #else - #define LT_ELFCLASS ELFCLASS32 - #define LT_ELF_MACHINE EM_S390 diff --git a/ltrace-0.5-s390-args.patch b/ltrace-0.5-s390-args.patch deleted file mode 100644 index 61a532d..0000000 --- a/ltrace-0.5-s390-args.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- ltrace/sysdeps/linux-gnu/s390/trace.c.orig 2007-12-17 04:57:08.000000000 +0530 -+++ ltrace/sysdeps/linux-gnu/s390/trace.c 2007-12-17 05:04:30.000000000 +0530 -@@ -185,8 +185,15 @@ - ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR6, 0); - break; - default: -+ /*Rest of the params saved in stack */ -+ if (arg_num >= 5) { -+ ret = ptrace(PTRACE_PEEKUSER, proc->pid, -+ proc->stack_pointer + 96 + -+ 4 * (arg_num - 5), 0); -+ } else { -+ fprintf(stderr, "gimme_arg called with wrong arguments\n"); -+ exit(2); -+ } -- fprintf(stderr, "gimme_arg called with wrong arguments\n"); -- exit(2); - } - #ifdef __s390x__ - if (proc->mask_32bit) diff --git a/ltrace-0.5-testsuite.patch b/ltrace-0.5-testsuite.patch deleted file mode 100644 index 597c374..0000000 --- a/ltrace-0.5-testsuite.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff -urpd ltrace-0.5-orig/testsuite/ltrace.main/system_calls.exp ltrace-0.5/testsuite/ltrace.main/system_calls.exp ---- ltrace-0.5-orig/testsuite/ltrace.main/system_calls.exp 2006-07-14 16:51:31.000000000 -0400 -+++ ltrace-0.5/testsuite/ltrace.main/system_calls.exp 2006-07-14 17:12:58.000000000 -0400 -@@ -40,9 +40,9 @@ set pattern "SYS_brk" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 - set pattern "SYS_open" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 --set pattern "SYS_fstat" -+set pattern "SYS_(new)?fstat" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 --set pattern "SYS_mmap" -+set pattern "SYS_(old_)?mmap" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 - set pattern "SYS_close" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 -@@ -55,7 +55,7 @@ set pattern "SYS_symlink" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 - set pattern "SYS_unlink" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 --set pattern "SYS_stat" -+set pattern "SYS_(new)?stat" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 - set pattern "SYS_access" - ltrace_verify_output ${srcdir}/${subdir}/${testfile}.ltrace $pattern 1 -diff -urpd ltrace-0.5-orig/testsuite/ltrace.minor/trace-clone.exp ltrace-0.5/testsuite/ltrace.minor/trace-clone.exp ---- ltrace-0.5-orig/testsuite/ltrace.minor/trace-clone.exp 2006-07-14 16:51:31.000000000 -0400 -+++ ltrace-0.5/testsuite/ltrace.minor/trace-clone.exp 2006-07-14 16:55:52.000000000 -0400 -@@ -30,7 +30,7 @@ if [regexp {ELF from incompatible archit - fail "32-bit ltrace can not perform on 64-bit PUTs and rebuild ltrace in 64 bit mode!" - return - } elseif [ regexp {Operation not permitted} $exec_output ] { -- fail "Operation not permitted, see testrun.log for details!" -+ xfail "Operation not permitted, see testrun.log for details!" - return - } elseif [ regexp {killed by SIGKILL} $exec_output ] { - fail "killed by SIGKILL!" -diff -urp ltrace-0.5/testsuite/ltrace.minor/demangle-lib.cpp ltrace-0.5-m/testsuite/ltrace.minor/demangle-lib.cpp ---- ltrace-0.5/testsuite/ltrace.minor/demangle-lib.cpp 2006-03-14 00:12:01.000000000 +0100 -+++ ltrace-0.5-m/testsuite/ltrace.minor/demangle-lib.cpp 2008-09-01 13:11:10.000000000 +0200 -@@ -1,5 +1,6 @@ - #include - #include -+#include - - #include"demangle.h" - diff --git a/ltrace-0.6.0-exec-stripped.patch b/ltrace-0.6.0-exec-stripped.patch new file mode 100644 index 0000000..25bd121 --- /dev/null +++ b/ltrace-0.6.0-exec-stripped.patch @@ -0,0 +1,63 @@ +diff -up ltrace-0.6.0/ltrace-elf.c\~ ltrace-0.6.0/ltrace-elf.c +--- ltrace-0.6.0/ltrace-elf.c~ 2011-02-14 16:48:25.000000000 +0100 ++++ ltrace-0.6.0/ltrace-elf.c 2011-02-14 18:13:03.000000000 +0100 +@@ -609,6 +609,7 @@ read_elf(Process *proc) { + struct ltelf lte[MAX_LIBRARIES + 1]; + size_t i; + struct opt_x_t *xptr; ++ struct opt_x_t *opt_x_loc = opt_x; + struct library_symbol **lib_tail = NULL; + int exit_out = 0; + int count = 0; +@@ -722,11 +723,11 @@ read_elf(Process *proc) { + main_cheat = (struct opt_x_t *)malloc(sizeof(struct opt_x_t)); + if (main_cheat == NULL) + error(EXIT_FAILURE, 0, "Couldn't allocate memory"); +- main_cheat->next = opt_x; ++ main_cheat->next = opt_x_loc; + main_cheat->found = 0; + main_cheat->name = PLTs_initialized_by_here; + +- for (xptr = opt_x; xptr; xptr = xptr->next) ++ for (xptr = opt_x_loc; xptr; xptr = xptr->next) + if (strcmp(xptr->name, PLTs_initialized_by_here) == 0 + && main_cheat) { + free(main_cheat); +@@ -734,7 +735,7 @@ read_elf(Process *proc) { + break; + } + if (main_cheat) +- opt_x = main_cheat; ++ opt_x_loc = main_cheat; + } + #endif + } else { +@@ -756,7 +757,7 @@ read_elf(Process *proc) { + if (!addr) + continue; + +- for (xptr = opt_x; xptr; xptr = xptr->next) ++ for (xptr = opt_x_loc; xptr; xptr = xptr->next) + if (xptr->name && strcmp(xptr->name, name) == 0) { + /* FIXME: Should be able to use &library_symbols as above. But + when you do, none of the real library symbols cause breaks. */ +@@ -769,7 +770,7 @@ read_elf(Process *proc) { + + unsigned found_count = 0; + +- for (xptr = opt_x; xptr; xptr = xptr->next) { ++ for (xptr = opt_x_loc; xptr; xptr = xptr->next) { + if (xptr->found) + continue; + +@@ -791,7 +792,7 @@ read_elf(Process *proc) { + } + } + +- for (xptr = opt_x; xptr; xptr = xptr->next) ++ for (xptr = opt_x_loc; xptr; xptr = xptr->next) + if ( ! xptr->found) { + char *badthing = "WARNING"; + #ifdef PLT_REINITALISATION_BP + +Diff finished. Mon Feb 14 18:13:11 2011 diff --git a/ltrace-0.6.0-return-string-n.patch b/ltrace-0.6.0-return-string-n.patch new file mode 100644 index 0000000..a3c8320 --- /dev/null +++ b/ltrace-0.6.0-return-string-n.patch @@ -0,0 +1,16 @@ +diff -up ltrace-0.6.0/output.c\~ ltrace-0.6.0/output.c +--- ltrace-0.6.0/output.c~ 2011-02-14 16:48:25.000000000 +0100 ++++ ltrace-0.6.0/output.c 2011-02-15 00:35:39.000000000 +0100 +@@ -202,7 +204,9 @@ output_left(enum tof type, Process *proc + current_column += fprintf(options.output, ", "); + } + } +- if (func->params_right) { ++ if (func->params_right ++ || func->return_info->type == ARGTYPE_STRING_N ++ || func->return_info->type == ARGTYPE_ARRAY) { + save_register_args(type, proc); + } + } + +Diff finished. Tue Feb 15 00:35:44 2011 diff --git a/ltrace-ppc32fc5.patch b/ltrace-ppc32fc5.patch deleted file mode 100644 index 30ff28d..0000000 --- a/ltrace-ppc32fc5.patch +++ /dev/null @@ -1,147 +0,0 @@ -Index: output.c -=================================================================== ---- output.c (revision 45) -+++ output.c (working copy) -@@ -170,7 +170,6 @@ void output_left(enum tof type, struct p - } - if (current_proc) { - fprintf(output, " \n"); -- current_proc = 0; - current_column = 0; - } - current_proc = proc; -Index: elf.c -=================================================================== ---- elf.c (revision 45) -+++ elf.c (working copy) -@@ -403,7 +403,7 @@ struct library_symbol *read_elf(struct p - add_library_symbol(addr, name, &library_symbols, - (PLTS_ARE_EXECUTABLE(lte) - ? LS_TOPLT_EXEC : LS_TOPLT_POINT), -- ELF64_ST_BIND(sym.st_info) != 0); -+ ELF64_ST_BIND(sym.st_info) == STB_WEAK); - if (!lib_tail) - lib_tail = &(library_symbols->next); - } -@@ -415,7 +415,7 @@ struct library_symbol *read_elf(struct p - already there. */ - main_cheat = (struct opt_x_t *)malloc(sizeof(struct opt_x_t)); - if (main_cheat == NULL) -- error(EXIT_FAILURE, 0, "Couldn allocate memory"); -+ error(EXIT_FAILURE, 0, "Couldn't allocate memory"); - main_cheat->next = opt_x; - main_cheat->found = 0; - main_cheat->name = PLTs_initialized_by_here; -@@ -464,7 +464,7 @@ struct library_symbol *read_elf(struct p - if (strcmp(xptr->name, PLTs_initialized_by_here) == 0) { - if (lte->ehdr.e_entry) { - add_library_symbol ( -- elf_plt2addr (lte, (void*)(long) -+ opd2addr (lte, (void*)(long) - lte->ehdr.e_entry), - PLTs_initialized_by_here, - lib_tail, 1, 0); -Index: sysdeps/linux-gnu/ppc/plt.c -=================================================================== ---- sysdeps/linux-gnu/ppc/plt.c (revision 45) -+++ sysdeps/linux-gnu/ppc/plt.c (working copy) -@@ -1,4 +1,5 @@ - #include -+#include - #include "ltrace.h" - #include "elf.h" - #include "debug.h" -@@ -15,8 +16,7 @@ void *sym2addr(struct process *proc, str - long addr = sym->enter_addr; - long pt_ret; - -- debug(3, 0); -- -+ debug(2, "sym2addr: sym=%s, pid=%d, enter_addr=%p", sym->name, proc->pid, addr); - if (sym->plt_type != LS_TOPLT_POINT) { - return addr; - } -@@ -46,6 +46,10 @@ void *sym2addr(struct process *proc, str - // break-point right in the PLT. - - pt_ret = ptrace(PTRACE_PEEKTEXT, proc->pid, addr, 0); -+ if (pt_ret == -1 && errno) { -+ perror ("ptrace"); -+ return 0; -+ } - - if (proc->mask_32bit) { - // Assume big-endian. -Index: sysdeps/linux-gnu/ppc/regs.c -=================================================================== ---- sysdeps/linux-gnu/ppc/regs.c (revision 45) -+++ sysdeps/linux-gnu/ppc/regs.c (working copy) -@@ -5,8 +5,10 @@ - #include - #include - #include -+#include - - #include "ltrace.h" -+#include "debug.h" - - #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR)) - # define PTRACE_PEEKUSER PTRACE_PEEKUSR -@@ -35,6 +37,11 @@ void *get_stack_pointer(struct process * - - void *get_return_addr(struct process *proc, void *stack_pointer) - { -- return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_LNK, -- 0); -+ long p = ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_LNK, NULL); -+ if (p == -1 && errno) { -+ perror ("ptrace"); -+ return NULL; -+ } -+ debug (3, "pid=%d ret=%p", proc->pid, p); -+ return (void*)p; - } -Index: sysdeps/linux-gnu/ppc/arch.h -=================================================================== ---- sysdeps/linux-gnu/ppc/arch.h (revision 45) -+++ sysdeps/linux-gnu/ppc/arch.h (working copy) -@@ -7,6 +7,7 @@ - #ifdef __powerpc64__ // Says 'ltrace' is 64 bits, says nothing about target. - #define LT_ELFCLASS2 ELFCLASS64 - #define LT_ELF_MACHINE2 EM_PPC64 -+#endif - - #define PLT_REINITALISATION_BP "_start" - -@@ -16,6 +17,3 @@ - #if (PPC_NOP_LENGTH != BREAKPOINT_LENGTH) - #error "Length of the breakpoint value not equal to the length of a nop instruction" - #endif -- -- --#endif -Index: breakpoints.c -=================================================================== ---- breakpoints.c (revision 45) -+++ breakpoints.c (working copy) -@@ -28,6 +28,7 @@ insert_breakpoint(struct process *proc, - struct library_symbol *libsym) - { - struct breakpoint *sbp; -+ debug(1, "insert_breakpoint(symbol=%s, addr=%p)", libsym?libsym->name:"(nil)", addr); - - if (!proc->breakpoints) { - proc->breakpoints = -@@ -165,11 +166,9 @@ void breakpoints_init(struct process *pr - } else { - proc->list_of_symbols = NULL; - } -- sym = proc->list_of_symbols; -- while (sym) { -+ for (sym = proc->list_of_symbols; sym; sym = sym->next) { - /* proc->pid==0 delays enabling. */ - insert_breakpoint(proc, sym2addr(proc, sym), sym); -- sym = sym->next; - } - proc->callstack_depth = 0; - proc->breakpoints_enabled = -1; diff --git a/ltrace.spec b/ltrace.spec index 4b18e8e..5adcc4c 100644 --- a/ltrace.spec +++ b/ltrace.spec @@ -1,7 +1,7 @@ Summary: Tracks runtime library calls from dynamically linked executables Name: ltrace -Version: 0.5 -Release: 19.45svn%{?dist} +Version: 0.6.0 +Release: 1%{?dist} URL: http://ltrace.alioth.debian.org/ License: GPLv2+ Group: Development/Debuggers @@ -10,35 +10,16 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: elfutils-libelf-devel dejagnu BuildRequires: autoconf automake -# Tarball generated from svn checkout. To regenerate: -# svn co svn://svn.debian.org/ltrace -r 45 -# cd ltrace/ltrace/trunk && ./autogen.sh && ./configure && make dist -Source: ltrace-0.5-svn45.tar.gz +# Tarball generated from git checkout. To regenerate: +# git clone http://github.com/ice799/ltrace.git +# cd ltrace && ./autogen.sh && ./configure && make dist +Source: %{name}-%{version}.tar.bz2 -Patch0: ltrace-0.4-exec.patch -Patch1: ltrace-0.4-fork.patch -Patch2: ltrace-0.5-opd.patch -Patch3: ltrace-ppc32fc5.patch -Patch4: ltrace-0.5-gnuhash.patch -Patch5: ltrace-0.5-testsuite.patch -Patch6: ltrace-0.5-ppc-symval.patch -Patch7: ltrace-0.5-a2bp.patch -Patch8: ltrace-0.5-attach.patch -Patch9: ltrace-0.5-fork.patch -Patch10: ltrace-0.5-exec.patch -Patch11: ltrace-0.5-exec-tests.patch -Patch12: ltrace-0.5-man.patch -Patch13: ltrace-0.5-ia64-sigill.patch -Patch14: ltrace-0.5-build.patch -Patch15: ltrace-0.5-o.patch -Patch16: ltrace-0.5-s390-args.patch -Patch17: ltrace-0.5-fork-earlychild.patch -Patch18: ltrace-0.5-s390-31-on-64.patch -Patch19: ltrace-0.5-fork-ppc64.patch -Patch20: ltrace-0.5-exec-stripped.patch -Patch21: ltrace-0.5-ppc-plt-glink.patch -Patch22: ltrace-0.5-demangle.patch -Patch23: ltrace-0.5-etc-memmove.patch +Patch1: ltrace-0.5-ia64-sigill.patch +Patch2: ltrace-0.6.0-exec-stripped.patch +Patch3: ltrace-0.5-demangle.patch +Patch4: ltrace-0.5-etc-memmove.patch +Patch5: ltrace-0.6.0-return-string-n.patch %description Ltrace is a debugging program which runs a specified command until the @@ -52,30 +33,11 @@ execution of processes. %prep %setup -q -%patch0 -p0 %patch1 -p1 %patch2 -p1 -%patch3 -p0 +#%patch3 -p1 %patch4 -p1 %patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch20 -p1 -%patch21 -p1 -%patch22 -p1 -%patch23 -p1 sed -i -e 's/-o root -g root//' Makefile.in %build @@ -83,7 +45,6 @@ sed -i -e 's/-o root -g root//' Makefile.in # architecture. It makes a difference on ppc. export CC="gcc`echo $RPM_OPT_FLAGS | sed -n 's/^.*\(-m[36][124]\).*$/ \1/p'` -D_LARGEFILE64_SOURCE" # We touch configure.ac up there -autoreconf -i %configure CC="$CC" make %{?_smp_mflags} @@ -93,10 +54,10 @@ make DESTDIR=$RPM_BUILD_ROOT bindir=%{_bindir} docdir=%{_docdir}/ltrace-%{versio # The testsuite is useful for development in real world, but fails in # koji for some reason. Disable it, but have it handy. -#%check -#echo ====================TESTING========================= -#make check -#echo ====================TESTING END===================== +%check +echo ====================TESTING========================= +make check +echo ====================TESTING END===================== %clean rm -rf $RPM_BUILD_ROOT @@ -109,6 +70,13 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{_sysconfdir}/ltrace.conf %changelog +* Tue Feb 15 2011 Petr Machata - 0.6.0-1 +- Update to 0.6.0 + - Drop most patches + - Port exec-stripped patch + - Add return-string-n patch + - Leave just the testsuite part in ia64-sigill patch + * Tue Feb 08 2011 Fedora Release Engineering - 0.5-19.45svn - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild diff --git a/sources b/sources index 5778529..2914d2c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -9b96a0056e9ba88a54e938973bf83025 ltrace-0.5-svn45.tar.gz +eca4ffd76293b2cae871b890b1cd4ddf ltrace-0.6.0.tar.bz2