patches/ltrace/0.5.3/160-fix-missing-ptrace-defines.patch
author Joachim Nilsson <jocke@vmlinux.org>
Sun Jan 03 16:46:58 2010 +0100 (2010-01-03)
changeset 1685 ecccce88fc71
child 2132 47eeda1e5872
permissions -rw-r--r--
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.
jocke@1685
     1
This patch tries to fix the issue when PTRACE_EVENT_FORK is not found in the standard
jocke@1685
     2
system headers.  The begininngs of this was already in place in trace.c, this patch
jocke@1685
     3
only takes that idea and puts it in a shared include file for trace.c *and* events.c.
jocke@1685
     4
The latter of which otherwise fails to build on Arm.
jocke@1685
     5
jocke@1685
     6
	Joachim Nilsson <jocke@vmlinux.org>
jocke@1685
     7
jocke@1685
     8
diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/events.c ltrace-0.5.3/sysdeps/linux-gnu/events.c
jocke@1685
     9
--- ltrace-0.5.3.orig/sysdeps/linux-gnu/events.c	2009-07-25 17:13:02.000000000 +0200
jocke@1685
    10
+++ ltrace-0.5.3/sysdeps/linux-gnu/events.c	2010-01-03 14:33:46.000000000 +0100
jocke@1685
    11
@@ -7,9 +7,8 @@
jocke@1685
    12
 #include <errno.h>
jocke@1685
    13
 #include <signal.h>
jocke@1685
    14
 #include <string.h>
jocke@1685
    15
-#include <sys/ptrace.h>
jocke@1685
    16
 
jocke@1685
    17
-#include "common.h"
jocke@1685
    18
+#include "trace.h"
jocke@1685
    19
 
jocke@1685
    20
 static Event event;
jocke@1685
    21
 
jocke@1685
    22
diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.c ltrace-0.5.3/sysdeps/linux-gnu/trace.c
jocke@1685
    23
--- ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.c	2009-07-25 17:13:02.000000000 +0200
jocke@1685
    24
+++ ltrace-0.5.3/sysdeps/linux-gnu/trace.c	2010-01-03 14:33:38.000000000 +0100
jocke@1685
    25
@@ -5,10 +5,9 @@
jocke@1685
    26
 #include <unistd.h>
jocke@1685
    27
 #include <sys/types.h>
jocke@1685
    28
 #include <sys/wait.h>
jocke@1685
    29
-#include "ptrace.h"
jocke@1685
    30
 #include <asm/unistd.h>
jocke@1685
    31
 
jocke@1685
    32
-#include "common.h"
jocke@1685
    33
+#include "trace.h"
jocke@1685
    34
 
jocke@1685
    35
 /* If the system headers did not provide the constants, hard-code the normal
jocke@1685
    36
    values.  */
jocke@1685
    37
diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.h ltrace-0.5.3/sysdeps/linux-gnu/trace.h
jocke@1685
    38
--- ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.h	1970-01-01 01:00:00.000000000 +0100
jocke@1685
    39
+++ ltrace-0.5.3/sysdeps/linux-gnu/trace.h	2010-01-03 14:33:26.000000000 +0100
jocke@1685
    40
@@ -0,0 +1,32 @@
jocke@1685
    41
+/* If the system headers did not provide the constants, hard-code the normal values. */
jocke@1685
    42
+#ifndef __SYSDEPS_TRACE_H__
jocke@1685
    43
+#define __SYSDEPS_TRACE_H__
jocke@1685
    44
+
jocke@1685
    45
+#include "ptrace.h"
jocke@1685
    46
+#include "common.h"
jocke@1685
    47
+
jocke@1685
    48
+#ifndef PTRACE_EVENT_FORK
jocke@1685
    49
+#warning  PTRACE_EVENT_FORK not found... redefining.
jocke@1685
    50
+#define PTRACE_OLDSETOPTIONS    21
jocke@1685
    51
+#define PTRACE_SETOPTIONS       0x4200
jocke@1685
    52
+#define PTRACE_GETEVENTMSG      0x4201
jocke@1685
    53
+
jocke@1685
    54
+/* options set using PTRACE_SETOPTIONS */
jocke@1685
    55
+#define PTRACE_O_TRACESYSGOOD   0x00000001
jocke@1685
    56
+#define PTRACE_O_TRACEFORK      0x00000002
jocke@1685
    57
+#define PTRACE_O_TRACEVFORK     0x00000004
jocke@1685
    58
+#define PTRACE_O_TRACECLONE     0x00000008
jocke@1685
    59
+#define PTRACE_O_TRACEEXEC      0x00000010
jocke@1685
    60
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
jocke@1685
    61
+#define PTRACE_O_TRACEEXIT      0x00000040
jocke@1685
    62
+
jocke@1685
    63
+/* Wait extended result codes for the above trace options.  */
jocke@1685
    64
+#define PTRACE_EVENT_FORK       1
jocke@1685
    65
+#define PTRACE_EVENT_VFORK      2
jocke@1685
    66
+#define PTRACE_EVENT_CLONE      3
jocke@1685
    67
+#define PTRACE_EVENT_EXEC       4
jocke@1685
    68
+#define PTRACE_EVENT_VFORK_DONE 5
jocke@1685
    69
+#define PTRACE_EVENT_EXIT       6
jocke@1685
    70
+
jocke@1685
    71
+#endif /* PTRACE_EVENT_FORK */
jocke@1685
    72
+#endif /* __SYSDEPS_TRACE_H__ */