mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-29 15:44:03 +00:00
[debug-ltrace] Add latest version.
Add ltrace 0.5.2, propagate patchset from 0.5.1 and from Debian.
This commit is contained in:
parent
76a9f0fd16
commit
70a15a5026
@ -25,6 +25,10 @@ config LTRACE_V_0_5_1
|
||||
prompt "0.5.1 (EXPERIMENTAL)"
|
||||
depends on EXPERIMENTAL
|
||||
|
||||
config LTRACE_V_0_5_2
|
||||
bool
|
||||
prompt "0.5.2"
|
||||
|
||||
# CT_INSERT_VERSION_ABOVE
|
||||
# Don't remove above line!
|
||||
endchoice
|
||||
@ -34,5 +38,6 @@ config LTRACE_VERSION
|
||||
default "0.4" if LTRACE_V_0_4
|
||||
default "0.5" if LTRACE_V_0_5
|
||||
default "0.5.1" if LTRACE_V_0_5_1
|
||||
default "0.5.2" if LTRACE_V_0_5_2
|
||||
# CT_INSERT_VERSION_STRING_ABOVE
|
||||
# # Don't remove above line!
|
||||
|
77
patches/ltrace/0.5.2/100-allow-cross-compile.patch
Normal file
77
patches/ltrace/0.5.2/100-allow-cross-compile.patch
Normal file
@ -0,0 +1,77 @@
|
||||
diff -durN ltrace-0.5.2.orig/Makefile.in ltrace-0.5.2/Makefile.in
|
||||
--- ltrace-0.5.2.orig/Makefile.in 2009-05-21 19:14:54.000000000 +0200
|
||||
+++ ltrace-0.5.2/Makefile.in 2009-06-27 15:30:34.000000000 +0200
|
||||
@@ -2,8 +2,14 @@
|
||||
# ltrace's Makefile.in
|
||||
#
|
||||
|
||||
-#OS := $(shell uname -s)
|
||||
OS := @HOST_OS@
|
||||
+ARCH := $(shell echo "@HOST_ARCH@" |sed -e s/i.86/i386/ \
|
||||
+ -e s/sun4u/sparc64/ \
|
||||
+ -e s/arm.*/arm/ \
|
||||
+ -e s/sa110/arm/ \
|
||||
+ -e s/ppc64/ppc/ \
|
||||
+ -e s/s390x/s390/)
|
||||
+export ARCH
|
||||
|
||||
TOPDIR = $(shell pwd)
|
||||
|
||||
diff -durN ltrace-0.5.2.orig/configure ltrace-0.5.2/configure
|
||||
--- ltrace-0.5.2.orig/configure 2009-05-21 19:14:57.000000000 +0200
|
||||
+++ ltrace-0.5.2/configure 2009-06-27 15:30:34.000000000 +0200
|
||||
@@ -660,6 +660,7 @@
|
||||
host_cpu
|
||||
host_vendor
|
||||
host_os
|
||||
+HOST_ARCH
|
||||
HOST_OS
|
||||
CC
|
||||
CFLAGS
|
||||
@@ -1823,6 +1824,7 @@
|
||||
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
|
||||
|
||||
|
||||
+HOST_ARCH="$host_cpu"
|
||||
case "$host_os" in
|
||||
linux-gnu*) host_os=linux-gnu
|
||||
esac
|
||||
@@ -5406,6 +5408,7 @@
|
||||
host_cpu!$host_cpu$ac_delim
|
||||
host_vendor!$host_vendor$ac_delim
|
||||
host_os!$host_os$ac_delim
|
||||
+HOST_ARCH!$HOST_ARCH$ac_delim
|
||||
HOST_OS!$HOST_OS$ac_delim
|
||||
CC!$CC$ac_delim
|
||||
CFLAGS!$CFLAGS$ac_delim
|
||||
@@ -5426,7 +5429,7 @@
|
||||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 63; then
|
||||
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 64; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
diff -durN ltrace-0.5.2.orig/configure.ac ltrace-0.5.2/configure.ac
|
||||
--- ltrace-0.5.2.orig/configure.ac 2009-05-21 19:14:54.000000000 +0200
|
||||
+++ ltrace-0.5.2/configure.ac 2009-06-27 15:30:34.000000000 +0200
|
||||
@@ -11,6 +11,8 @@
|
||||
esac
|
||||
HOST_OS="$host_os"
|
||||
AC_SUBST(HOST_OS)
|
||||
+HOST_ARCH="$host_cpu"
|
||||
+AC_SUBST(HOST_ARCH)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
diff -durN ltrace-0.5.2.orig/sysdeps/linux-gnu/Makefile ltrace-0.5.2/sysdeps/linux-gnu/Makefile
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/Makefile 2009-05-21 19:14:54.000000000 +0200
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/Makefile 2009-06-27 15:30:34.000000000 +0200
|
||||
@@ -1,6 +1,3 @@
|
||||
-ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
|
||||
- -e s/arm.*/arm/ -e s/sa110/arm/ -e s/ppc64/ppc/ -e s/s390x/s390/)
|
||||
-
|
||||
CPPFLAGS += -I$(TOPDIR)/sysdeps/linux-gnu/$(ARCH)
|
||||
|
||||
OBJ = events.o trace.o proc.o breakpoint.o
|
11
patches/ltrace/0.5.2/110-alpha-support.patch
Normal file
11
patches/ltrace/0.5.2/110-alpha-support.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -durN ltrace-0.5.2.orig/Makefile.in ltrace-0.5.2/Makefile.in
|
||||
--- ltrace-0.5.2.orig/Makefile.in 2009-06-27 15:34:04.000000000 +0200
|
||||
+++ ltrace-0.5.2/Makefile.in 2009-06-27 15:34:27.000000000 +0200
|
||||
@@ -5,6 +5,7 @@
|
||||
OS := @HOST_OS@
|
||||
ARCH := $(shell echo "@HOST_ARCH@" |sed -e s/i.86/i386/ \
|
||||
-e s/sun4u/sparc64/ \
|
||||
+ -e s/alpha.*/alpha/ \
|
||||
-e s/arm.*/arm/ \
|
||||
-e s/sa110/arm/ \
|
||||
-e s/ppc64/ppc/ \
|
240
patches/ltrace/0.5.2/120-debian-ltrace-0.5.2-2.patch
Normal file
240
patches/ltrace/0.5.2/120-debian-ltrace-0.5.2-2.patch
Normal file
@ -0,0 +1,240 @@
|
||||
--- ltrace-0.5.2.orig/TODO
|
||||
+++ ltrace-0.5.2/TODO
|
||||
@@ -37,3 +37,4 @@
|
||||
* debug: change "-d" option to be something like "-d elf,events", or "-d breakpoints"
|
||||
* Find out if a process is sharing memory with its parent?
|
||||
* When using -p, find out if that process is sharing memory with other procs
|
||||
+* After a clone(), syscalls may be seen as sysrets in s390 (see trace.c:syscall_p())
|
||||
--- ltrace-0.5.2.orig/process_event.c
|
||||
+++ ltrace-0.5.2/process_event.c
|
||||
@@ -170,7 +170,7 @@
|
||||
enable_breakpoint(proc->pid, proc->breakpoint_being_enabled);
|
||||
proc->breakpoint_being_enabled = NULL;
|
||||
}
|
||||
- if (proc->parent->state == STATE_ATTACHED && options.follow) {
|
||||
+ if (options.follow) {
|
||||
proc->state = STATE_ATTACHED;
|
||||
} else {
|
||||
proc->state = STATE_IGNORED;
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/ppc/trace.c
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/ppc/trace.c
|
||||
@@ -50,9 +50,9 @@
|
||||
*sysnum =
|
||||
(int)ptrace(PTRACE_PEEKUSER, proc->pid,
|
||||
sizeof(long) * PT_R0, 0);
|
||||
- if (proc->callstack_depth > 0
|
||||
- && proc->callstack[proc->callstack_depth -
|
||||
- 1].is_syscall) {
|
||||
+ if (proc->callstack_depth > 0 &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].is_syscall &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/i386/trace.c
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/i386/trace.c
|
||||
@@ -32,7 +32,8 @@
|
||||
*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4 * ORIG_EAX, 0);
|
||||
|
||||
if (proc->callstack_depth > 0 &&
|
||||
- proc->callstack[proc->callstack_depth - 1].is_syscall) {
|
||||
+ proc->callstack[proc->callstack_depth - 1].is_syscall &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/ia64/trace.c
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/ia64/trace.c
|
||||
@@ -106,8 +106,8 @@
|
||||
if (insn == 0x1000000000 || insn == 0x1ffffffffff) {
|
||||
*sysnum = r15;
|
||||
if (proc->callstack_depth > 0 &&
|
||||
- proc->callstack[proc->callstack_depth -
|
||||
- 1].is_syscall) {
|
||||
+ proc->callstack[proc->callstack_depth - 1].is_syscall &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/m68k/trace.c
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/m68k/trace.c
|
||||
@@ -36,9 +36,8 @@
|
||||
if (*sysnum >= 0) {
|
||||
depth = proc->callstack_depth;
|
||||
if (depth > 0 &&
|
||||
- proc->callstack[depth - 1].is_syscall &&
|
||||
- proc->callstack[depth - 1].c_un.syscall ==
|
||||
- *sysnum) {
|
||||
+ proc->callstack[depth - 1].is_syscall &&
|
||||
+ proc->callstack[depth - 1].c_un.syscall == *sysnum) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/alpha/trace.c
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/alpha/trace.c
|
||||
@@ -36,8 +36,9 @@
|
||||
return 0;
|
||||
*sysnum =
|
||||
ptrace(PTRACE_PEEKUSER, proc->pid, 0 /* REG_R0 */ , 0);
|
||||
- if (proc->callstack_depth > 0
|
||||
- && proc->callstack[proc->callstack_depth - 1].is_syscall) {
|
||||
+ if (proc->callstack_depth > 0 &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].is_syscall &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) {
|
||||
return 2;
|
||||
}
|
||||
if (*sysnum >= 0 && *sysnum < 500) {
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/sparc/trace.c
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/sparc/trace.c
|
||||
@@ -33,9 +33,9 @@
|
||||
insn = ptrace(PTRACE_PEEKTEXT, proc->pid, ip, 0);
|
||||
if ((insn & 0xc1f8007f) == 0x81d00010) {
|
||||
*sysnum = ((proc_archdep *) proc->arch_ptr)->regs.r_g1;
|
||||
- if ((proc->callstack_depth > 0)
|
||||
- && proc->callstack[proc->callstack_depth -
|
||||
- 1].is_syscall) {
|
||||
+ if (proc->callstack_depth > 0 &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].is_syscall &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) {
|
||||
return 2;
|
||||
} else if (*sysnum >= 0) {
|
||||
return 1;
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/mipsel/trace.c
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/mipsel/trace.c
|
||||
@@ -60,33 +60,34 @@
|
||||
int
|
||||
syscall_p(Process *proc, int status, int *sysnum) {
|
||||
if (WIFSTOPPED(status)
|
||||
- && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) {
|
||||
- /* get the user's pc (plus 8) */
|
||||
- long pc = (long)get_instruction_pointer(proc);
|
||||
- /* fetch the SWI instruction */
|
||||
- int insn = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 4, 0);
|
||||
- int num = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 8, 0);
|
||||
-
|
||||
-/*
|
||||
- On a mipsel, syscall looks like:
|
||||
- 24040fa1 li v0, 0x0fa1 # 4001 --> _exit syscall
|
||||
- 0000000c syscall
|
||||
- */
|
||||
- if(insn!=0x0000000c){
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- *sysnum = (num & 0xFFFF) - 4000;
|
||||
- /* if it is a syscall, return 1 or 2 */
|
||||
- if (proc->callstack_depth > 0 &&
|
||||
- proc->callstack[proc->callstack_depth - 1].is_syscall) {
|
||||
- return 2;
|
||||
- }
|
||||
-
|
||||
- if (*sysnum >= 0) {
|
||||
- return 1;
|
||||
- }
|
||||
- }
|
||||
+ && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) {
|
||||
+ /* get the user's pc (plus 8) */
|
||||
+ long pc = (long)get_instruction_pointer(proc);
|
||||
+ /* fetch the SWI instruction */
|
||||
+ int insn = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 4, 0);
|
||||
+ int num = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 8, 0);
|
||||
+
|
||||
+ /*
|
||||
+ On a mipsel, syscall looks like:
|
||||
+ 24040fa1 li v0, 0x0fa1 # 4001 --> _exit syscall
|
||||
+ 0000000c syscall
|
||||
+ */
|
||||
+ if(insn!=0x0000000c){
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ *sysnum = (num & 0xFFFF) - 4000;
|
||||
+ /* if it is a syscall, return 1 or 2 */
|
||||
+ if (proc->callstack_depth > 0 &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].is_syscall &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) {
|
||||
+ return 2;
|
||||
+ }
|
||||
+
|
||||
+ if (*sysnum >= 0) {
|
||||
+ return 1;
|
||||
+ }
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
@@ -119,34 +120,34 @@
|
||||
*/
|
||||
long
|
||||
gimme_arg(enum tof type, Process *proc, int arg_num, arg_type_info *info) {
|
||||
- long ret;
|
||||
- debug(2,"type %d arg %d",type,arg_num);
|
||||
- if (type == LT_TOF_FUNCTION || type == LT_TOF_SYSCALL){
|
||||
- if(arg_num <4){
|
||||
- ret=ptrace(PTRACE_PEEKUSER,proc->pid,off_a0+arg_num,0);
|
||||
- debug(2,"ret = %#lx",ret);
|
||||
- return ret;
|
||||
- } else {
|
||||
- // If we need this, I think we can look at [sp+16] for arg_num==4.
|
||||
- CP;
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
- if(arg_num>=0){
|
||||
- fprintf(stderr,"args on return?");
|
||||
- }
|
||||
- if(type == LT_TOF_FUNCTIONR) {
|
||||
- return ptrace(PTRACE_PEEKUSER,proc->pid,off_v0,0);
|
||||
- }
|
||||
- if (type == LT_TOF_SYSCALLR) {
|
||||
- unsigned a3=ptrace(PTRACE_PEEKUSER, proc->pid,off_a3,0);
|
||||
- unsigned v0=ptrace(PTRACE_PEEKUSER, proc->pid,off_v0,0);
|
||||
- if(!a3){
|
||||
- return v0;
|
||||
- }
|
||||
- return -1;
|
||||
- }
|
||||
- fprintf(stderr, "gimme_arg called with wrong arguments\n");
|
||||
+ long ret;
|
||||
+ debug(2,"type %d arg %d",type,arg_num);
|
||||
+ if (type == LT_TOF_FUNCTION || type == LT_TOF_SYSCALL){
|
||||
+ if(arg_num <4){
|
||||
+ ret=ptrace(PTRACE_PEEKUSER,proc->pid,off_a0+arg_num,0);
|
||||
+ debug(2,"ret = %#lx",ret);
|
||||
+ return ret;
|
||||
+ } else {
|
||||
+ // If we need this, I think we can look at [sp+16] for arg_num==4.
|
||||
+ CP;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ if(arg_num>=0){
|
||||
+ fprintf(stderr,"args on return?");
|
||||
+ }
|
||||
+ if(type == LT_TOF_FUNCTIONR) {
|
||||
+ return ptrace(PTRACE_PEEKUSER,proc->pid,off_v0,0);
|
||||
+ }
|
||||
+ if (type == LT_TOF_SYSCALLR) {
|
||||
+ unsigned a3=ptrace(PTRACE_PEEKUSER, proc->pid,off_a3,0);
|
||||
+ unsigned v0=ptrace(PTRACE_PEEKUSER, proc->pid,off_v0,0);
|
||||
+ if(!a3){
|
||||
+ return v0;
|
||||
+ }
|
||||
+ return -1;
|
||||
+ }
|
||||
+ fprintf(stderr, "gimme_arg called with wrong arguments\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
--- ltrace-0.5.2.orig/sysdeps/linux-gnu/x86_64/trace.c
|
||||
+++ ltrace-0.5.2/sysdeps/linux-gnu/x86_64/trace.c
|
||||
@@ -41,7 +41,8 @@
|
||||
*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 8 * ORIG_RAX, 0);
|
||||
|
||||
if (proc->callstack_depth > 0 &&
|
||||
- proc->callstack[proc->callstack_depth - 1].is_syscall) {
|
||||
+ proc->callstack[proc->callstack_depth - 1].is_syscall &&
|
||||
+ proc->callstack[proc->callstack_depth - 1].c_un.syscall == *sysnum) {
|
||||
return 2;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user