Hello community,
here is the log from the commit of package ltrace
checked in at Thu Feb 28 02:00:26 CET 2008.
--------
--- ltrace/ltrace.changes 2008-01-03 13:29:53.000000000 +0100
+++ /mounts/work_src_done/STABLE/ltrace/ltrace.changes 2008-02-27 14:23:48.000000000 +0100
@@ -1,0 +2,5 @@
+Wed Feb 27 14:23:24 CET 2008 - olh@suse.de
+
+- more complete powerpc ABI handling (bnc#364988 - LTC41151)
+
+-------------------------------------------------------------------
New:
----
ltrace.powerpc-ABI-support.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ltrace.spec ++++++
--- /var/tmp/diff_new_pack.k14994/_old 2008-02-28 02:00:07.000000000 +0100
+++ /var/tmp/diff_new_pack.k14994/_new 2008-02-28 02:00:07.000000000 +0100
@@ -10,6 +10,7 @@
# norootforbuild
+
Name: ltrace
BuildRequires: gcc-c++
%if 0%{?suse_version} > 1020
@@ -24,7 +25,7 @@
AutoReqProv: on
Summary: Trace the Library and System Calls a Program Makes
Version: 0.4
-Release: 91
+Release: 104
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %ix86 sparc s390 s390x ppc ppc64 armv4l x86_64 alpha ia64
Prefix: /usr
@@ -82,6 +83,7 @@
Patch200: ltrace.args-initialize.patch
Patch204: ltrace.ppc32-c-option.patch
Patch222: ltrace.s390-more-arguments.patch
+Patch223: ltrace.powerpc-ABI-support.patch
%description
Ltrace is a program that runs the specified command until it exits. It
@@ -156,6 +158,7 @@
%patch200 -p1
%patch204 -p1
%patch222 -p1
+%patch223 -p1
%build
autoreconf -fi
@@ -202,47 +205,49 @@
%config /etc/ltrace.conf
%changelog
-* Thu Jan 03 2008 - olh@suse.de
+* Wed Feb 27 2008 olh@suse.de
+- more complete powerpc ABI handling (bnc#364988 - LTC41151)
+* Thu Jan 03 2008 olh@suse.de
- handle more than 4 args on s390 (349987 - LTC41171)
-* Fri Oct 19 2007 - olh@suse.de
+* Fri Oct 19 2007 olh@suse.de
- allow build with old distributions, libelf0-devel is new in 10.3
-* Mon Oct 08 2007 - olh@suse.de
+* Mon Oct 08 2007 olh@suse.de
- update to ltrace mainline r80
added more system calls
add sleep to clone testcase to avoid earlier termination of process
disable breakpoints before doing fork()
-* Fri Oct 05 2007 - olh@suse.de
+* Fri Oct 05 2007 olh@suse.de
- fix build with sles9 (329163 - LTC38963)
-* Mon Jul 02 2007 - tiwai@suse.de
+* Mon Jul 02 2007 tiwai@suse.de
- changed from libelf to libelf0-devel in buildrequires.
-* Tue Apr 17 2007 - schwab@suse.de
+* Tue Apr 17 2007 schwab@suse.de
- Fix argument decoding.
-* Fri Jan 26 2007 - olh@suse.de
+* Fri Jan 26 2007 olh@suse.de
- update to ltrace mainline r75
fix -p behavior: wait for process to stop after PTRACE_ATTACH
fix -L behavior: always initialize the breakpoint dictionary,
and thus aviod NULL dereference.
- rename patch numbers in %%prep section to match commit ids
-* Thu Jan 25 2007 - olh@suse.de
+* Thu Jan 25 2007 olh@suse.de
- fix ltrace -c on ppc32 (201272 - LTC24809)
-* Mon Nov 20 2006 - olh@suse.de
+* Mon Nov 20 2006 olh@suse.de
- add ltrace.trace_exec.patch (201282 - LTC25640)
-* Thu Oct 12 2006 - olh@suse.de
+* Thu Oct 12 2006 olh@suse.de
- better opd handling
add arch name to mack check results
use /etc/ltrace.conf (211921)
-* Wed Sep 20 2006 - olh@suse.de
+* Wed Sep 20 2006 olh@suse.de
- add more ia64 fixes from Steve Fink
keep make check results in the package
-* Fri Sep 15 2006 - olh@suse.de
+* Fri Sep 15 2006 olh@suse.de
- provide elf_gnu_hash, current glibc defines SHT_GNU_HASH
remove merge acl entries for ltrace.conf
-* Thu Sep 14 2006 - olh@suse.de
+* Thu Sep 14 2006 olh@suse.de
- fix opd2addr to return the value at addr, not addr itself
revert a regex handling change in the testsuite to fix make check
-* Thu Sep 14 2006 - olh@suse.de
+* Thu Sep 14 2006 olh@suse.de
- run make check, do not abort the build if it fails
-* Thu Sep 14 2006 - olh@suse.de
+* Thu Sep 14 2006 olh@suse.de
- update to ltrace mainline r65 (201272)
implement ignored arguments, pointer parameters, enumerated parameters
short, ushort and float types, typedefs, array arguments and struct support
@@ -253,90 +258,90 @@
update syscall list to 2.6.17
use e_entry instead of _start if the binary is stripped
fix the -x processing to get rid of bad warning.
-* Tue Jun 13 2006 - schwab@suse.de
+* Tue Jun 13 2006 schwab@suse.de
- Update to ltrace 0.4 to get support for ia64.
- Don't build as root.
-* Tue May 30 2006 - bk@suse.de
+* Tue May 30 2006 bk@suse.de
- fix crash of every process traced with -p on ltrace exit (138568)
-* Thu May 18 2006 - olh@suse.de
+* Thu May 18 2006 olh@suse.de
- update man page to ltrace 0.4 version (176209 - LTC23913)
-* Tue May 02 2006 - olh@suse.de
+* Tue May 02 2006 olh@suse.de
- add handling for secure PLT on powerpc (154472 - LTC21994)
fix segfault when following forks (155754 - LTC22229)
configure does checks for c++ features, add c++ to Buildrequires
-* Mon Mar 20 2006 - pth@suse.de
+* Mon Mar 20 2006 pth@suse.de
- Add patch from IBM that fixes segfaults when using -x (#150487)
-* Thu Mar 02 2006 - hare@suse.de
+* Thu Mar 02 2006 hare@suse.de
- biarch support for S/390.
-* Wed Jan 25 2006 - mls@suse.de
+* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
-* Tue Jun 28 2005 - uli@suse.de
+* Tue Jun 28 2005 uli@suse.de
- ported s390x support from 0.3.10
-* Tue May 10 2005 - pth@suse.de
+* Tue May 10 2005 pth@suse.de
- Incorporate RH patch for biarch support
- Incorporate all pathches from IBM for biarch ltrace on ppc64
-* Thu Apr 21 2005 - pth@suse.de
+* Thu Apr 21 2005 pth@suse.de
- Fix warnings in the ppc specific parts.
-* Thu Apr 14 2005 - pth@suse.de
+* Thu Apr 14 2005 pth@suse.de
- Don't use elfutils because of their unacceptable license,
use libelf instead.
- Fix the check for gelf.h
- Really use the include path for gelf.h that configure found.
- Use version number from config.h
-* Mon Apr 04 2005 - pth@suse.de
+* Mon Apr 04 2005 pth@suse.de
- Update to ltrace 0.3.36:
- All SUSE patches integrated
- Alpha support,
- Uses elfutils.
- list of functions expanded.
-* Thu Mar 24 2005 - pth@suse.de
+* Thu Mar 24 2005 pth@suse.de
- Adapt patch from Jakub Jellinek to make ltrace handle long/ulong
values and thus work on AMD64 (#74374).
-* Fri May 07 2004 - bk@suse.de
+* Fri May 07 2004 bk@suse.de
- fix assert in call summary if ltrace was tracing nothing(#39642)
-* Thu Apr 01 2004 - bk@suse.de
+* Thu Apr 01 2004 bk@suse.de
- use new path for changelog file, fixes stale symlink (Bug #36383)
- update manual page regarding bugs fixed with the applied patches
-* Wed Mar 31 2004 - bk@suse.de
+* Wed Mar 31 2004 bk@suse.de
- calculate PLT table function address if missing in symtab(#36212)
(this makes ltrace work again on i386, otherwise it does nothing)
-* Mon Feb 23 2004 - bk@suse.de
+* Mon Feb 23 2004 bk@suse.de
- Update to ltrace 0.3.31: More functions in ltrace.conf, options
to show time spent inside each call and summary of calls at end
-* Mon Feb 09 2004 - bk@suse.de
+* Mon Feb 09 2004 bk@suse.de
- fix ExclusiveArch: Include s390 and s390x for 32- and 64-bit arch
-* Fri Jun 13 2003 - mmj@suse.de
+* Fri Jun 13 2003 mmj@suse.de
- Use BuildRoot
-* Mon Jun 02 2003 - ro@suse.de
+* Mon Jun 02 2003 ro@suse.de
- remove unpackaged files from buildroot
-* Fri Sep 20 2002 - agruen@suse.de
+* Fri Sep 20 2002 agruen@suse.de
- Update syscall table definitions for supported architectures to
current 8.1/UL/SLES kernel.
- Add declarations for extended attribute syscalls and
for libacl functions (POSIX ACL library).
-* Fri Jul 12 2002 - kukuk@suse.de
+* Fri Jul 12 2002 kukuk@suse.de
- Fix ExclusiveArch for x86.
-* Thu Jun 27 2002 - mludvig@suse.cz
+* Thu Jun 27 2002 mludvig@suse.cz
- Added support for Elf64 binaries.
- Fixed x86-64 port.
-* Fri Jun 07 2002 - aj@suse.de
+* Fri Jun 07 2002 aj@suse.de
- Update to ltrace 0.3.26:
* Added support for s390 and powerpc
- Add initial support for x86-64.
-* Mon Nov 26 2001 - uli@suse.de
+* Mon Nov 26 2001 uli@suse.de
- added armv4l to ExclusiveArch
-* Thu Jul 19 2001 - uli@suse.de
+* Thu Jul 19 2001 uli@suse.de
- added PPC port by Anton Blanchard
-* Tue Apr 03 2001 - bk@suse.de
+* Tue Apr 03 2001 bk@suse.de
- added S/390 patch from IBM Linux Technology Center
-* Mon Jan 10 2000 - kukuk@suse.de
+* Mon Jan 10 2000 kukuk@suse.de
- Update to ltrace 0.3.10
- Add patch for SPARC
-* Sat Oct 23 1999 - bk@suse.de
+* Sat Oct 23 1999 bk@suse.de
- updated to ltrace-0.3.8
-* Mon Sep 13 1999 - bs@suse.de
+* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
-* Wed Aug 04 1999 - bs@suse.de
+* Wed Aug 04 1999 bs@suse.de
- added call of Check
-* Mon Mar 29 1999 - bk@suse.de
+* Mon Mar 29 1999 bk@suse.de
- new package
++++++ ltrace.powerpc-ABI-support.patch ++++++
Bug 364988 - LTC41151 - ltrace64 testcase (parameters.exp) fails in SLES10
2008-02-25 Luis Machado
* sysdeps/linux-gnu/ppc/trace.c (arch_umovelong): New function.
* sysdeps/linux-gnu/ppc/regs.c (get_instruction): New function.
(get_count_register): New function.
* sysdeps/linux-gnu/ppc/arch.h (ARCH_HAVE_UMOVELONG): New define.
* sysdeps/linux-gnu/trace.c (umovelong): Create arch-specific
variant.
* ltrace.h (umovelong): Change prototype.
* process_event.c (process_breakpoint): Handle specifics of ppc32 PLT.
* display_args.c: Call umovelong with info parameter.
---
display_args.c | 6 +-
ltrace.h | 2
process_event.c | 34 ++++++++----
sysdeps/linux-gnu/ppc/arch.h | 3 +
sysdeps/linux-gnu/ppc/regs.c | 21 ++++++++
sysdeps/linux-gnu/ppc/trace.c | 110 +++++++++++++++++++++++++++++++++++++-----
sysdeps/linux-gnu/trace.c | 41 +++++++++------
7 files changed, 173 insertions(+), 44 deletions(-)
--- a/display_args.c
+++ b/display_args.c
@@ -32,7 +32,7 @@ static long get_length(enum tof type, st
if (len_spec > 0)
return len_spec;
if (type == LT_TOF_STRUCT) {
- umovelong(proc, st + st_info->u.struct_info.offset[-len_spec-1], &len);
+ umovelong (proc, st + st_info->u.struct_info.offset[-len_spec-1], &len, st_info->u.struct_info.fields[-len_spec-1]);
return len;
}
@@ -135,7 +135,7 @@ static int display_pointer(enum tof type
} else {
if (value == 0)
return fprintf(output, "NULL");
- else if (umovelong(proc, (void *) value, &pointed_to) < 0)
+ else if (umovelong (proc, (void *) value, &pointed_to, info->u.ptr_info.info) < 0)
return fprintf(output, "?");
else
return display_value(type, proc, pointed_to, inner,
@@ -178,7 +178,7 @@ int display_value(enum tof type, struct
case ARGTYPE_INT:
return fprintf(output, "%d", (int) value);
case ARGTYPE_UINT:
- return fprintf(output, "%u", (unsigned) value);
+ return fprintf (output, "%u", (unsigned int) value);
case ARGTYPE_LONG:
if (proc->mask_32bit)
return fprintf(output, "%d", (int) value);
--- a/ltrace.h
+++ b/ltrace.h
@@ -250,7 +250,7 @@ extern void continue_enabling_breakpoint
extern long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info);
extern void save_register_args(enum tof type, struct process *proc);
extern int umovestr(struct process *proc, void *addr, int len, void *laddr);
-extern int umovelong(struct process *proc, void *addr, long *result);
+extern int umovelong (struct process *proc, void *addr, long *result, arg_type_info *info);
extern int ffcheck(void *maddr);
extern void *sym2addr(struct process *, struct library_symbol *);
--- a/process_event.c
+++ b/process_event.c
@@ -248,21 +248,31 @@ static void process_breakpoint(struct ev
struct breakpoint *sbp;
debug(2, "event: breakpoint (%p)", event->e_un.brk_addr);
- if ((sbp = event->proc->breakpoint_being_enabled) != 0) {
+
#ifdef __powerpc__
- struct breakpoint *nxtbp;
- char nop_inst[] = PPC_NOP;
- if (memcmp(sbp->orig_value, nop_inst, PPC_NOP_LENGTH) == 0) {
- nxtbp = address2bpstruct(event->proc,
- event->e_un.brk_addr +
- PPC_NOP_LENGTH);
- if (nxtbp != 0) {
- enable_breakpoint(event->proc->pid, sbp);
- continue_after_breakpoint(event->proc, nxtbp);
- return;
- }
+ /* Need to skip following NOP's to prevent a fake function from being stacked. */
+ long stub_addr = (long) get_count_register(event->proc);
+ struct breakpoint *stub_bp = NULL;
+ char nop_instruction[] = PPC_NOP;
+
+ stub_bp = address2bpstruct (event->proc, event->e_un.brk_addr);
+
+ if (stub_bp)
+ {
+ unsigned char *bp_instruction = stub_bp->orig_value;
+
+ if (memcmp(bp_instruction, nop_instruction, PPC_NOP_LENGTH) == 0)
+ {
+ if (stub_addr != (long) event->e_un.brk_addr)
+ {
+ set_instruction_pointer (event->proc, event->e_un.brk_addr + 4);
+ continue_process(event->proc->pid);
+ return;
}
+ }
+ }
#endif
+ if ((sbp = event->proc->breakpoint_being_enabled) != 0) {
/* Reinsert breakpoint */
continue_enabling_breakpoint(event->proc->pid,
event->proc->
--- a/sysdeps/linux-gnu/ppc/arch.h
+++ b/sysdeps/linux-gnu/ppc/arch.h
@@ -13,6 +13,9 @@
#define PLT_REINITALISATION_BP "_start"
+/* Start of arch-specific functions. */
+#define ARCH_HAVE_UMOVELONG
+
#define PPC_NOP { 0x60, 0x00, 0x00, 0x00 }
#define PPC_NOP_LENGTH 4
--- a/sysdeps/linux-gnu/ppc/regs.c
+++ b/sysdeps/linux-gnu/ppc/regs.c
@@ -38,3 +38,24 @@ void *get_return_addr(struct process *pr
return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_LNK,
0);
}
+
+/* Grab the value of CTR registers. */
+void *get_count_register (struct process *proc)
+{
+ return (void *) ptrace (PTRACE_PEEKUSER, proc->pid, sizeof (long) * PT_CTR, 0);
+}
+
+/* Get instruction at address ADDR. */
+void *get_instruction (struct process *proc, void *addr)
+{
+ long data;
+
+ data = ptrace (PTRACE_PEEKTEXT, proc->pid, addr,0);
+
+ if (proc->mask_32bit)
+ data = (data >> 32) & 0x00000000ffffffff;
+
+ return (void *)data;
+
+}
+
--- a/sysdeps/linux-gnu/ppc/trace.c
+++ b/sysdeps/linux-gnu/ppc/trace.c
@@ -8,6 +8,7 @@
#include
#include
#include
+#include
#include "ltrace.h"
@@ -29,9 +30,13 @@ void get_arch_dep(struct process *proc)
#endif
}
-/* Returns 1 if syscall, 2 if sysret, 0 otherwise.
- */
+/* Returns 1 if syscall, 2 if sysret, 0 otherwise. */
#define SYSCALL_INSN 0x44000002
+
+unsigned int greg = 3;
+unsigned int freg = 1;
+unsigned int vreg = 2;
+
int syscall_p(struct process *proc, int status, int *sysnum)
{
if (WIFSTOPPED(status)
@@ -56,21 +61,102 @@ int syscall_p(struct process *proc, int
return 0;
}
+/* Grab functions arguments based on the PPC64 ABI. */
long gimme_arg(enum tof type, struct process *proc, int arg_num, arg_type_info *info)
{
- if (arg_num == -1) { /* return value */
- return ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_R3,
- 0);
- } else if (arg_num < 8) {
- return ptrace(PTRACE_PEEKUSER, proc->pid,
- sizeof(long) * (arg_num + PT_R3), 0);
- } else {
- return ptrace(PTRACE_PEEKDATA, proc->pid,
- proc->stack_pointer + 8 * (arg_num - 8), 0);
- }
+ long data;
+
+ if (type == LT_TOF_FUNCTIONR) /* return value */
+ {
+ if (info->type == ARGTYPE_FLOAT || info->type == ARGTYPE_DOUBLE)
+ return ptrace (PTRACE_PEEKUSER, proc->pid, sizeof (long) * (PT_FPR0 + 1), 0);
+ else
+ return ptrace (PTRACE_PEEKUSER, proc->pid, sizeof (long) * PT_R3, 0);
+ }
+
+ /* Check if we're entering a new function call to list parameters. If
+ so, initialize the register control variables to keep track of where
+ the parameters were stored. */
+ if (type == LT_TOF_FUNCTION && arg_num == 0)
+ {
+ /* Initialize the set of registrers for parameter passing. */
+ greg = 3;
+ freg = 1;
+ vreg = 2;
+ }
+
+ if (info->type == ARGTYPE_FLOAT || info->type == ARGTYPE_DOUBLE)
+ {
+ if (freg <= 13 || (proc->mask_32bit && freg <= 8))
+ {
+ data = ptrace (PTRACE_PEEKUSER, proc->pid,
+ sizeof (long) * (PT_FPR0 + freg), 0);
+
+ if (info->type == ARGTYPE_FLOAT)
+ {
+ /* float values passed in FP registers are automatically
+ promoted to double. We need to convert it back to float
+ before printing. */
+ union { long val; float fval; double dval; } cvt;
+ cvt.val = data;
+ cvt.fval = (float) cvt.dval;
+ data = cvt.val;
+ }
+
+ freg++;
+ greg++;
+
+ return data;
+ }
+ }
+ else if (greg <= 10)
+ {
+ data = ptrace (PTRACE_PEEKUSER, proc->pid,
+ sizeof (long) * greg, 0);
+ greg++;
+
+ return data;
+ }
+ else
+ return ptrace (PTRACE_PEEKDATA, proc->pid,
+ proc->stack_pointer + sizeof (long) * (arg_num - 8), 0);
+
return 0;
}
void save_register_args(enum tof type, struct process *proc)
{
}
+
+/* Read a single long from the process's memory address 'addr'. */
+int arch_umovelong (struct process *proc, void *addr, long *result, arg_type_info *info)
+{
+ long pointed_to;
+
+ errno = 0;
+
+ pointed_to = ptrace (PTRACE_PEEKTEXT, proc->pid, addr, 0);
+
+ if (pointed_to == -1 && errno)
+ return -errno;
+
+ /* Since int's are 4-bytes (long is 8-bytes) in length for ppc64, we
+ need to shift the long values returned by ptrace to end up with
+ the correct value. */
+
+ if (info)
+ {
+ if (info->type == ARGTYPE_INT || (proc->mask_32bit && (info->type == ARGTYPE_POINTER
+ || info->type == ARGTYPE_STRING)))
+ {
+ pointed_to = pointed_to >> 32;
+
+ /* Make sure we have nothing in the upper word so we can
+ do a explicit cast from long to int later in the code. */
+ pointed_to &= 0x00000000ffffffff;
+ }
+ }
+
+ *result = pointed_to;
+ return 0;
+}
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -73,6 +73,29 @@ static int fork_exec_syscalls[][5] = {
#endif
};
+#ifdef ARCH_HAVE_UMOVELONG
+extern int arch_umovelong (struct process *, void *, long *, arg_type_info *);
+int umovelong (struct process *proc, void *addr, long *result, arg_type_info *info)
+{
+ return arch_umovelong (proc, addr, result, info);
+}
+#else
+/* Read a single long from the process's memory address 'addr' */
+int umovelong (struct process *proc, void *addr, long *result, arg_type_info *info)
+{
+ long pointed_to;
+
+ errno = 0;
+ pointed_to = ptrace (PTRACE_PEEKTEXT, proc->pid, addr, 0);
+ if (pointed_to == -1 && errno)
+ return -errno;
+
+ *result = pointed_to;
+ return 0;
+}
+#endif
+
+
/* Returns 1 if the sysnum may make a new child to be created
* (ie, with fork() or clone())
* Returns 0 otherwise.
@@ -207,20 +230,6 @@ void continue_after_breakpoint(struct pr
}
}
-/* Read a single long from the process's memory address 'addr' */
-int umovelong(struct process *proc, void *addr, long *result)
-{
- long pointed_to;
-
- errno = 0;
- pointed_to = ptrace(PTRACE_PEEKTEXT, proc->pid, addr, 0);
- if (pointed_to == -1 && errno)
- return -errno;
-
- *result = pointed_to;
- return 0;
-}
-
/* Read a series of bytes starting at the process's memory address
'addr' and continuing until a NUL ('\0') is seen or 'len' bytes
have been read.
@@ -236,7 +245,7 @@ int umovestr(struct process *proc, void
while (offset < len) {
a.a = ptrace(PTRACE_PEEKTEXT, proc->pid, addr + offset, 0);
- for (i = 0; i < sizeof(long); i++) {
+ for (i = 0; i < sizeof (long); i++) {
if (a.c[i] && offset + (signed)i < len) {
*(char *)(laddr + offset + i) = a.c[i];
} else {
@@ -244,7 +253,7 @@ int umovestr(struct process *proc, void
return 0;
}
}
- offset += sizeof(long);
+ offset += sizeof (long);
}
*(char *)(laddr + offset) = '\0';
return 0;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org