[ltrace/f16] Add upstream patches for ppc

Petr Machata pmachata at fedoraproject.org
Mon Sep 26 14:01:01 UTC 2011


commit 5b371986cf41570ca6f2c3aad214c1931c756fd7
Author: Petr Machata <pmachata at redhat.com>
Date:   Mon Sep 26 16:00:16 2011 +0200

    Add upstream patches for ppc

 ltrace-0.6.0-ppc-args.patch  |   30 ++++++++++++++++++++++++++++++
 ltrace-0.6.0-ppc-shift.patch |   21 +++++++++++++++++++++
 ltrace.spec                  |   10 +++++++++-
 3 files changed, 60 insertions(+), 1 deletions(-)
---
diff --git a/ltrace-0.6.0-ppc-args.patch b/ltrace-0.6.0-ppc-args.patch
new file mode 100644
index 0000000..43bfa2e
--- /dev/null
+++ b/ltrace-0.6.0-ppc-args.patch
@@ -0,0 +1,30 @@
+diff --git a/sysdeps/linux-gnu/ppc/trace.c b/sysdeps/linux-gnu/ppc/trace.c
+index 20b3f5d..321e6ec 100644
+--- a/sysdeps/linux-gnu/ppc/trace.c
++++ b/sysdeps/linux-gnu/ppc/trace.c
+@@ -87,10 +87,22 @@ gimme_arg_regset(enum tof type, Process *proc, int arg_num, arg_type_info *info,
+ 	}
+ 	else if (greg <= 10)
+ 		return (*regs)[greg++];
+-	else
++	else {
++#ifdef __powerpc64__
++		if (proc->mask_32bit)
++			return ptrace (PTRACE_PEEKDATA, proc->pid,
++				       proc->stack_pointer + 8 +
++				       sizeof (int) * (arg_num - 8), 0) >> 32;
++		else
++			return ptrace (PTRACE_PEEKDATA, proc->pid,
++				       proc->stack_pointer + 112 +
++				       sizeof (long) * (arg_num - 8), 0);
++#else
+ 		return ptrace (PTRACE_PEEKDATA, proc->pid,
+-				proc->stack_pointer + sizeof (long) *
+-				(arg_num - 8), 0);
++			       proc->stack_pointer + 8 +
++			       sizeof (long) * (arg_num - 8), 0);
++#endif
++	}
+ 
+ 	return 0;
+ }
diff --git a/ltrace-0.6.0-ppc-shift.patch b/ltrace-0.6.0-ppc-shift.patch
new file mode 100644
index 0000000..27d8b95
--- /dev/null
+++ b/ltrace-0.6.0-ppc-shift.patch
@@ -0,0 +1,21 @@
+diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
+index 980d028..668f63d 100644
+--- a/sysdeps/linux-gnu/ppc/plt.c
++++ b/sysdeps/linux-gnu/ppc/plt.c
+@@ -44,12 +44,16 @@ sym2addr(Process *proc, struct library_symbol *sym) {
+ 
+ 	pt_ret = ptrace(PTRACE_PEEKTEXT, proc->pid, addr, 0);
+ 
++#if SIZEOF_LONG == 8
+ 	if (proc->mask_32bit) {
+ 		// Assume big-endian.
+ 		addr = (void *)((pt_ret >> 32) & 0xffffffff);
+ 	} else {
+ 		addr = (void *)pt_ret;
+ 	}
++#else
++	addr = (void *)pt_ret;
++#endif
+ 
+ 	return addr;
+ }
diff --git a/ltrace.spec b/ltrace.spec
index d96feca..f2c3128 100644
--- a/ltrace.spec
+++ b/ltrace.spec
@@ -1,7 +1,7 @@
 Summary: Tracks runtime library calls from dynamically linked executables
 Name: ltrace
 Version: 0.6.0
-Release: 2%{?dist}
+Release: 3%{?dist}
 URL: http://ltrace.alioth.debian.org/
 License: GPLv2+
 Group: Development/Debuggers
@@ -23,6 +23,8 @@ Patch5: ltrace-0.6.0-return-string-n.patch
 Patch6: ltrace-0.6.0-threads.patch
 Patch7: ltrace-0.6.0-endian.patch
 Patch8: ltrace-0.6.0-testsuite-clone.patch
+Patch9: ltrace-0.6.0-ppc-args.patch
+Patch10: ltrace-0.6.0-ppc-shift.patch
 
 %description
 Ltrace is a debugging program which runs a specified command until the
@@ -44,6 +46,8 @@ execution of processes.
 %patch6 -p1
 %patch7 -p1
 %patch8 -p1
+%patch9 -p1
+%patch10 -p1
 sed -i -e 's/-o root -g root//' Makefile.in
 
 %build
@@ -76,6 +80,10 @@ rm -rf $RPM_BUILD_ROOT
 %config(noreplace) %{_sysconfdir}/ltrace.conf
 
 %changelog
+* Mon Sep 26 2011 Petr Machata <pmachata at redhat.com> - 0.6.0-3
+- Add upstream patches for ppc: excessive shift, and fetching
+  function arguments
+
 * Fri Sep  2 2011 Petr Machata <pmachata at redhat.com> - 0.6.0-2
 - Add upstream patches for tracing multi-threaded processes and endian
   fixes


More information about the scm-commits mailing list