# HG changeset patch # User Joachim Nilsson # Date 1262533618 -3600 # Node ID ecccce88fc7146c3a76f70fcfa51599c1a8dc187 # Parent 93d751a8efd79d9e578f50824f6f41d0a2613e00 debug/ltrace: Add support for ltrace-0.5.3 From this version of ltrace the maintainer has removed support for GNU Autotools, so the patch sets needed to be reworked. Included is the latest Debian patch, by the Debian ltrace maintainer Juan Cespedes , the OpenEmbedded patches for cross compiling, by Khem Raj and a further set of patches by Joachim Nilsson for crosstool-NG. diff -r 93d751a8efd7 -r ecccce88fc71 config/debug/ltrace.in --- a/config/debug/ltrace.in Sun Jan 03 18:40:35 2010 +0100 +++ b/config/debug/ltrace.in Sun Jan 03 16:46:58 2010 +0100 @@ -14,6 +14,12 @@ # Don't remove next line # CT_INSERT_VERSION_BELOW +config LTRACE_V_0_5_3 + bool + prompt "0.5.3 (EXPERIMENTAL)" + depends on EXPERIMENTAL + select LTRACE_0_5_3_or_later + config LTRACE_V_0_5_2 bool prompt "0.5.2" @@ -39,7 +45,12 @@ string # Don't remove next line # CT_INSERT_VERSION_STRING_BELOW + default "0.5.3" if LTRACE_V_0_5_3 default "0.5.2" if LTRACE_V_0_5_2 default "0.5.1" if LTRACE_V_0_5_1 default "0.5" if LTRACE_V_0_5 default "0.4" if LTRACE_V_0_4 + +config LTRACE_0_5_3_or_later + bool + default n diff -r 93d751a8efd7 -r ecccce88fc71 patches/ltrace/0.5.3/100-allow-cross-compile.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ltrace/0.5.3/100-allow-cross-compile.patch Sun Jan 03 16:46:58 2010 +0100 @@ -0,0 +1,84 @@ +This patch is courtesy of OpenEmbedded, by Khem Raj + +http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=b85b779688f0abc389e3c25d06b54de8b86385c1 + +Index: ltrace-0.5.3/common.h +=================================================================== +--- ltrace-0.5.3.orig/common.h 2009-10-23 23:13:45.700282578 -0700 ++++ ltrace-0.5.3/common.h 2009-10-23 23:14:13.550371553 -0700 +@@ -1,3 +1,5 @@ ++#ifndef COMMON_H ++#define COMMON_H + #include + #include + #include +@@ -251,3 +253,5 @@ extern void * sym2addr(Process *, struct + #if 0 /* not yet */ + extern int umoven(Process * proc, void * addr, int len, void * laddr); + #endif ++#endif ++ +Index: ltrace-0.5.3/configure +=================================================================== +--- ltrace-0.5.3.orig/configure 2009-10-23 23:13:45.630316494 -0700 ++++ ltrace-0.5.3/configure 2009-10-23 23:13:59.672869527 -0700 +@@ -30,7 +30,7 @@ int main () { + return cplus_demangle(); + } + EOF +-if gcc conftest.c -liberty 2>/dev/null ++if $CC conftest.c -liberty 2>/dev/null + then + HAVE_LIBIBERTY=1 + echo "yes" +@@ -48,7 +48,7 @@ int main () { + return __cxa_demangle(); + } + EOF +-if gcc conftest.c -lsupc++ 2>/dev/null ++if $CC conftest.c -lsupc++ 2>/dev/null + then + HAVE_LIBSUPC__=1 + echo "yes" +@@ -67,7 +67,7 @@ int main () { + return 0; + } + EOF +-if gcc conftest.c 2>/dev/null ++if $CC conftest.c 2>/dev/null + then + HAVE_ELF_C_READ_MMAP=1 + echo "yes" +@@ -77,15 +77,12 @@ else + fi + rm -f conftest.c a.out + +-CC=gcc +-CPPFLAGS=' -I /usr/include/libelf' + CFLAGS='-g -O2' + LIBS='-lelf -lsupc++ -liberty ' +-INSTALL='/usr/bin/install -c' ++INSTALL='install -c' + iquote='-iquote ' + iquoteend='' + +-prefix=/usr/local + sysconfdir='${prefix}/etc' + bindir='${prefix}/bin' + mandir='${prefix}/share/man' +Index: ltrace-0.5.3/debug.h +=================================================================== +--- ltrace-0.5.3.orig/debug.h 2009-10-23 23:13:45.670276809 -0700 ++++ ltrace-0.5.3/debug.h 2009-10-23 23:14:26.440319785 -0700 +@@ -1,3 +1,5 @@ ++#ifndef DEBUG_H ++#define DEBUG_H + #include + + /* debug levels: +@@ -14,4 +16,4 @@ void debug_(int level, const char *file, + int xinfdump(long, void *, int); + + # define debug(level, expr...) debug_(level, __FILE__, __LINE__, expr) +- ++#endif diff -r 93d751a8efd7 -r ecccce88fc71 patches/ltrace/0.5.3/110-alpha-support.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ltrace/0.5.3/110-alpha-support.patch Sun Jan 03 16:46:58 2010 +0100 @@ -0,0 +1,11 @@ +diff -ru ltrace-0.5.3.orig/sysdeps/linux-gnu/Makefile ltrace-0.5.3/sysdeps/linux-gnu/Makefile +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/Makefile 2009-07-25 17:13:02.000000000 +0200 ++++ ltrace-0.5.3/sysdeps/linux-gnu/Makefile 2010-01-01 22:20:45.000000000 +0100 +@@ -2,6 +2,7 @@ + -e s/i.86/i386/ \ + -e s/sun4u/sparc64/ \ + -e s/sparc64/sparc/ \ ++ -e s/alpha.*/alpha/ \ + -e s/arm.*/arm/ \ + -e s/sa110/arm/ \ + -e s/ppc64/ppc/ \ diff -r 93d751a8efd7 -r ecccce88fc71 patches/ltrace/0.5.3/120-debian-ltrace_0.5.3-2.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ltrace/0.5.3/120-debian-ltrace_0.5.3-2.patch Sun Jan 03 16:46:58 2010 +0100 @@ -0,0 +1,78 @@ +Debian patch courtesy of the Debian ltrace maintainer Juan Cespedes + +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/breakpoint.c ++++ ltrace-0.5.3/sysdeps/linux-gnu/breakpoint.c +@@ -6,8 +6,6 @@ + #include "common.h" + #include "arch.h" + +-static unsigned char break_insn[] = BREAKPOINT_VALUE; +- + #ifdef ARCH_HAVE_ENABLE_BREAKPOINT + extern void arch_enable_breakpoint(pid_t, Breakpoint *); + void +@@ -20,6 +18,9 @@ + arch_enable_breakpoint(pid, sbp); + } + #else ++ ++static unsigned char break_insn[] = BREAKPOINT_VALUE; ++ + void + enable_breakpoint(pid_t pid, Breakpoint *sbp) { + unsigned int i, j; +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/arm/breakpoint.c ++++ ltrace-0.5.3/sysdeps/linux-gnu/arm/breakpoint.c +@@ -24,10 +24,7 @@ + + #include + #include "config.h" +-#include "arch.h" +-#include "options.h" +-#include "output.h" +-#include "debug.h" ++#include "common.h" + + void + arch_enable_breakpoint(pid_t pid, Breakpoint *sbp) { +@@ -59,8 +56,6 @@ + void + arch_disable_breakpoint(pid_t pid, const Breakpoint *sbp) { + unsigned int i, j; +- const unsigned char break_insn[] = BREAKPOINT_VALUE; +- const unsigned char thumb_break_insn[] = THUMB_BREAKPOINT_VALUE; + + debug(1, "arch_disable_breakpoint(%d,%p)", pid, sbp->addr); + +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/ia64/plt.c ++++ ltrace-0.5.3/sysdeps/linux-gnu/ia64/plt.c +@@ -1,4 +1,5 @@ + #include ++#include + #include "common.h" + + /* A bundle is 128 bits */ +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/ia64/breakpoint.c ++++ ltrace-0.5.3/sysdeps/linux-gnu/ia64/breakpoint.c +@@ -6,10 +6,7 @@ + + #include + #include +-#include "arch.h" +-#include "options.h" +-#include "output.h" +-#include "debug.h" ++#include "common.h" + + static long long + extract_bit_field(char *bundle, int from, int len) { +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/ia64/regs.c ++++ ltrace-0.5.3/sysdeps/linux-gnu/ia64/regs.c +@@ -7,7 +7,6 @@ + #include + + #include +-#include "debug.h" + #include "common.h" + + void * diff -r 93d751a8efd7 -r ecccce88fc71 patches/ltrace/0.5.3/130-add-sysdep.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ltrace/0.5.3/130-add-sysdep.patch Sun Jan 03 16:46:58 2010 +0100 @@ -0,0 +1,17 @@ +This patch is courtesy of OpenEmbedded, by Khem Raj + +http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=b85b779688f0abc389e3c25d06b54de8b86385c1 + +Index: ltrace-0.5.3/Makefile.in +=================================================================== +--- ltrace-0.5.3.orig/Makefile.in 2009-10-23 22:06:08.130304691 -0700 ++++ ltrace-0.5.3/Makefile.in 2009-10-23 22:06:53.160369614 -0700 +@@ -39,6 +39,8 @@ ltrace: main.o libltrace.a + libltrace.a: sysdeps/sysdep.o $(OBJ) + $(AR) rcv $@ $^ + ++$(OBJ): sysdeps/sysdep.o ++ + sysdeps/sysdep.o: dummy + $(MAKE) -C sysdeps/$(OS) + diff -r 93d751a8efd7 -r ecccce88fc71 patches/ltrace/0.5.3/140-mips-remove-CP.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ltrace/0.5.3/140-mips-remove-CP.patch Sun Jan 03 16:46:58 2010 +0100 @@ -0,0 +1,16 @@ +This patch is courtesy of OpenEmbedded, by Khem Raj + +http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=b85b779688f0abc389e3c25d06b54de8b86385c1 + +Index: ltrace-0.5.3/sysdeps/linux-gnu/mipsel/trace.c +=================================================================== +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/mipsel/trace.c 2009-10-23 23:15:59.822783128 -0700 ++++ ltrace-0.5.3/sysdeps/linux-gnu/mipsel/trace.c 2009-10-23 23:16:10.441268788 -0700 +@@ -127,7 +127,6 @@ gimme_arg(enum tof type, Process *proc, + return ret; + } else { + // If we need this, I think we can look at [sp+16] for arg_num==4. +- CP; + return 0; + } + } diff -r 93d751a8efd7 -r ecccce88fc71 patches/ltrace/0.5.3/140-mips.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ltrace/0.5.3/140-mips.patch Sun Jan 03 16:46:58 2010 +0100 @@ -0,0 +1,40 @@ +This patch is courtesy of OpenEmbedded, by Khem Raj + +http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=b85b779688f0abc389e3c25d06b54de8b86385c1 + +Index: ltrace-0.5.3/sysdeps/linux-gnu/mipsel/plt.c +=================================================================== +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/mipsel/plt.c 2009-10-23 23:25:59.292780574 -0700 ++++ ltrace-0.5.3/sysdeps/linux-gnu/mipsel/plt.c 2009-10-23 23:26:22.671522220 -0700 +@@ -1,4 +1,4 @@ +-#include ++#include "debug.h" + #include + #include + #include "common.h" +Index: ltrace-0.5.3/sysdeps/linux-gnu/mipsel/regs.c +=================================================================== +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/mipsel/regs.c 2009-10-23 23:25:59.312777529 -0700 ++++ ltrace-0.5.3/sysdeps/linux-gnu/mipsel/regs.c 2009-10-23 23:26:08.190311896 -0700 +@@ -4,7 +4,6 @@ + #include + #include + #include +-#include + + #include "common.h" + #include "mipsel.h" +Index: ltrace-0.5.3/handle_event.c +=================================================================== +--- ltrace-0.5.3.orig/handle_event.c 2009-10-23 23:29:48.780274445 -0700 ++++ ltrace-0.5.3/handle_event.c 2009-10-23 23:37:32.260284055 -0700 +@@ -573,7 +573,8 @@ handle_breakpoint(Event *event) { + void *old_addr; + struct library_symbol *sym= event->proc->callstack[i].c_un.libfunc; + assert(sym); +- old_addr = dict_find_entry(event->proc->breakpoints, sym2addr(event->proc, sym))->addr; ++ struct Breakpoint *tbp = dict_find_entry(event->proc->breakpoints, sym2addr(event->proc, sym)); ++ old_addr = tbp->addr; + addr=sym2addr(event->proc,sym); + assert(old_addr !=0 && addr !=0); + if(addr != old_addr){ diff -r 93d751a8efd7 -r ecccce88fc71 patches/ltrace/0.5.3/150-allow-configurable-arch.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ltrace/0.5.3/150-allow-configurable-arch.patch Sun Jan 03 16:46:58 2010 +0100 @@ -0,0 +1,48 @@ +This patch is to ensure the proper ARCH is selected when cross compiling. Make +sure to call the configure script with, e.g., HOST=arm ./configure to select +the arm sysdeps. + + Joachim Nilsson + +diff -ru ltrace-0.5.3.orig/configure ltrace-0.5.3/configure +--- ltrace-0.5.3.orig/configure 2010-01-02 11:05:55.000000000 +0100 ++++ ltrace-0.5.3/configure 2010-01-02 20:49:11.000000000 +0100 +@@ -110,7 +110,7 @@ + # + # Makefile.in -> Makefile + # +-x_subst_vars='PACKAGE_VERSION HOST_OS INSTALL CC CPPFLAGS CFLAGS LDFLAGS LIBS iquote iquoteend prefix sysconfdir mandir docdir' ++x_subst_vars='PACKAGE_VERSION HOST HOST_OS INSTALL CC CPPFLAGS CFLAGS LDFLAGS LIBS iquote iquoteend prefix sysconfdir mandir docdir' + + for i in $x_subst_vars + do +Only in ltrace-0.5.3: configure~ +diff -ru ltrace-0.5.3.orig/Makefile.in ltrace-0.5.3/Makefile.in +--- ltrace-0.5.3.orig/Makefile.in 2010-01-02 11:05:55.000000000 +0100 ++++ ltrace-0.5.3/Makefile.in 2010-01-03 01:28:41.000000000 +0100 +@@ -1,10 +1,12 @@ + # + # ltrace's Makefile.in + # +- ++MY_TARGET = @HOST@ ++ifdef MY_TARGET ++ARCH = $(MY_TARGET) ++endif + #OS := $(shell uname -s) + OS := @HOST_OS@ +- + TOPDIR = $(shell pwd) + + prefix = @prefix@ +Only in ltrace-0.5.3: Makefile.in~ +diff -ru ltrace-0.5.3.orig/sysdeps/linux-gnu/Makefile ltrace-0.5.3/sysdeps/linux-gnu/Makefile +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/Makefile 2010-01-02 11:05:55.000000000 +0100 ++++ ltrace-0.5.3/sysdeps/linux-gnu/Makefile 2010-01-02 20:49:51.000000000 +0100 +@@ -1,4 +1,4 @@ +-ARCH := $(shell uname -m | sed \ ++ARCH ?= $(shell uname -m | sed \ + -e s/i.86/i386/ \ + -e s/sun4u/sparc64/ \ + -e s/sparc64/sparc/ \ +Only in ltrace-0.5.3/sysdeps/linux-gnu: Makefile~ diff -r 93d751a8efd7 -r ecccce88fc71 patches/ltrace/0.5.3/160-fix-missing-ptrace-defines.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/ltrace/0.5.3/160-fix-missing-ptrace-defines.patch Sun Jan 03 16:46:58 2010 +0100 @@ -0,0 +1,72 @@ +This patch tries to fix the issue when PTRACE_EVENT_FORK is not found in the standard +system headers. The begininngs of this was already in place in trace.c, this patch +only takes that idea and puts it in a shared include file for trace.c *and* events.c. +The latter of which otherwise fails to build on Arm. + + Joachim Nilsson + +diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/events.c ltrace-0.5.3/sysdeps/linux-gnu/events.c +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/events.c 2009-07-25 17:13:02.000000000 +0200 ++++ ltrace-0.5.3/sysdeps/linux-gnu/events.c 2010-01-03 14:33:46.000000000 +0100 +@@ -7,9 +7,8 @@ + #include + #include + #include +-#include + +-#include "common.h" ++#include "trace.h" + + static Event event; + +diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.c ltrace-0.5.3/sysdeps/linux-gnu/trace.c +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.c 2009-07-25 17:13:02.000000000 +0200 ++++ ltrace-0.5.3/sysdeps/linux-gnu/trace.c 2010-01-03 14:33:38.000000000 +0100 +@@ -5,10 +5,9 @@ + #include + #include + #include +-#include "ptrace.h" + #include + +-#include "common.h" ++#include "trace.h" + + /* If the system headers did not provide the constants, hard-code the normal + values. */ +diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.h ltrace-0.5.3/sysdeps/linux-gnu/trace.h +--- ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.h 1970-01-01 01:00:00.000000000 +0100 ++++ ltrace-0.5.3/sysdeps/linux-gnu/trace.h 2010-01-03 14:33:26.000000000 +0100 +@@ -0,0 +1,32 @@ ++/* If the system headers did not provide the constants, hard-code the normal values. */ ++#ifndef __SYSDEPS_TRACE_H__ ++#define __SYSDEPS_TRACE_H__ ++ ++#include "ptrace.h" ++#include "common.h" ++ ++#ifndef PTRACE_EVENT_FORK ++#warning PTRACE_EVENT_FORK not found... redefining. ++#define PTRACE_OLDSETOPTIONS 21 ++#define PTRACE_SETOPTIONS 0x4200 ++#define PTRACE_GETEVENTMSG 0x4201 ++ ++/* options set using PTRACE_SETOPTIONS */ ++#define PTRACE_O_TRACESYSGOOD 0x00000001 ++#define PTRACE_O_TRACEFORK 0x00000002 ++#define PTRACE_O_TRACEVFORK 0x00000004 ++#define PTRACE_O_TRACECLONE 0x00000008 ++#define PTRACE_O_TRACEEXEC 0x00000010 ++#define PTRACE_O_TRACEVFORKDONE 0x00000020 ++#define PTRACE_O_TRACEEXIT 0x00000040 ++ ++/* Wait extended result codes for the above trace options. */ ++#define PTRACE_EVENT_FORK 1 ++#define PTRACE_EVENT_VFORK 2 ++#define PTRACE_EVENT_CLONE 3 ++#define PTRACE_EVENT_EXEC 4 ++#define PTRACE_EVENT_VFORK_DONE 5 ++#define PTRACE_EVENT_EXIT 6 ++ ++#endif /* PTRACE_EVENT_FORK */ ++#endif /* __SYSDEPS_TRACE_H__ */ diff -r 93d751a8efd7 -r ecccce88fc71 scripts/build/debug/400-ltrace.sh --- a/scripts/build/debug/400-ltrace.sh Sun Jan 03 18:40:35 2010 +0100 +++ b/scripts/build/debug/400-ltrace.sh Sun Jan 03 16:46:58 2010 +0100 @@ -27,11 +27,19 @@ CT_Pushd "${CT_BUILD_DIR}/build-ltrace" CT_DoLog EXTRA "Configuring ltrace" - CT_DoExecLog ALL \ - ./configure \ - --build=${CT_BUILD} \ - --host=${CT_TARGET} \ - --prefix=/usr + # ltrace-0.5.3, and later, don't use GNU Autotools configure script anymore + if [ "${CT_LTRACE_0_5_3_or_later}" = "y" ]; then + CC=${CT_TARGET}-${CT_CC} \ + HOST=${CT_ARCH} \ + CFLAGS="${CT_TARGET_CFLAGS}" \ + CT_DoExecLog ALL ./configure --prefix=/usr + else + CT_DoExecLog ALL \ + ./configure \ + --build=${CT_BUILD} \ + --host=${CT_TARGET} \ + --prefix=/usr + fi CT_DoLog EXTRA "Building ltrace" CT_DoExecLog ALL make