diff --git a/ltrace-ppc32fc5.patch b/ltrace-ppc32fc5.patch index 25a688f..a1e6fba 100644 --- a/ltrace-ppc32fc5.patch +++ b/ltrace-ppc32fc5.patch @@ -41,30 +41,6 @@ Index: elf.c lte->ehdr.e_entry), PLTs_initialized_by_here, lib_tail, 1, 0); -Index: sysdeps/linux-gnu/breakpoint.c -=================================================================== ---- sysdeps/linux-gnu/breakpoint.c (revision 45) -+++ sysdeps/linux-gnu/breakpoint.c (working copy) -@@ -9,6 +9,8 @@ - #include "output.h" - #include "debug.h" - -+#include -+ - static unsigned char break_insn[] = BREAKPOINT_VALUE; - - #ifdef ARCH_HAVE_ENABLE_BREAKPOINT -@@ -28,6 +30,10 @@ void enable_breakpoint(pid_t pid, struct - long a = - ptrace(PTRACE_PEEKTEXT, pid, sbp->addr + i * sizeof(long), - 0); -+ if (a == -1 && errno) { -+ perror ("ptrace"); -+ return; -+ } - for (j = 0; - j < sizeof(long) - && i * sizeof(long) + j < BREAKPOINT_LENGTH; j++) { Index: sysdeps/linux-gnu/ppc/plt.c =================================================================== --- sysdeps/linux-gnu/ppc/plt.c (revision 45) @@ -196,3 +172,68 @@ Index: breakpoints.c } proc->callstack_depth = 0; proc->breakpoints_enabled = -1; +Index: wait_for_something.c +=================================================================== +--- wait_for_something.c (revision 45) ++++ wait_for_something.c (working copy) +@@ -48,6 +48,18 @@ struct event *wait_for_something(void) + fprintf(stderr, "signal from wrong pid %u ?!?\n", pid); + exit(1); + } ++#ifdef __powerpc__ ++ static int bp_initialized = 0; ++ if (!bp_initialized) { ++ /* This is a hack to do delayed initialization of ++ breakpoints for ppc32's secure PLT. We don't have ++ pid in hand until here, and we need pid to ptrace ++ the binary. */ ++ debug(1, "delayed breakpoints_init ahead"); ++ breakpoints_init (event.proc); ++ bp_initialized = 1; ++ } ++#endif + get_arch_dep(event.proc); + event.proc->instruction_pointer = NULL; + debug(3, "signal from pid %u", pid); +Index: sysdeps/linux-gnu/breakpoint.c +=================================================================== +--- sysdeps/linux-gnu/breakpoint.c (revision 45) ++++ sysdeps/linux-gnu/breakpoint.c (working copy) +@@ -9,6 +9,8 @@ + #include "output.h" + #include "debug.h" + ++#include ++ + static unsigned char break_insn[] = BREAKPOINT_VALUE; + + #ifdef ARCH_HAVE_ENABLE_BREAKPOINT +@@ -24,20 +26,27 @@ void enable_breakpoint(pid_t pid, struct + + debug(1, "enable_breakpoint(%d,%p)", pid, sbp->addr); + ++ unsigned char orig[BREAKPOINT_LENGTH]; + for (i = 0; i < 1 + ((BREAKPOINT_LENGTH - 1) / sizeof(long)); i++) { + long a = + ptrace(PTRACE_PEEKTEXT, pid, sbp->addr + i * sizeof(long), + 0); ++ if (a == -1 && errno) { ++ perror ("ptrace"); ++ return; ++ } + for (j = 0; + j < sizeof(long) + && i * sizeof(long) + j < BREAKPOINT_LENGTH; j++) { + unsigned char *bytes = (unsigned char *)&a; + +- sbp->orig_value[i * sizeof(long) + j] = bytes[j]; ++ orig[i * sizeof(long) + j] = bytes[j]; + bytes[j] = break_insn[i * sizeof(long) + j]; + } + ptrace(PTRACE_POKETEXT, pid, sbp->addr + i * sizeof(long), a); + } ++ if (memcmp (orig, break_insn, BREAKPOINT_LENGTH) != 0) ++ memcpy (sbp->orig_value, orig, BREAKPOINT_LENGTH); + } + #endif /* ARCH_HAVE_ENABLE_BREAKPOINT */ + diff --git a/ltrace.spec b/ltrace.spec index 7ea2385..5016728 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: 1.0.45svn.2 +Release: 1.0.45svn.3 Source: ltrace-0.5.tar.gz Patch2: ltrace-opd.patch Patch3: ltrace-ppc32fc5.patch @@ -56,7 +56,7 @@ rm -rf $RPM_BUILD_ROOT %config /etc/ltrace.conf %changelog -* Fri Jul 14 2006 Petr Machata - 0.5-1.0.45svn.2 +* Fri Jul 14 2006 Petr Machata - 0.5-1.0.45svn.3 - adding .gnu.hash patch to support new ELF hash table section - adding testsuite patch to silent some bogus failures