This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1 of 1] debug/ltrace: Add support for ltrace-0.5.3


# HG changeset patch
# User Joachim Nilsson <jocke@vmlinux.org>
# Date 1262533618 -3600
# Node ID d284ddf7e1b40cedcea0d6e0cf54b59a1a1b737a
# Parent  6b1e8a28dc60954371416a074ed906e244816763
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 <cespedes@debian.org>, the OpenEmbedded patches for cross
compiling, by Khem Raj <raj.khem@gmail.com> and a further set of patches
by Joachim Nilsson <jocke@vmlinux.org> for crosstool-NG.

diff --git a/config/debug/ltrace.in b/config/debug/ltrace.in
--- a/config/debug/ltrace.in
+++ b/config/debug/ltrace.in
@@ -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 --git a/patches/ltrace/0.5.3/100-allow-cross-compile.patch b/patches/ltrace/0.5.3/100-allow-cross-compile.patch
new file mode 100644
--- /dev/null
+++ b/patches/ltrace/0.5.3/100-allow-cross-compile.patch
@@ -0,0 +1,84 @@
+This patch is courtesy of OpenEmbedded, by Khem Raj <raj.khem@gmail.com>
+
+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 <sys/types.h>
+ #include <sys/time.h>
+ #include <stdio.h>
+@@ -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 <features.h>
+ 
+ /* 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 --git a/patches/ltrace/0.5.3/110-alpha-support.patch b/patches/ltrace/0.5.3/110-alpha-support.patch
new file mode 100644
--- /dev/null
+++ b/patches/ltrace/0.5.3/110-alpha-support.patch
@@ -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 --git a/patches/ltrace/0.5.3/120-debian-ltrace_0.5.3-2.patch b/patches/ltrace/0.5.3/120-debian-ltrace_0.5.3-2.patch
new file mode 100644
--- /dev/null
+++ b/patches/ltrace/0.5.3/120-debian-ltrace_0.5.3-2.patch
@@ -0,0 +1,78 @@
+Debian patch courtesy of the Debian ltrace maintainer Juan Cespedes <cespedes@debian.org>
+
+--- 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 <sys/ptrace.h>
+ #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 <gelf.h>
++#include <sys/ptrace.h>
+ #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 <sys/ptrace.h>
+ #include <string.h>
+-#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 <asm/rse.h>
+ 
+ #include <stddef.h>
+-#include "debug.h"
+ #include "common.h"
+ 
+ void *
diff --git a/patches/ltrace/0.5.3/130-add-sysdep.patch b/patches/ltrace/0.5.3/130-add-sysdep.patch
new file mode 100644
--- /dev/null
+++ b/patches/ltrace/0.5.3/130-add-sysdep.patch
@@ -0,0 +1,17 @@
+This patch is courtesy of OpenEmbedded, by Khem Raj <raj.khem@gmail.com>
+
+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 --git a/patches/ltrace/0.5.3/140-mips-remove-CP.patch b/patches/ltrace/0.5.3/140-mips-remove-CP.patch
new file mode 100644
--- /dev/null
+++ b/patches/ltrace/0.5.3/140-mips-remove-CP.patch
@@ -0,0 +1,16 @@
+This patch is courtesy of OpenEmbedded, by Khem Raj <raj.khem@gmail.com>
+
+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 --git a/patches/ltrace/0.5.3/140-mips.patch b/patches/ltrace/0.5.3/140-mips.patch
new file mode 100644
--- /dev/null
+++ b/patches/ltrace/0.5.3/140-mips.patch
@@ -0,0 +1,40 @@
+This patch is courtesy of OpenEmbedded, by Khem Raj <raj.khem@gmail.com>
+
+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 <debug.h>
++#include "debug.h"
+ #include <gelf.h>
+ #include <sys/ptrace.h>
+ #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 <sys/types.h>
+ #include <sys/ptrace.h>
+ #include <asm/ptrace.h>
+-#include <linux/user.h>
+ 
+ #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 --git a/patches/ltrace/0.5.3/150-allow-configurable-arch.patch b/patches/ltrace/0.5.3/150-allow-configurable-arch.patch
new file mode 100644
--- /dev/null
+++ b/patches/ltrace/0.5.3/150-allow-configurable-arch.patch
@@ -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 <jocke@vmlinux.org>
+
+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 --git a/patches/ltrace/0.5.3/160-fix-missing-ptrace-defines.patch b/patches/ltrace/0.5.3/160-fix-missing-ptrace-defines.patch
new file mode 100644
--- /dev/null
+++ b/patches/ltrace/0.5.3/160-fix-missing-ptrace-defines.patch
@@ -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 <jocke@vmlinux.org>
+
+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 <errno.h>
+ #include <signal.h>
+ #include <string.h>
+-#include <sys/ptrace.h>
+ 
+-#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 <unistd.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
+-#include "ptrace.h"
+ #include <asm/unistd.h>
+ 
+-#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 --git a/scripts/build/debug/400-ltrace.sh b/scripts/build/debug/400-ltrace.sh
--- a/scripts/build/debug/400-ltrace.sh
+++ b/scripts/build/debug/400-ltrace.sh
@@ -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

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]