rpms/ltrace/devel ltrace-fixes.patch, NONE, 1.1 ltrace-ia64.patch, NONE, 1.1 ltrace-ppc64-2.patch, NONE, 1.1 ltrace-ppc64.patch, NONE, 1.1 ltrace-s390x.patch, NONE, 1.1 ltrace-syscallent-update.patch, NONE, 1.1 ltrace.spec, 1.19, 1.20 ltrace_0.3.36-biarch.patch, 1.1, NONE
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Mon Jan 9 14:06:45 UTC 2006
- Previous message (by thread): rpms/kernel/devel linux-2.6-softmac-git.patch, NONE, 1.1.2.1 linux-2.6.15-usb-find-interface.patch, NONE, 1.1.2.1 linux-2.6.15-usblp-fixes.patch, NONE, 1.1.2.1 .cvsignore, 1.313, 1.313.2.1 kernel-2.6.spec, 1.1826.2.5, 1.1826.2.6 linux-2.6-bcm43xx-resume.patch, 1.1, 1.1.2.1 linux-2.6-bcm43xx.patch, 1.1, 1.1.2.1 sources, 1.255, 1.255.2.1 linux-2.6-bcm43xx-device-table.patch, 1.1, NONE linux-2.6-bcm43xx-promisc.patch, 1.1, NONE linux-2.6-bcm43xx-quiet.patch, 1.1, NONE linux-2.6.14-ieee80211-hw-wep.patch, 1.1, NONE
- Next message (by thread): rpms/ltrace/devel ltrace.spec,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: jakub
Update of /cvs/dist/rpms/ltrace/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv20546/devel
Modified Files:
ltrace.spec
Added Files:
ltrace-fixes.patch ltrace-ia64.patch ltrace-ppc64-2.patch
ltrace-ppc64.patch ltrace-s390x.patch
ltrace-syscallent-update.patch
Removed Files:
ltrace_0.3.36-biarch.patch
Log Message:
auto-import ltrace-0.3.36-4 on branch devel from ltrace-0.3.36-4.src.rpm
ltrace-fixes.patch:
Makefile.in | 5
breakpoints.c | 2
configure | 222 ++++++++++++++++++++++++++++++------------
configure.ac | 20 +++
elf.c | 13 +-
ltrace.h | 1
sysdeps/linux-gnu/ppc/trace.c | 2
7 files changed, 190 insertions(+), 75 deletions(-)
--- NEW FILE ltrace-fixes.patch ---
--- ltrace-0.3.36/sysdeps/linux-gnu/ppc/trace.c.jj 2006-01-09 12:22:56.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ppc/trace.c 2006-01-09 12:35:02.000000000 +0100
@@ -7,9 +7,7 @@
#include <signal.h>
#include <sys/ptrace.h>
#include <asm/ptrace.h>
-#ifdef __powerpc64__
#include <elf.h>
-#endif
#include "ltrace.h"
--- ltrace-0.3.36/Makefile.in.jj 2006-01-09 12:36:27.000000000 +0100
+++ ltrace-0.3.36/Makefile.in 2006-01-09 12:47:12.000000000 +0100
@@ -13,12 +13,9 @@ bindir = $(prefix)/bin
mandir = @mandir@
docdir = $(prefix)/doc/ltrace
-cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
- > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
-
CC = @CC@
CFLAGS = -Wall @CFLAGS@
-CPPFLAGS = -I$(TOPDIR) -I$(TOPDIR)/sysdeps/$(OS) $(call cc-option,-I-,-iquote) @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\" @CPPFLAGS@
+CPPFLAGS = @iquote@$(TOPDIR) @iquote@$(TOPDIR)/sysdeps/$(OS) @iquoteend@ @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\" @CPPFLAGS@
LDFLAGS =
LIBS = @LIBS@
--- ltrace-0.3.36/configure.ac.jj 2006-01-09 12:22:56.000000000 +0100
+++ ltrace-0.3.36/configure.ac 2006-01-09 12:46:29.000000000 +0100
@@ -41,7 +41,8 @@ dnl AC_FUNC_VPRINTF
dnl AC_CHECK_FUNCS(gettimeofday strdup strerror strspn)
AC_CHECK_FUNCS(getopt getopt_long)
-for path in /usr/include/elfutils /usr/local/include/elfutils /usr/include/libelf /usr/local/include/libelf; do
+for path in /usr/include/elfutils /usr/local/include/elfutils \
+ /usr/include/libelf /usr/local/include/libelf; do
if test -f ${path}/gelf.h; then
CPPFLAGS="$CPPFLAGS -I ${path}"
fi
@@ -51,6 +52,23 @@ AC_CHECK_HEADER(gelf.h,,AC_MSG_ERROR([**
AC_CHECK_LIB(elf,gelf_getdyn)
+ac_cv_have_iquote=no
+AC_MSG_CHECKING(compiler accepts -iquote dir)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -iquote ."
+AC_TRY_COMPILE(,,[ac_cv_have_iquote=yes])
+CPPFLAGS="$save_CPPFLAGS"
+AC_MSG_RESULT($ac_cv_have_iquote)
+if test $ac_cv_have_iquote = yes; then
+ iquote="-iquote "
+ iquoteend=""
+else
+ iquote="-I "
+ iquoteend="-I-"
+fi
+AC_SUBST(iquote)
+AC_SUBST(iquoteend)
+
ac_cv_have_elf_c_read_mmap=no
AC_MSG_CHECKING(elf_begin accepts ELF_C_READ_MMAP)
AC_TRY_COMPILE([#include <gelf.h>],
--- ltrace-0.3.36/ltrace.h.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/ltrace.h 2006-01-09 13:31:48.000000000 +0100
@@ -75,6 +75,7 @@ struct library_symbol {
struct breakpoint *brkpnt;
char needs_init;
char static_plt2addr;
+ char is_weak;
struct library_symbol * next;
};
--- ltrace-0.3.36/elf.c.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/elf.c 2006-01-09 13:36:04.000000000 +0100
@@ -21,7 +21,7 @@ static void do_init_elf (struct ltelf *l
static void do_close_elf (struct ltelf *lte);
static void add_library_symbol (GElf_Addr addr, const char *name,
struct library_symbol **library_symbolspp,
- int use_elf_plt2addr);
+ int use_elf_plt2addr, int is_weak);
static int in_load_libraries (const char *name, struct ltelf *lte);
static GElf_Addr elf_plt2addr (struct ltelf *ltc, void *addr);
@@ -269,7 +269,7 @@ do_close_elf (struct ltelf *lte)
static void
add_library_symbol (GElf_Addr addr, const char *name,
struct library_symbol **library_symbolspp,
- int use_elf_plt2addr)
+ int use_elf_plt2addr, int is_weak)
{
struct library_symbol *s;
s = malloc (sizeof (struct library_symbol) + strlen (name) + 1);
@@ -277,6 +277,7 @@ add_library_symbol (GElf_Addr addr, cons
error (EXIT_FAILURE, errno, "add_library_symbol failed");
s->needs_init = 1;
+ s->is_weak = is_weak;
s->static_plt2addr = use_elf_plt2addr;
s->next = *library_symbolspp;
s->enter_addr = (void *) (uintptr_t) addr;
@@ -395,7 +396,8 @@ read_elf (struct process * proc)
if (in_load_libraries (name, lte))
{
addr = arch_plt_sym_val (lte, i, &rela);
- add_library_symbol (addr, name, &library_symbols, 0);
+ add_library_symbol (addr, name, &library_symbols, 0,
+ ELF64_ST_BIND (sym.st_info) != 0);
if (!lib_tail)
lib_tail = &(library_symbols->next);
}
@@ -440,7 +442,8 @@ read_elf (struct process * proc)
{
/* FIXME: Should be able to use &library_symbols as above. But
when you do, none of the real library symbols cause breaks. */
- add_library_symbol (elf_plt2addr(lte, (void *)addr), name, lib_tail, 1);
+ add_library_symbol (elf_plt2addr(lte, (void *)addr), name,
+ lib_tail, 1, 0);
break;
}
}
@@ -449,7 +452,7 @@ read_elf (struct process * proc)
{
if (strcmp(xptr->name, E_ENTRY_NAME) == 0)
add_library_symbol (elf_plt2addr(lte, (void*)lte->ehdr.e_entry),
- "_start", lib_tail, 1);
+ "_start", lib_tail, 1, 0);
else
fprintf (stderr, "Warning: Couldn't get symbol \"%s\" "
"from \"%s\" or it's a duplicate",
--- ltrace-0.3.36/breakpoints.c.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/breakpoints.c 2006-01-09 13:35:32.000000000 +0100
@@ -177,7 +177,7 @@ reinitialize_breakpoints (struct process
while (sym) {
if (sym->needs_init) {
insert_breakpoint(proc, plt2addr(proc, sym->enter_addr), sym);
- if (sym->needs_init) {
+ if (sym->needs_init && !sym->is_weak) {
fprintf(stderr, "could not re-initialize breakpoint for \"%s\" in file \"%s\"\n", sym->name, proc->filename);
exit(1);
}
--- ltrace-0.3.36/configure.jj 2004-11-10 00:15:11.000000000 +0100
+++ ltrace-0.3.36/configure 2006-01-09 12:47:56.000000000 +0100
@@ -1,6 +1,8 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59.
+# Generated by GNU Autoconf 2.59 for ltrace 0.3.36.
+#
+# Report bugs to <Juan Cespedes <cespedes at debian.org>>.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
@@ -265,11 +267,11 @@ SHELL=${CONFIG_SHELL-/bin/sh}
: ${ac_max_here_lines=38}
# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
+PACKAGE_NAME='ltrace'
+PACKAGE_TARNAME='ltrace'
+PACKAGE_VERSION='0.3.36'
+PACKAGE_STRING='ltrace 0.3.36'
+PACKAGE_BUGREPORT='Juan Cespedes <cespedes at debian.org>'
ac_unique_file="ltrace.c"
# Factoring default headers for most tests.
@@ -309,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HOST_OS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HOST_OS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP iquote iquoteend LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -778,7 +780,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
+\`configure' configures ltrace 0.3.36 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -838,7 +840,9 @@ _ACEOF
fi
if test -n "$ac_init_help"; then
-
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of ltrace 0.3.36:";;
+ esac
cat <<\_ACEOF
Optional Features:
@@ -858,6 +862,7 @@ Some influential environment variables:
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
+Report bugs to <Juan Cespedes <cespedes at debian.org>>.
_ACEOF
fi
@@ -946,13 +951,15 @@ esac
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi
- cd "$ac_popdir"
+ cd $ac_popdir
done
fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
+ltrace configure 0.3.36
+generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -965,7 +972,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by $as_me, which was
+It was created by ltrace $as_me 0.3.36, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -1293,10 +1300,18 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
- ac_config_headers="$ac_config_headers config.h"
+
+
+
+
+
+
+ ac_config_headers="$ac_config_headers config.h"
+
+
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
@@ -1947,7 +1962,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2005,7 +2021,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2121,7 +2138,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2175,7 +2193,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2220,7 +2239,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2264,7 +2284,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2423,7 +2444,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2496,7 +2518,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2815,7 +2838,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2985,7 +3009,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3052,7 +3077,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3139,9 +3165,9 @@ echo "$as_me: WARNING: $ac_header: proce
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
+## -------------------------------------------------- ##
+## Report this to Juan Cespedes <cespedes at debian.org> ##
+## -------------------------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
@@ -3242,7 +3268,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3343,7 +3370,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3446,7 +3474,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3479,6 +3508,13 @@ fi
done
+for path in /usr/include/elfutils /usr/local/include/elfutils \
+ /usr/include/libelf /usr/local/include/libelf; do
+ if test -f ${path}/gelf.h; then
+ CPPFLAGS="$CPPFLAGS -I ${path}"
+ fi
+done
+
if test "${ac_cv_header_gelf_h+set}" = set; then
echo "$as_me:$LINENO: checking for gelf.h" >&5
echo $ECHO_N "checking for gelf.h... $ECHO_C" >&6
@@ -3509,7 +3545,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3596,9 +3633,9 @@ echo "$as_me: WARNING: gelf.h: proceedin
echo "$as_me: WARNING: gelf.h: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
+## -------------------------------------------------- ##
+## Report this to Juan Cespedes <cespedes at debian.org> ##
+## -------------------------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
@@ -3618,24 +3655,14 @@ fi
if test $ac_cv_header_gelf_h = yes; then
:
else
-
- if test -f /usr/include/elfutils/gelf.h; then
- CPPFLAGS="$CPPFLAGS -I /usr/include/elfutils"
- elif test -f /usr/local/include/elfutils/gelf.h; then
- CPPFLAGS="$CPPFLAGS -I /usr/local/include/elfutils"
- elif test -f /usr/include/libelf/gelf.h; then
- CPPFLAGS="$CPPFLAGS -I /usr/include/libelf"
- elif test -f /usr/local/include/libelf/gelf.h; then
- CPPFLAGS="$CPPFLAGS -I /usr/local/include/libelf"
- else
- { { echo "$as_me:$LINENO: error: gelf.h not found" >&5
-echo "$as_me: error: gelf.h not found" >&2;}
+ { { echo "$as_me:$LINENO: error: ***** gelf.h not found *****" >&5
+echo "$as_me: error: ***** gelf.h not found *****" >&2;}
{ (exit 1); exit 1; }; }
- fi
fi
+
echo "$as_me:$LINENO: checking for gelf_getdyn in -lelf" >&5
echo $ECHO_N "checking for gelf_getdyn in -lelf... $ECHO_C" >&6
if test "${ac_cv_lib_elf_gelf_getdyn+set}" = set; then
@@ -3674,7 +3701,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_l
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3709,6 +3737,68 @@ _ACEOF
fi
+ac_cv_have_iquote=no
+echo "$as_me:$LINENO: checking compiler accepts -iquote dir" >&5
+echo $ECHO_N "checking compiler accepts -iquote dir... $ECHO_C" >&6
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -iquote ."
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_have_iquote=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CPPFLAGS="$save_CPPFLAGS"
+echo "$as_me:$LINENO: result: $ac_cv_have_iquote" >&5
+echo "${ECHO_T}$ac_cv_have_iquote" >&6
+if test $ac_cv_have_iquote = yes; then
+ iquote="-iquote "
+ iquoteend=""
+else
+ iquote="-I "
+ iquoteend="-I-"
+fi
+
+
+
ac_cv_have_elf_c_read_mmap=no
echo "$as_me:$LINENO: checking elf_begin accepts ELF_C_READ_MMAP" >&5
echo $ECHO_N "checking elf_begin accepts ELF_C_READ_MMAP... $ECHO_C" >&6
@@ -3736,7 +3826,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3813,7 +3904,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3842,7 +3934,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3912,7 +4005,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3964,7 +4058,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4035,7 +4130,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4087,7 +4183,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_c
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4485,7 +4582,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
-This file was extended by $as_me, which was
+This file was extended by ltrace $as_me 0.3.36, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4545,7 +4642,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-config.status
+ltrace config.status 0.3.36
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@@ -4755,6 +4852,8 @@ s, at INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
s, at INSTALL_DATA@,$INSTALL_DATA,;t t
s, at CPP@,$CPP,;t t
s, at EGREP@,$EGREP,;t t
+s, at iquote@,$iquote,;t t
+s, at iquoteend@,$iquoteend,;t t
s, at LIBOBJS@,$LIBOBJS,;t t
s, at LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
@@ -4923,6 +5022,11 @@ esac
*) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
@@ -4961,12 +5065,6 @@ echo "$as_me: error: cannot find input f
fi;;
esac
done` || { (exit 1); exit 1; }
-
- if test x"$ac_file" != x-; then
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- rm -f "$ac_file"
- fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
ltrace-ia64.patch:
README | 5
debian/control | 2
debian/copyright | 4
debian/rules | 2
elf.c | 5
elf.h | 1
ltrace.1 | 2
options.c | 2
sysdeps/linux-gnu/breakpoint.c | 17
sysdeps/linux-gnu/ia64/Makefile | 10
sysdeps/linux-gnu/ia64/arch.h | 12
sysdeps/linux-gnu/ia64/breakpoint.c | 222 ++++++
sysdeps/linux-gnu/ia64/plt.c | 47 +
sysdeps/linux-gnu/ia64/ptrace.h | 1
sysdeps/linux-gnu/ia64/regs.c | 47 +
sysdeps/linux-gnu/ia64/signalent.h | 32
sysdeps/linux-gnu/ia64/syscallent.h | 1280 ++++++++++++++++++++++++++++++++++++
sysdeps/linux-gnu/ia64/trace.c | 140 +++
sysdeps/linux-gnu/trace.c | 3
19 files changed, 1824 insertions(+), 10 deletions(-)
--- NEW FILE ltrace-ia64.patch ---
--- ltrace-0.3.36/sysdeps/linux-gnu/breakpoint.c.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/breakpoint.c 2006-01-09 14:33:18.000000000 +0100
@@ -3,6 +3,7 @@
#endif
#include <sys/ptrace.h>
+#include <string.h>
#include "arch.h"
#include "options.h"
#include "output.h"
@@ -10,6 +11,13 @@
static unsigned char break_insn[] = BREAKPOINT_VALUE;
+#ifdef ARCH_HAVE_ENABLE_BREAKPOINT
+extern void arch_enable_breakpoint(pid_t, struct breakpoint*);
+void enable_breakpoint(pid_t pid, struct breakpoint *sbp)
+{
+ arch_enable_breakpoint(pid, sbp);
+}
+#else
void
enable_breakpoint(pid_t pid, struct breakpoint * sbp) {
int i,j;
@@ -27,7 +35,15 @@ enable_breakpoint(pid_t pid, struct brea
ptrace(PTRACE_POKETEXT, pid, sbp->addr + i*sizeof(long), a);
}
}
+#endif /* ARCH_HAVE_ENABLE_BREAKPOINT */
+#ifdef ARCH_HAVE_DISABLE_BREAKPOINT
+extern void arch_disable_breakpoint(pid_t, const struct breakpoint * sbp);
+void
+disable_breakpoint(pid_t pid, const struct breakpoint * sbp) {
+ arch_disable_breakpoint(pid, sbp);
+}
+#else
void
disable_breakpoint(pid_t pid, const struct breakpoint * sbp) {
int i,j;
@@ -46,3 +62,4 @@ disable_breakpoint(pid_t pid, const stru
ptrace(PTRACE_POKETEXT, pid, sbp->addr + i*sizeof(long), a);
}
}
+#endif /* ARCH_HAVE_DISABLE_BREAKPOINT */
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/arch.h.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/arch.h 2006-01-09 14:37:29.000000000 +0100
@@ -0,0 +1,12 @@
+#define ARCH_HAVE_DISABLE_BREAKPOINT 1
+#define ARCH_HAVE_ENABLE_BREAKPOINT 1
+
+#define BREAKPOINT_LENGTH 16
+#define BREAKPOINT_VALUE {0}
+#define DECR_PC_AFTER_BREAK 0
+
+#define LT_ELFCLASS ELFCLASS64
+#define LT_ELF_MACHINE EM_IA_64
+
+#define PLTs_INIT_BY_HERE NULL
+#define E_ENTRY_NAME "_start"
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/breakpoint.c.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/breakpoint.c 2006-01-09 14:36:14.000000000 +0100
@@ -0,0 +1,222 @@
+/* IA64 breakpoint support. Much of this clagged from gdb
+ * -Ian Wienand <ianw at gelato.unsw.edu.au> 10/3/2005
+ */
+
+#include "config.h"
+
+#include <sys/ptrace.h>
+#include <string.h>
+#include "arch.h"
+#include "options.h"
+#include "output.h"
+#include "debug.h"
+
+static long long
+extract_bit_field (char *bundle, int from, int len)
+{
+ long long result = 0LL;
+ int to = from + len;
+ int from_byte = from / 8;
+ int to_byte = to / 8;
+ unsigned char *b = (unsigned char *) bundle;
+ unsigned char c;
+ int lshift;
+ int i;
+
+ c = b[from_byte];
+ if (from_byte == to_byte)
+ c = ((unsigned char) (c << (8 - to % 8))) >> (8 - to % 8);
+ result = c >> (from % 8);
+ lshift = 8 - (from % 8);
+
+ for (i = from_byte+1; i < to_byte; i++)
+ {
+ result |= ((long long) b[i]) << lshift;
+ lshift += 8;
+ }
+
+ if (from_byte < to_byte && (to % 8 != 0))
+ {
+ c = b[to_byte];
+ c = ((unsigned char) (c << (8 - to % 8))) >> (8 - to % 8);
+ result |= ((long long) c) << lshift;
+ }
+
+ return result;
+}
+
+/* Replace the specified bits in an instruction bundle */
+static void
+replace_bit_field (char *bundle, long long val, int from, int len)
+{
+ int to = from + len;
+ int from_byte = from / 8;
+ int to_byte = to / 8;
+ unsigned char *b = (unsigned char *) bundle;
+ unsigned char c;
+
+ if (from_byte == to_byte)
+ {
+ unsigned char left, right;
+ c = b[from_byte];
+ left = (c >> (to % 8)) << (to % 8);
+ right = ((unsigned char) (c << (8 - from % 8))) >> (8 - from % 8);
+ c = (unsigned char) (val & 0xff);
+ c = (unsigned char) (c << (from % 8 + 8 - to % 8)) >> (8 - to % 8);
+ c |= right | left;
+ b[from_byte] = c;
+ }
+ else
+ {
+ int i;
+ c = b[from_byte];
+ c = ((unsigned char) (c << (8 - from % 8))) >> (8 - from % 8);
+ c = c | (val << (from % 8));
+ b[from_byte] = c;
+ val >>= 8 - from % 8;
+
+ for (i = from_byte+1; i < to_byte; i++)
+ {
+ c = val & 0xff;
+ val >>= 8;
+ b[i] = c;
+ }
+
+ if (to % 8 != 0)
+ {
+ unsigned char cv = (unsigned char) val;
+ c = b[to_byte];
+ c = c >> (to % 8) << (to % 8);
+ c |= ((unsigned char) (cv << (8 - to % 8))) >> (8 - to % 8);
+ b[to_byte] = c;
+ }
+ }
+}
+
+/* Return the contents of slot N (for N = 0, 1, or 2) in
+ and instruction bundle */
+static long long
+slotN_contents (char *bundle, int slotnum)
+{
+ return extract_bit_field (bundle, 5+41*slotnum, 41);
+}
+
+/* Store an instruction in an instruction bundle */
+
+static void
+replace_slotN_contents (char *bundle, long long instr, int slotnum)
+{
+ replace_bit_field (bundle, instr, 5+41*slotnum, 41);
+}
+
+typedef enum instruction_type
+{
+ A, /* Integer ALU ; I-unit or M-unit */
+ I, /* Non-ALU integer; I-unit */
+ M, /* Memory ; M-unit */
+ F, /* Floating-point ; F-unit */
+ B, /* Branch ; B-unit */
+ L, /* Extended (L+X) ; I-unit */
+ X, /* Extended (L+X) ; I-unit */
+ undefined /* undefined or reserved */
+} instruction_type;
+
+static enum instruction_type template_encoding_table[32][3] =
+{
+ { M, I, I }, /* 00 */
+ { M, I, I }, /* 01 */
+ { M, I, I }, /* 02 */
+ { M, I, I }, /* 03 */
+ { M, L, X }, /* 04 */
+ { M, L, X }, /* 05 */
+ { undefined, undefined, undefined }, /* 06 */
+ { undefined, undefined, undefined }, /* 07 */
+ { M, M, I }, /* 08 */
+ { M, M, I }, /* 09 */
+ { M, M, I }, /* 0A */
+ { M, M, I }, /* 0B */
+ { M, F, I }, /* 0C */
+ { M, F, I }, /* 0D */
+ { M, M, F }, /* 0E */
+ { M, M, F }, /* 0F */
+ { M, I, B }, /* 10 */
+ { M, I, B }, /* 11 */
+ { M, B, B }, /* 12 */
+ { M, B, B }, /* 13 */
+ { undefined, undefined, undefined }, /* 14 */
+ { undefined, undefined, undefined }, /* 15 */
+ { B, B, B }, /* 16 */
+ { B, B, B }, /* 17 */
+ { M, M, B }, /* 18 */
+ { M, M, B }, /* 19 */
+ { undefined, undefined, undefined }, /* 1A */
+ { undefined, undefined, undefined }, /* 1B */
+ { M, F, B }, /* 1C */
+ { M, F, B }, /* 1D */
+ { undefined, undefined, undefined }, /* 1E */
+ { undefined, undefined, undefined }, /* 1F */
+};
+
+union bundle_t {
+ char cbundle[16];
+ unsigned long ubundle[2];
+};
+
+void
+arch_enable_breakpoint(pid_t pid, struct breakpoint * sbp) {
+
+ unsigned long addr = (unsigned long)sbp->addr;
+ union bundle_t bundle;
+ int slotnum = (int) (addr & 0x0f) & 0x3;
+ long long instr;
+ int template;
+
+ debug(1, "Enable Breakpoint at %p)", sbp->addr);
+
+ if (slotnum > 2)
+ printf("Can't insert breakpoint for slot numbers greater than 2.");
+
+ addr &= ~0x0f;
+ bundle.ubundle[0] = ptrace(PTRACE_PEEKTEXT, pid, addr, 0);
+ bundle.ubundle[1] = ptrace(PTRACE_PEEKTEXT, pid, addr+8, 0);
+
+ /* Check for L type instruction in 2nd slot, if present then
+ bump up the slot number to the 3rd slot */
+ template = extract_bit_field (bundle.cbundle, 0, 5);
+ if (slotnum == 1 && template_encoding_table[template][1] == L)
+ {
+ slotnum = 2;
+ }
+
+ instr = slotN_contents (bundle.cbundle, slotnum);
+
+ memcpy(sbp->orig_value, &instr, sizeof(instr));
+
+ replace_slotN_contents (bundle.cbundle, 0x00002000040LL, slotnum);
+
+ ptrace(PTRACE_POKETEXT, pid, addr, bundle.ubundle[0]);
+ ptrace(PTRACE_POKETEXT, pid, addr+8, bundle.ubundle[1]);
+
+}
+
+void
+arch_disable_breakpoint(pid_t pid, const struct breakpoint * sbp) {
+
+ unsigned long addr = (unsigned long)sbp->addr;
+ int slotnum = (int)(addr & 0x0f) & 0x3;
+ union bundle_t bundle;
+ unsigned long instr;
+
+ debug(1, "Disable Breakpoint at %p", sbp->addr);
+
+ addr &= ~0x0f;
+
+ bundle.ubundle[0] = ptrace(PTRACE_PEEKTEXT, pid, addr, 0);
+ bundle.ubundle[1] = ptrace(PTRACE_PEEKTEXT, pid, addr+8, 0);
+
+ memcpy (&instr, sbp->orig_value, sizeof(instr));
+
+ replace_slotN_contents (bundle.cbundle, instr, slotnum);
+ ptrace(PTRACE_POKETEXT, pid, addr, bundle.ubundle[0]);
+ ptrace(PTRACE_POKETEXT, pid, addr+8, bundle.ubundle[1]);
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/Makefile.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/Makefile 2006-01-09 14:36:14.000000000 +0100
@@ -0,0 +1,10 @@
+OBJ = trace.o regs.o plt.o breakpoint.o
+
+all: arch.o
+
+arch.o: $(OBJ)
+ $(LD) -r -o arch.o $(OBJ)
+
+clean:
+ $(RM) $(OBJ) arch.o
+
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/plt.c.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/plt.c 2006-01-09 14:39:08.000000000 +0100
@@ -0,0 +1,47 @@
+#include <gelf.h>
+#include "ltrace.h"
+#include "elf.h"
+#include "debug.h"
+
+/* A bundle is 128 bits */
+#define BUNDLE_SIZE 16
+
+/*
+
+ The PLT has
+
+ ] 3 bundles as a header
+
+ ] The special reserved entry
+
+ ] Following that, each PLT entry has it's initial code that the GOT entry
+ points to. Each PLT entry has one bundle allocated.
+
+ ] Following that, each PLT entry has two bundles of actual PLT code,
+ i.e. load up the address from the GOT and jump to it. This is the
+ point we want to insert the breakpoint, as this will be captured
+ every time we jump to the PLT entry in the code.
+
+*/
+
+GElf_Addr
+arch_plt_sym_val (struct ltelf *lte, size_t ndx, GElf_Rela *rela)
+{
+ /* Find number of entires by removing header and special
+ * entry, dividing total size by three, since each PLT entry
+ * will have 3 bundles (1 for inital entry and two for the PLT
+ * code). */
+ int entries = (lte->plt_size - 4*BUNDLE_SIZE) / (3*BUNDLE_SIZE);
+
+ /* Now the point we want to break on is the PLT entry after
+ * all the header stuff */
+ unsigned long addr = lte->plt_addr + (4*BUNDLE_SIZE) + (BUNDLE_SIZE*entries) + (2*ndx*BUNDLE_SIZE);
+ debug(3, "Found PLT %d entry at %lx\n", ndx, addr);
+
+ return addr;
+}
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ return (void *) plt;
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/ptrace.h.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/ptrace.h 2006-01-09 14:36:14.000000000 +0100
@@ -0,0 +1 @@
+#include <sys/ptrace.h>
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/regs.c.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/regs.c 2006-01-09 14:36:14.000000000 +0100
@@ -0,0 +1,47 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/types.h>
+#include <sys/ptrace.h>
+
+#include <asm/ptrace_offsets.h>
+#include <asm/rse.h>
+
+#include <stddef.h>
+#include "debug.h"
+#include "ltrace.h"
+
+void *
+get_instruction_pointer(struct process * proc) {
+ unsigned long ip = ptrace(PTRACE_PEEKUSER, proc->pid, PT_CR_IIP, 0);
+ unsigned long slot = (ptrace(PTRACE_PEEKUSER, proc->pid, PT_CR_IPSR, 0) >> 41) & 3;
+
+ return (void*)(ip | slot);
+}
+
+void
+set_instruction_pointer(struct process * proc, void * addr) {
+
+ unsigned long newip = (unsigned long)addr;
+ int slot = (int) addr & 0xf;
+ unsigned long psr = ptrace(PTRACE_PEEKUSER, proc->pid, PT_CR_IPSR, 0);
+
+ psr &= ~(3UL << 41);
+ psr |= (unsigned long)(slot & 0x3) << 41;
+
+ newip &= ~0xfUL;
+
+ ptrace(PTRACE_POKEUSER, proc->pid, PT_CR_IIP, (long)newip);
+ ptrace(PTRACE_POKEUSER, proc->pid, PT_CR_IPSR, psr);
+}
+
+void *
+get_stack_pointer(struct process * proc) {
+ return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, PT_R12, 0);
+}
+
+void *
+get_return_addr(struct process * proc, void * stack_pointer) {
+ return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, PT_B0, 0);
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/signalent.h.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/signalent.h 2006-01-09 14:36:14.000000000 +0100
@@ -0,0 +1,32 @@
+ "SIG_0", /* 0 */
+ "SIGHUP", /* 1 */
+ "SIGINT", /* 2 */
+ "SIGQUIT", /* 3 */
+ "SIGILL", /* 4 */
+ "SIGTRAP", /* 5 */
+ "SIGABRT", /* 6 */
+ "SIGBUS", /* 7 */
+ "SIGFPE", /* 8 */
+ "SIGKILL", /* 9 */
+ "SIGUSR1", /* 10 */
+ "SIGSEGV", /* 11 */
+ "SIGUSR2", /* 12 */
+ "SIGPIPE", /* 13 */
+ "SIGALRM", /* 14 */
+ "SIGTERM", /* 15 */
+ "SIGSTKFLT", /* 16 */
+ "SIGCHLD", /* 17 */
+ "SIGCONT", /* 18 */
+ "SIGSTOP", /* 19 */
+ "SIGTSTP", /* 20 */
+ "SIGTTIN", /* 21 */
+ "SIGTTOU", /* 22 */
+ "SIGURG", /* 23 */
+ "SIGXCPU", /* 24 */
+ "SIGXFSZ", /* 25 */
+ "SIGVTALRM", /* 26 */
+ "SIGPROF", /* 27 */
+ "SIGWINCH", /* 28 */
+ "SIGIO", /* 29 */
+ "SIGPWR", /* 30 */
+ "SIGSYS", /* 31 */
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/syscallent.h.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/syscallent.h 2006-01-09 14:41:36.000000000 +0100
@@ -0,0 +1,1280 @@
+ "0", /* 0 */
+ "1", /* 1 */
+ "2", /* 2 */
+ "3", /* 3 */
+ "4", /* 4 */
+ "5", /* 5 */
+ "6", /* 6 */
+ "7", /* 7 */
+ "8", /* 8 */
+ "9", /* 9 */
+ "10", /* 10 */
+ "11", /* 11 */
+ "12", /* 12 */
+ "13", /* 13 */
+ "14", /* 14 */
+ "15", /* 15 */
+ "16", /* 16 */
+ "17", /* 17 */
+ "18", /* 18 */
+ "19", /* 19 */
+ "20", /* 20 */
+ "21", /* 21 */
+ "22", /* 22 */
+ "23", /* 23 */
+ "24", /* 24 */
+ "25", /* 25 */
+ "26", /* 26 */
+ "27", /* 27 */
+ "28", /* 28 */
+ "29", /* 29 */
+ "30", /* 30 */
+ "31", /* 31 */
+ "32", /* 32 */
+ "33", /* 33 */
+ "34", /* 34 */
+ "35", /* 35 */
+ "36", /* 36 */
+ "37", /* 37 */
+ "38", /* 38 */
+ "39", /* 39 */
+ "40", /* 40 */
+ "41", /* 41 */
+ "42", /* 42 */
+ "43", /* 43 */
+ "44", /* 44 */
+ "45", /* 45 */
+ "46", /* 46 */
+ "47", /* 47 */
+ "48", /* 48 */
+ "49", /* 49 */
+ "50", /* 50 */
+ "51", /* 51 */
+ "52", /* 52 */
+ "53", /* 53 */
+ "54", /* 54 */
+ "55", /* 55 */
+ "56", /* 56 */
+ "57", /* 57 */
+ "58", /* 58 */
+ "59", /* 59 */
+ "60", /* 60 */
+ "61", /* 61 */
+ "62", /* 62 */
+ "63", /* 63 */
+ "64", /* 64 */
+ "65", /* 65 */
+ "66", /* 66 */
+ "67", /* 67 */
+ "68", /* 68 */
+ "69", /* 69 */
+ "70", /* 70 */
+ "71", /* 71 */
+ "72", /* 72 */
+ "73", /* 73 */
+ "74", /* 74 */
+ "75", /* 75 */
+ "76", /* 76 */
+ "77", /* 77 */
+ "78", /* 78 */
+ "79", /* 79 */
+ "80", /* 80 */
+ "81", /* 81 */
+ "82", /* 82 */
+ "83", /* 83 */
+ "84", /* 84 */
+ "85", /* 85 */
+ "86", /* 86 */
+ "87", /* 87 */
+ "88", /* 88 */
+ "89", /* 89 */
+ "90", /* 90 */
+ "91", /* 91 */
+ "92", /* 92 */
+ "93", /* 93 */
+ "94", /* 94 */
+ "95", /* 95 */
+ "96", /* 96 */
+ "97", /* 97 */
+ "98", /* 98 */
+ "99", /* 99 */
+ "100", /* 100 */
+ "101", /* 101 */
+ "102", /* 102 */
+ "103", /* 103 */
+ "104", /* 104 */
+ "105", /* 105 */
+ "106", /* 106 */
+ "107", /* 107 */
+ "108", /* 108 */
+ "109", /* 109 */
+ "110", /* 110 */
+ "111", /* 111 */
+ "112", /* 112 */
+ "113", /* 113 */
+ "114", /* 114 */
+ "115", /* 115 */
+ "116", /* 116 */
+ "117", /* 117 */
+ "118", /* 118 */
+ "119", /* 119 */
+ "120", /* 120 */
+ "121", /* 121 */
+ "122", /* 122 */
+ "123", /* 123 */
+ "124", /* 124 */
+ "125", /* 125 */
+ "126", /* 126 */
+ "127", /* 127 */
+ "128", /* 128 */
+ "129", /* 129 */
+ "130", /* 130 */
+ "131", /* 131 */
+ "132", /* 132 */
+ "133", /* 133 */
+ "134", /* 134 */
+ "135", /* 135 */
+ "136", /* 136 */
+ "137", /* 137 */
+ "138", /* 138 */
+ "139", /* 139 */
+ "140", /* 140 */
+ "141", /* 141 */
+ "142", /* 142 */
+ "143", /* 143 */
+ "144", /* 144 */
+ "145", /* 145 */
+ "146", /* 146 */
+ "147", /* 147 */
+ "148", /* 148 */
+ "149", /* 149 */
+ "150", /* 150 */
+ "151", /* 151 */
+ "152", /* 152 */
+ "153", /* 153 */
+ "154", /* 154 */
+ "155", /* 155 */
+ "156", /* 156 */
+ "157", /* 157 */
+ "158", /* 158 */
+ "159", /* 159 */
+ "160", /* 160 */
+ "161", /* 161 */
+ "162", /* 162 */
+ "163", /* 163 */
+ "164", /* 164 */
+ "165", /* 165 */
+ "166", /* 166 */
+ "167", /* 167 */
+ "168", /* 168 */
+ "169", /* 169 */
+ "170", /* 170 */
+ "171", /* 171 */
+ "172", /* 172 */
+ "173", /* 173 */
+ "174", /* 174 */
+ "175", /* 175 */
+ "176", /* 176 */
+ "177", /* 177 */
+ "178", /* 178 */
+ "179", /* 179 */
+ "180", /* 180 */
+ "181", /* 181 */
+ "182", /* 182 */
+ "183", /* 183 */
+ "184", /* 184 */
+ "185", /* 185 */
+ "186", /* 186 */
+ "187", /* 187 */
+ "188", /* 188 */
+ "189", /* 189 */
+ "190", /* 190 */
+ "191", /* 191 */
+ "192", /* 192 */
+ "193", /* 193 */
+ "194", /* 194 */
+ "195", /* 195 */
+ "196", /* 196 */
+ "197", /* 197 */
+ "198", /* 198 */
+ "199", /* 199 */
+ "200", /* 200 */
+ "201", /* 201 */
+ "202", /* 202 */
+ "203", /* 203 */
+ "204", /* 204 */
+ "205", /* 205 */
+ "206", /* 206 */
+ "207", /* 207 */
+ "208", /* 208 */
+ "209", /* 209 */
+ "210", /* 210 */
+ "211", /* 211 */
+ "212", /* 212 */
+ "213", /* 213 */
+ "214", /* 214 */
+ "215", /* 215 */
+ "216", /* 216 */
+ "217", /* 217 */
+ "218", /* 218 */
+ "219", /* 219 */
+ "220", /* 220 */
+ "221", /* 221 */
+ "222", /* 222 */
+ "223", /* 223 */
+ "224", /* 224 */
+ "225", /* 225 */
+ "226", /* 226 */
+ "227", /* 227 */
+ "228", /* 228 */
+ "229", /* 229 */
+ "230", /* 230 */
+ "231", /* 231 */
+ "232", /* 232 */
+ "233", /* 233 */
+ "234", /* 234 */
+ "235", /* 235 */
+ "236", /* 236 */
+ "237", /* 237 */
+ "238", /* 238 */
+ "239", /* 239 */
+ "240", /* 240 */
+ "241", /* 241 */
+ "242", /* 242 */
+ "243", /* 243 */
+ "244", /* 244 */
+ "245", /* 245 */
+ "246", /* 246 */
+ "247", /* 247 */
+ "248", /* 248 */
+ "249", /* 249 */
+ "250", /* 250 */
+ "251", /* 251 */
+ "252", /* 252 */
+ "253", /* 253 */
+ "254", /* 254 */
+ "255", /* 255 */
+ "256", /* 256 */
+ "257", /* 257 */
+ "258", /* 258 */
+ "259", /* 259 */
+ "260", /* 260 */
+ "261", /* 261 */
+ "262", /* 262 */
+ "263", /* 263 */
+ "264", /* 264 */
+ "265", /* 265 */
+ "266", /* 266 */
+ "267", /* 267 */
+ "268", /* 268 */
+ "269", /* 269 */
+ "270", /* 270 */
+ "271", /* 271 */
+ "272", /* 272 */
+ "273", /* 273 */
+ "274", /* 274 */
+ "275", /* 275 */
+ "276", /* 276 */
+ "277", /* 277 */
+ "278", /* 278 */
+ "279", /* 279 */
+ "280", /* 280 */
+ "281", /* 281 */
+ "282", /* 282 */
+ "283", /* 283 */
+ "284", /* 284 */
+ "285", /* 285 */
+ "286", /* 286 */
+ "287", /* 287 */
+ "288", /* 288 */
+ "289", /* 289 */
+ "290", /* 290 */
+ "291", /* 291 */
+ "292", /* 292 */
+ "293", /* 293 */
+ "294", /* 294 */
+ "295", /* 295 */
+ "296", /* 296 */
+ "297", /* 297 */
+ "298", /* 298 */
+ "299", /* 299 */
+ "300", /* 300 */
+ "301", /* 301 */
+ "302", /* 302 */
+ "303", /* 303 */
+ "304", /* 304 */
+ "305", /* 305 */
+ "306", /* 306 */
+ "307", /* 307 */
+ "308", /* 308 */
+ "309", /* 309 */
+ "310", /* 310 */
+ "311", /* 311 */
+ "312", /* 312 */
+ "313", /* 313 */
+ "314", /* 314 */
+ "315", /* 315 */
+ "316", /* 316 */
+ "317", /* 317 */
+ "318", /* 318 */
+ "319", /* 319 */
+ "320", /* 320 */
+ "321", /* 321 */
+ "322", /* 322 */
+ "323", /* 323 */
+ "324", /* 324 */
+ "325", /* 325 */
+ "326", /* 326 */
+ "327", /* 327 */
+ "328", /* 328 */
+ "329", /* 329 */
+ "330", /* 330 */
+ "331", /* 331 */
+ "332", /* 332 */
+ "333", /* 333 */
+ "334", /* 334 */
+ "335", /* 335 */
+ "336", /* 336 */
+ "337", /* 337 */
+ "338", /* 338 */
+ "339", /* 339 */
+ "340", /* 340 */
+ "341", /* 341 */
+ "342", /* 342 */
+ "343", /* 343 */
+ "344", /* 344 */
+ "345", /* 345 */
+ "346", /* 346 */
+ "347", /* 347 */
+ "348", /* 348 */
+ "349", /* 349 */
+ "350", /* 350 */
+ "351", /* 351 */
+ "352", /* 352 */
+ "353", /* 353 */
+ "354", /* 354 */
+ "355", /* 355 */
+ "356", /* 356 */
+ "357", /* 357 */
+ "358", /* 358 */
+ "359", /* 359 */
+ "360", /* 360 */
+ "361", /* 361 */
+ "362", /* 362 */
+ "363", /* 363 */
+ "364", /* 364 */
+ "365", /* 365 */
+ "366", /* 366 */
+ "367", /* 367 */
+ "368", /* 368 */
+ "369", /* 369 */
+ "370", /* 370 */
+ "371", /* 371 */
+ "372", /* 372 */
+ "373", /* 373 */
+ "374", /* 374 */
+ "375", /* 375 */
+ "376", /* 376 */
+ "377", /* 377 */
+ "378", /* 378 */
+ "379", /* 379 */
+ "380", /* 380 */
+ "381", /* 381 */
+ "382", /* 382 */
+ "383", /* 383 */
+ "384", /* 384 */
+ "385", /* 385 */
+ "386", /* 386 */
+ "387", /* 387 */
+ "388", /* 388 */
+ "389", /* 389 */
+ "390", /* 390 */
+ "391", /* 391 */
+ "392", /* 392 */
+ "393", /* 393 */
+ "394", /* 394 */
+ "395", /* 395 */
+ "396", /* 396 */
+ "397", /* 397 */
+ "398", /* 398 */
+ "399", /* 399 */
+ "400", /* 400 */
+ "401", /* 401 */
+ "402", /* 402 */
+ "403", /* 403 */
+ "404", /* 404 */
+ "405", /* 405 */
+ "406", /* 406 */
+ "407", /* 407 */
+ "408", /* 408 */
+ "409", /* 409 */
+ "410", /* 410 */
+ "411", /* 411 */
+ "412", /* 412 */
+ "413", /* 413 */
+ "414", /* 414 */
+ "415", /* 415 */
+ "416", /* 416 */
+ "417", /* 417 */
+ "418", /* 418 */
+ "419", /* 419 */
+ "420", /* 420 */
+ "421", /* 421 */
+ "422", /* 422 */
+ "423", /* 423 */
+ "424", /* 424 */
+ "425", /* 425 */
+ "426", /* 426 */
+ "427", /* 427 */
+ "428", /* 428 */
+ "429", /* 429 */
+ "430", /* 430 */
+ "431", /* 431 */
+ "432", /* 432 */
+ "433", /* 433 */
+ "434", /* 434 */
+ "435", /* 435 */
+ "436", /* 436 */
+ "437", /* 437 */
+ "438", /* 438 */
+ "439", /* 439 */
+ "440", /* 440 */
+ "441", /* 441 */
+ "442", /* 442 */
+ "443", /* 443 */
+ "444", /* 444 */
+ "445", /* 445 */
+ "446", /* 446 */
+ "447", /* 447 */
+ "448", /* 448 */
+ "449", /* 449 */
+ "450", /* 450 */
+ "451", /* 451 */
+ "452", /* 452 */
+ "453", /* 453 */
+ "454", /* 454 */
+ "455", /* 455 */
+ "456", /* 456 */
+ "457", /* 457 */
+ "458", /* 458 */
+ "459", /* 459 */
+ "460", /* 460 */
+ "461", /* 461 */
+ "462", /* 462 */
+ "463", /* 463 */
+ "464", /* 464 */
+ "465", /* 465 */
+ "466", /* 466 */
+ "467", /* 467 */
+ "468", /* 468 */
+ "469", /* 469 */
+ "470", /* 470 */
+ "471", /* 471 */
+ "472", /* 472 */
+ "473", /* 473 */
+ "474", /* 474 */
+ "475", /* 475 */
+ "476", /* 476 */
+ "477", /* 477 */
+ "478", /* 478 */
+ "479", /* 479 */
+ "480", /* 480 */
+ "481", /* 481 */
+ "482", /* 482 */
+ "483", /* 483 */
+ "484", /* 484 */
+ "485", /* 485 */
+ "486", /* 486 */
+ "487", /* 487 */
+ "488", /* 488 */
+ "489", /* 489 */
+ "490", /* 490 */
+ "491", /* 491 */
+ "492", /* 492 */
+ "493", /* 493 */
+ "494", /* 494 */
+ "495", /* 495 */
+ "496", /* 496 */
+ "497", /* 497 */
+ "498", /* 498 */
+ "499", /* 499 */
+ "500", /* 500 */
+ "501", /* 501 */
+ "502", /* 502 */
+ "503", /* 503 */
+ "504", /* 504 */
+ "505", /* 505 */
+ "506", /* 506 */
+ "507", /* 507 */
+ "508", /* 508 */
+ "509", /* 509 */
+ "510", /* 510 */
+ "511", /* 511 */
+ "512", /* 512 */
+ "513", /* 513 */
+ "514", /* 514 */
+ "515", /* 515 */
+ "516", /* 516 */
+ "517", /* 517 */
+ "518", /* 518 */
+ "519", /* 519 */
+ "520", /* 520 */
+ "521", /* 521 */
+ "522", /* 522 */
+ "523", /* 523 */
+ "524", /* 524 */
+ "525", /* 525 */
+ "526", /* 526 */
+ "527", /* 527 */
+ "528", /* 528 */
+ "529", /* 529 */
+ "530", /* 530 */
+ "531", /* 531 */
+ "532", /* 532 */
+ "533", /* 533 */
+ "534", /* 534 */
+ "535", /* 535 */
+ "536", /* 536 */
+ "537", /* 537 */
+ "538", /* 538 */
+ "539", /* 539 */
+ "540", /* 540 */
+ "541", /* 541 */
+ "542", /* 542 */
+ "543", /* 543 */
+ "544", /* 544 */
+ "545", /* 545 */
+ "546", /* 546 */
+ "547", /* 547 */
+ "548", /* 548 */
+ "549", /* 549 */
+ "550", /* 550 */
+ "551", /* 551 */
+ "552", /* 552 */
+ "553", /* 553 */
+ "554", /* 554 */
+ "555", /* 555 */
+ "556", /* 556 */
+ "557", /* 557 */
+ "558", /* 558 */
+ "559", /* 559 */
+ "560", /* 560 */
+ "561", /* 561 */
+ "562", /* 562 */
+ "563", /* 563 */
+ "564", /* 564 */
+ "565", /* 565 */
+ "566", /* 566 */
+ "567", /* 567 */
+ "568", /* 568 */
+ "569", /* 569 */
+ "570", /* 570 */
+ "571", /* 571 */
+ "572", /* 572 */
+ "573", /* 573 */
+ "574", /* 574 */
+ "575", /* 575 */
+ "576", /* 576 */
+ "577", /* 577 */
+ "578", /* 578 */
+ "579", /* 579 */
+ "580", /* 580 */
+ "581", /* 581 */
+ "582", /* 582 */
+ "583", /* 583 */
+ "584", /* 584 */
+ "585", /* 585 */
+ "586", /* 586 */
+ "587", /* 587 */
+ "588", /* 588 */
+ "589", /* 589 */
+ "590", /* 590 */
+ "591", /* 591 */
+ "592", /* 592 */
+ "593", /* 593 */
+ "594", /* 594 */
+ "595", /* 595 */
+ "596", /* 596 */
+ "597", /* 597 */
+ "598", /* 598 */
+ "599", /* 599 */
+ "600", /* 600 */
+ "601", /* 601 */
+ "602", /* 602 */
+ "603", /* 603 */
+ "604", /* 604 */
+ "605", /* 605 */
+ "606", /* 606 */
+ "607", /* 607 */
+ "608", /* 608 */
+ "609", /* 609 */
+ "610", /* 610 */
+ "611", /* 611 */
+ "612", /* 612 */
+ "613", /* 613 */
+ "614", /* 614 */
+ "615", /* 615 */
+ "616", /* 616 */
+ "617", /* 617 */
+ "618", /* 618 */
+ "619", /* 619 */
+ "620", /* 620 */
+ "621", /* 621 */
+ "622", /* 622 */
+ "623", /* 623 */
+ "624", /* 624 */
+ "625", /* 625 */
+ "626", /* 626 */
+ "627", /* 627 */
+ "628", /* 628 */
+ "629", /* 629 */
+ "630", /* 630 */
+ "631", /* 631 */
+ "632", /* 632 */
+ "633", /* 633 */
+ "634", /* 634 */
+ "635", /* 635 */
+ "636", /* 636 */
+ "637", /* 637 */
+ "638", /* 638 */
+ "639", /* 639 */
+ "640", /* 640 */
+ "641", /* 641 */
+ "642", /* 642 */
+ "643", /* 643 */
+ "644", /* 644 */
+ "645", /* 645 */
+ "646", /* 646 */
+ "647", /* 647 */
+ "648", /* 648 */
+ "649", /* 649 */
+ "650", /* 650 */
+ "651", /* 651 */
+ "652", /* 652 */
+ "653", /* 653 */
+ "654", /* 654 */
+ "655", /* 655 */
+ "656", /* 656 */
+ "657", /* 657 */
+ "658", /* 658 */
+ "659", /* 659 */
+ "660", /* 660 */
+ "661", /* 661 */
+ "662", /* 662 */
+ "663", /* 663 */
+ "664", /* 664 */
+ "665", /* 665 */
+ "666", /* 666 */
+ "667", /* 667 */
+ "668", /* 668 */
+ "669", /* 669 */
+ "670", /* 670 */
+ "671", /* 671 */
+ "672", /* 672 */
+ "673", /* 673 */
+ "674", /* 674 */
+ "675", /* 675 */
+ "676", /* 676 */
+ "677", /* 677 */
+ "678", /* 678 */
+ "679", /* 679 */
+ "680", /* 680 */
+ "681", /* 681 */
+ "682", /* 682 */
+ "683", /* 683 */
+ "684", /* 684 */
+ "685", /* 685 */
+ "686", /* 686 */
+ "687", /* 687 */
+ "688", /* 688 */
+ "689", /* 689 */
+ "690", /* 690 */
+ "691", /* 691 */
+ "692", /* 692 */
+ "693", /* 693 */
+ "694", /* 694 */
+ "695", /* 695 */
+ "696", /* 696 */
+ "697", /* 697 */
+ "698", /* 698 */
+ "699", /* 699 */
+ "700", /* 700 */
+ "701", /* 701 */
+ "702", /* 702 */
+ "703", /* 703 */
+ "704", /* 704 */
+ "705", /* 705 */
+ "706", /* 706 */
+ "707", /* 707 */
+ "708", /* 708 */
+ "709", /* 709 */
+ "710", /* 710 */
+ "711", /* 711 */
+ "712", /* 712 */
+ "713", /* 713 */
+ "714", /* 714 */
+ "715", /* 715 */
+ "716", /* 716 */
+ "717", /* 717 */
+ "718", /* 718 */
+ "719", /* 719 */
+ "720", /* 720 */
+ "721", /* 721 */
+ "722", /* 722 */
+ "723", /* 723 */
+ "724", /* 724 */
+ "725", /* 725 */
+ "726", /* 726 */
+ "727", /* 727 */
+ "728", /* 728 */
+ "729", /* 729 */
+ "730", /* 730 */
+ "731", /* 731 */
+ "732", /* 732 */
+ "733", /* 733 */
+ "734", /* 734 */
+ "735", /* 735 */
+ "736", /* 736 */
+ "737", /* 737 */
+ "738", /* 738 */
+ "739", /* 739 */
+ "740", /* 740 */
+ "741", /* 741 */
+ "742", /* 742 */
+ "743", /* 743 */
+ "744", /* 744 */
+ "745", /* 745 */
+ "746", /* 746 */
+ "747", /* 747 */
+ "748", /* 748 */
+ "749", /* 749 */
+ "750", /* 750 */
+ "751", /* 751 */
+ "752", /* 752 */
+ "753", /* 753 */
+ "754", /* 754 */
+ "755", /* 755 */
+ "756", /* 756 */
+ "757", /* 757 */
+ "758", /* 758 */
+ "759", /* 759 */
+ "760", /* 760 */
+ "761", /* 761 */
+ "762", /* 762 */
+ "763", /* 763 */
+ "764", /* 764 */
+ "765", /* 765 */
+ "766", /* 766 */
+ "767", /* 767 */
+ "768", /* 768 */
+ "769", /* 769 */
+ "770", /* 770 */
+ "771", /* 771 */
+ "772", /* 772 */
+ "773", /* 773 */
+ "774", /* 774 */
+ "775", /* 775 */
+ "776", /* 776 */
+ "777", /* 777 */
+ "778", /* 778 */
+ "779", /* 779 */
+ "780", /* 780 */
+ "781", /* 781 */
+ "782", /* 782 */
+ "783", /* 783 */
+ "784", /* 784 */
+ "785", /* 785 */
+ "786", /* 786 */
+ "787", /* 787 */
+ "788", /* 788 */
+ "789", /* 789 */
+ "790", /* 790 */
+ "791", /* 791 */
+ "792", /* 792 */
+ "793", /* 793 */
+ "794", /* 794 */
+ "795", /* 795 */
+ "796", /* 796 */
+ "797", /* 797 */
+ "798", /* 798 */
+ "799", /* 799 */
+ "800", /* 800 */
+ "801", /* 801 */
+ "802", /* 802 */
+ "803", /* 803 */
+ "804", /* 804 */
+ "805", /* 805 */
+ "806", /* 806 */
+ "807", /* 807 */
+ "808", /* 808 */
+ "809", /* 809 */
+ "810", /* 810 */
+ "811", /* 811 */
+ "812", /* 812 */
+ "813", /* 813 */
+ "814", /* 814 */
+ "815", /* 815 */
+ "816", /* 816 */
+ "817", /* 817 */
+ "818", /* 818 */
+ "819", /* 819 */
+ "820", /* 820 */
+ "821", /* 821 */
+ "822", /* 822 */
+ "823", /* 823 */
+ "824", /* 824 */
+ "825", /* 825 */
+ "826", /* 826 */
+ "827", /* 827 */
+ "828", /* 828 */
+ "829", /* 829 */
+ "830", /* 830 */
+ "831", /* 831 */
+ "832", /* 832 */
+ "833", /* 833 */
+ "834", /* 834 */
+ "835", /* 835 */
+ "836", /* 836 */
+ "837", /* 837 */
+ "838", /* 838 */
+ "839", /* 839 */
+ "840", /* 840 */
+ "841", /* 841 */
+ "842", /* 842 */
+ "843", /* 843 */
+ "844", /* 844 */
+ "845", /* 845 */
+ "846", /* 846 */
+ "847", /* 847 */
+ "848", /* 848 */
+ "849", /* 849 */
+ "850", /* 850 */
+ "851", /* 851 */
+ "852", /* 852 */
+ "853", /* 853 */
+ "854", /* 854 */
+ "855", /* 855 */
+ "856", /* 856 */
+ "857", /* 857 */
+ "858", /* 858 */
+ "859", /* 859 */
+ "860", /* 860 */
+ "861", /* 861 */
+ "862", /* 862 */
+ "863", /* 863 */
+ "864", /* 864 */
+ "865", /* 865 */
+ "866", /* 866 */
+ "867", /* 867 */
+ "868", /* 868 */
+ "869", /* 869 */
+ "870", /* 870 */
+ "871", /* 871 */
+ "872", /* 872 */
+ "873", /* 873 */
+ "874", /* 874 */
+ "875", /* 875 */
+ "876", /* 876 */
+ "877", /* 877 */
+ "878", /* 878 */
+ "879", /* 879 */
+ "880", /* 880 */
+ "881", /* 881 */
+ "882", /* 882 */
+ "883", /* 883 */
+ "884", /* 884 */
+ "885", /* 885 */
+ "886", /* 886 */
+ "887", /* 887 */
+ "888", /* 888 */
+ "889", /* 889 */
+ "890", /* 890 */
+ "891", /* 891 */
+ "892", /* 892 */
+ "893", /* 893 */
+ "894", /* 894 */
+ "895", /* 895 */
+ "896", /* 896 */
+ "897", /* 897 */
+ "898", /* 898 */
+ "899", /* 899 */
+ "900", /* 900 */
+ "901", /* 901 */
+ "902", /* 902 */
+ "903", /* 903 */
+ "904", /* 904 */
+ "905", /* 905 */
+ "906", /* 906 */
+ "907", /* 907 */
+ "908", /* 908 */
+ "909", /* 909 */
+ "910", /* 910 */
+ "911", /* 911 */
+ "912", /* 912 */
+ "913", /* 913 */
+ "914", /* 914 */
+ "915", /* 915 */
+ "916", /* 916 */
+ "917", /* 917 */
+ "918", /* 918 */
+ "919", /* 919 */
+ "920", /* 920 */
+ "921", /* 921 */
+ "922", /* 922 */
+ "923", /* 923 */
+ "924", /* 924 */
+ "925", /* 925 */
+ "926", /* 926 */
+ "927", /* 927 */
+ "928", /* 928 */
+ "929", /* 929 */
+ "930", /* 930 */
+ "931", /* 931 */
+ "932", /* 932 */
+ "933", /* 933 */
+ "934", /* 934 */
+ "935", /* 935 */
+ "936", /* 936 */
+ "937", /* 937 */
+ "938", /* 938 */
+ "939", /* 939 */
+ "940", /* 940 */
+ "941", /* 941 */
+ "942", /* 942 */
+ "943", /* 943 */
+ "944", /* 944 */
+ "945", /* 945 */
+ "946", /* 946 */
+ "947", /* 947 */
+ "948", /* 948 */
+ "949", /* 949 */
+ "950", /* 950 */
+ "951", /* 951 */
+ "952", /* 952 */
+ "953", /* 953 */
+ "954", /* 954 */
+ "955", /* 955 */
+ "956", /* 956 */
+ "957", /* 957 */
+ "958", /* 958 */
+ "959", /* 959 */
+ "960", /* 960 */
+ "961", /* 961 */
+ "962", /* 962 */
+ "963", /* 963 */
+ "964", /* 964 */
+ "965", /* 965 */
+ "966", /* 966 */
+ "967", /* 967 */
+ "968", /* 968 */
+ "969", /* 969 */
+ "970", /* 970 */
+ "971", /* 971 */
+ "972", /* 972 */
+ "973", /* 973 */
+ "974", /* 974 */
+ "975", /* 975 */
+ "976", /* 976 */
+ "977", /* 977 */
+ "978", /* 978 */
+ "979", /* 979 */
+ "980", /* 980 */
+ "981", /* 981 */
+ "982", /* 982 */
+ "983", /* 983 */
+ "984", /* 984 */
+ "985", /* 985 */
+ "986", /* 986 */
+ "987", /* 987 */
+ "988", /* 988 */
+ "989", /* 989 */
+ "990", /* 990 */
+ "991", /* 991 */
+ "992", /* 992 */
+ "993", /* 993 */
+ "994", /* 994 */
+ "995", /* 995 */
+ "996", /* 996 */
+ "997", /* 997 */
+ "998", /* 998 */
+ "999", /* 999 */
+ "1000", /* 1000 */
+ "1001", /* 1001 */
+ "1002", /* 1002 */
+ "1003", /* 1003 */
+ "1004", /* 1004 */
+ "1005", /* 1005 */
+ "1006", /* 1006 */
+ "1007", /* 1007 */
+ "1008", /* 1008 */
+ "1009", /* 1009 */
+ "1010", /* 1010 */
+ "1011", /* 1011 */
+ "1012", /* 1012 */
+ "1013", /* 1013 */
+ "1014", /* 1014 */
+ "1015", /* 1015 */
+ "1016", /* 1016 */
+ "1017", /* 1017 */
+ "1018", /* 1018 */
+ "1019", /* 1019 */
+ "1020", /* 1020 */
+ "1021", /* 1021 */
+ "1022", /* 1022 */
+ "1023", /* 1023 */
+ "ni_syscall", /* 1024 */
+ "exit", /* 1025 */
+ "read", /* 1026 */
+ "write", /* 1027 */
+ "open", /* 1028 */
+ "close", /* 1029 */
+ "creat", /* 1030 */
+ "link", /* 1031 */
+ "unlink", /* 1032 */
+ "execve", /* 1033 */
+ "chdir", /* 1034 */
+ "fchdir", /* 1035 */
+ "utimes", /* 1036 */
+ "mknod", /* 1037 */
+ "chmod", /* 1038 */
+ "chown", /* 1039 */
+ "lseek", /* 1040 */
+ "getpid", /* 1041 */
+ "getppid", /* 1042 */
+ "mount", /* 1043 */
+ "umount", /* 1044 */
+ "setuid", /* 1045 */
+ "getuid", /* 1046 */
+ "geteuid", /* 1047 */
+ "ptrace", /* 1048 */
+ "access", /* 1049 */
+ "sync", /* 1050 */
+ "fsync", /* 1051 */
+ "fdatasync", /* 1052 */
+ "kill", /* 1053 */
+ "rename", /* 1054 */
+ "mkdir", /* 1055 */
+ "rmdir", /* 1056 */
+ "dup", /* 1057 */
+ "pipe", /* 1058 */
+ "times", /* 1059 */
+ "brk", /* 1060 */
+ "setgid", /* 1061 */
+ "getgid", /* 1062 */
+ "getegid", /* 1063 */
+ "acct", /* 1064 */
+ "ioctl", /* 1065 */
+ "fcntl", /* 1066 */
+ "umask", /* 1067 */
+ "chroot", /* 1068 */
+ "ustat", /* 1069 */
+ "dup2", /* 1070 */
+ "setreuid", /* 1071 */
+ "setregid", /* 1072 */
+ "getresuid", /* 1073 */
+ "setresuid", /* 1074 */
+ "getresgid", /* 1075 */
+ "setresgid", /* 1076 */
+ "getgroups", /* 1077 */
+ "setgroups", /* 1078 */
+ "getpgid", /* 1079 */
+ "setpgid", /* 1080 */
+ "setsid", /* 1081 */
+ "getsid", /* 1082 */
+ "sethostname", /* 1083 */
+ "setrlimit", /* 1084 */
+ "getrlimit", /* 1085 */
+ "getrusage", /* 1086 */
+ "gettimeofday", /* 1087 */
+ "settimeofday", /* 1088 */
+ "select", /* 1089 */
+ "poll", /* 1090 */
+ "symlink", /* 1091 */
+ "readlink", /* 1092 */
+ "uselib", /* 1093 */
+ "swapon", /* 1094 */
+ "swapoff", /* 1095 */
+ "reboot", /* 1096 */
+ "truncate", /* 1097 */
+ "ftruncate", /* 1098 */
+ "fchmod", /* 1099 */
+ "fchown", /* 1100 */
+ "getpriority", /* 1101 */
+ "setpriority", /* 1102 */
+ "statfs", /* 1103 */
+ "fstatfs", /* 1104 */
+ "gettid", /* 1105 */
+ "semget", /* 1106 */
+ "semop", /* 1107 */
+ "semctl", /* 1108 */
+ "msgget", /* 1109 */
+ "msgsnd", /* 1110 */
+ "msgrcv", /* 1111 */
+ "msgctl", /* 1112 */
+ "shmget", /* 1113 */
+ "shmat", /* 1114 */
+ "shmdt", /* 1115 */
+ "shmctl", /* 1116 */
+ "syslog", /* 1117 */
+ "setitimer", /* 1118 */
+ "getitimer", /* 1119 */
+ "1120", /* 1120 */
+ "1121", /* 1121 */
+ "1122", /* 1122 */
+ "vhangup", /* 1123 */
+ "lchown", /* 1124 */
+ "remap_file_pages", /* 1125 */
+ "wait4", /* 1126 */
+ "sysinfo", /* 1127 */
+ "clone", /* 1128 */
+ "setdomainname", /* 1129 */
+ "uname", /* 1130 */
+ "adjtimex", /* 1131 */
+ "create_module", /* 1132 */
+ "init_module", /* 1133 */
+ "delete_module", /* 1134 */
+ "get_kernel_syms", /* 1135 */
+ "query_module", /* 1136 */
+ "quotactl", /* 1137 */
+ "bdflush", /* 1138 */
+ "sysfs", /* 1139 */
+ "personality", /* 1140 */
+ "afs_syscall", /* 1141 */
+ "setfsuid", /* 1142 */
+ "setfsgid", /* 1143 */
+ "getdents", /* 1144 */
+ "flock", /* 1145 */
+ "readv", /* 1146 */
+ "writev", /* 1147 */
+ "pread64", /* 1148 */
+ "pwrite64", /* 1149 */
+ "_sysctl", /* 1150 */
+ "mmap", /* 1151 */
+ "munmap", /* 1152 */
+ "mlock", /* 1153 */
+ "mlockall", /* 1154 */
+ "mprotect", /* 1155 */
+ "mremap", /* 1156 */
+ "msync", /* 1157 */
+ "munlock", /* 1158 */
+ "munlockall", /* 1159 */
+ "sched_getparam", /* 1160 */
+ "sched_setparam", /* 1161 */
+ "sched_getscheduler", /* 1162 */
+ "sched_setscheduler", /* 1163 */
+ "sched_yield", /* 1164 */
+ "sched_get_priority_max", /* 1165 */
+ "sched_get_priority_min", /* 1166 */
+ "sched_rr_get_interval", /* 1167 */
+ "nanosleep", /* 1168 */
+ "nfsservctl", /* 1169 */
+ "prctl", /* 1170 */
+ "1171", /* 1171 */
+ "mmap2", /* 1172 */
+ "pciconfig_read", /* 1173 */
+ "pciconfig_write", /* 1174 */
+ "perfmonctl", /* 1175 */
+ "sigaltstack", /* 1176 */
+ "rt_sigaction", /* 1177 */
+ "rt_sigpending", /* 1178 */
+ "rt_sigprocmask", /* 1179 */
+ "rt_sigqueueinfo", /* 1180 */
+ "rt_sigreturn", /* 1181 */
+ "rt_sigsuspend", /* 1182 */
+ "rt_sigtimedwait", /* 1183 */
+ "getcwd", /* 1184 */
+ "capget", /* 1185 */
+ "capset", /* 1186 */
+ "sendfile", /* 1187 */
+ "getpmsg", /* 1188 */
+ "putpmsg", /* 1189 */
+ "socket", /* 1190 */
+ "bind", /* 1191 */
+ "connect", /* 1192 */
+ "listen", /* 1193 */
+ "accept", /* 1194 */
+ "getsockname", /* 1195 */
+ "getpeername", /* 1196 */
+ "socketpair", /* 1197 */
+ "send", /* 1198 */
+ "sendto", /* 1199 */
+ "recv", /* 1200 */
+ "recvfrom", /* 1201 */
+ "shutdown", /* 1202 */
+ "setsockopt", /* 1203 */
+ "getsockopt", /* 1204 */
+ "sendmsg", /* 1205 */
+ "recvmsg", /* 1206 */
+ "pivot_root", /* 1207 */
+ "mincore", /* 1208 */
+ "madvise", /* 1209 */
+ "stat", /* 1210 */
+ "lstat", /* 1211 */
+ "fstat", /* 1212 */
+ "clone2", /* 1213 */
+ "getdents64", /* 1214 */
+ "getunwind", /* 1215 */
+ "readahead", /* 1216 */
+ "setxattr", /* 1217 */
+ "lsetxattr", /* 1218 */
+ "fsetxattr", /* 1219 */
+ "getxattr", /* 1220 */
+ "lgetxattr", /* 1221 */
+ "fgetxattr", /* 1222 */
+ "listxattr", /* 1223 */
+ "llistxattr", /* 1224 */
+ "flistxattr", /* 1225 */
+ "removexattr", /* 1226 */
+ "lremovexattr", /* 1227 */
+ "fremovexattr", /* 1228 */
+ "tkill", /* 1229 */
+ "futex", /* 1230 */
+ "sched_setaffinity", /* 1231 */
+ "sched_getaffinity", /* 1232 */
+ "set_tid_address", /* 1233 */
+ "fadvise64", /* 1234 */
+ "tgkill", /* 1235 */
+ "exit_group", /* 1236 */
+ "lookup_dcookie", /* 1237 */
+ "io_setup", /* 1238 */
+ "io_destroy", /* 1239 */
+ "io_getevents", /* 1240 */
+ "io_submit", /* 1241 */
+ "io_cancel", /* 1242 */
+ "epoll_create", /* 1243 */
+ "epoll_ctl", /* 1244 */
+ "epoll_wait", /* 1245 */
+ "restart_syscall", /* 1246 */
+ "semtimedop", /* 1247 */
+ "timer_create", /* 1248 */
+ "timer_settime", /* 1249 */
+ "timer_gettime", /* 1250 */
+ "timer_getoverrun", /* 1251 */
+ "timer_delete", /* 1252 */
+ "clock_settime", /* 1253 */
+ "clock_gettime", /* 1254 */
+ "clock_getres", /* 1255 */
+ "clock_nanosleep", /* 1256 */
+ "fstatfs64", /* 1257 */
+ "statfs64", /* 1258 */
+ "mbind", /* 1259 */
+ "get_mempolicy", /* 1260 */
+ "set_mempolicy", /* 1261 */
+ "mq_open", /* 1262 */
+ "mq_unlink", /* 1263 */
+ "mq_timedsend", /* 1264 */
+ "mq_timedreceive", /* 1265 */
+ "mq_notify", /* 1266 */
+ "mq_getsetattr", /* 1267 */
+ "kexec_load", /* 1268 */
+ "vserver", /* 1269 */
+ "waitid", /* 1270 */
+ "add_key", /* 1271 */
+ "request_key", /* 1272 */
+ "keyctl", /* 1273 */
+ "ioprio_set", /* 1274 */
+ "ioprio_get", /* 1275 */
+ "set_zone_reclaim", /* 1276 */
+ "inotify_init", /* 1277 */
+ "inotify_add_watch", /* 1278 */
+ "inotify_rm_watch", /* 1279 */
--- ltrace-0.3.36/sysdeps/linux-gnu/ia64/trace.c.jj 2006-01-09 14:36:14.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ia64/trace.c 2006-01-09 14:36:14.000000000 +0100
@@ -0,0 +1,140 @@
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <sys/ptrace.h>
+#include <string.h>
+#include <asm/ptrace_offsets.h>
+#include <asm/rse.h>
+
+#include "ltrace.h"
+
+/* What we think of as a bundle, ptrace thinks of it as two unsigned
+ * longs */
+union bundle_t {
+ /* An IA64 instruction bundle has a 5 bit header describing the
+ * type of bundle, then 3 41 bit instructions
+ */
+ struct {
+ struct {
+ unsigned long template : 5 ;
+ unsigned long slot0 : 41;
+ unsigned long bot_slot1 : 18;
+ } word0;
+ struct {
+ unsigned long top_slot1 : 23;
+ unsigned long slot2 : 41;
+ } word1;
+ } bitmap;
+ unsigned long code[2];
+};
+
+int
+syscall_p(struct process * proc, int status, int * sysnum) {
+
+ if (WIFSTOPPED(status) && WSTOPSIG(status) == (SIGTRAP | proc->tracesysgood)) {
+ unsigned long slot = (ptrace (PTRACE_PEEKUSER, proc->pid, PT_CR_IPSR, 0) >> 41) & 0x3;
+ unsigned long ip = ptrace(PTRACE_PEEKUSER, proc->pid, PT_CR_IIP, 0);
+
+ /* r15 holds the system call number */
+ unsigned long r15 = ptrace (PTRACE_PEEKUSER, proc->pid, PT_R15, 0);
+ unsigned long insn;
+
+ union bundle_t bundle;
+
+ /* On fault, the IP has moved forward to the next
+ * slot. If that is zero, then the actual place we
+ * broke was in the previous bundle, so wind back the
+ * IP.
+ */
+ if (slot == 0)
+ ip = ip - 16;
+ bundle.code[0] = ptrace (PTRACE_PEEKTEXT, proc->pid, ip, 0);
+ bundle.code[1] = ptrace (PTRACE_PEEKTEXT, proc->pid, ip+8, 0);
+
+ unsigned long bot = 0UL | bundle.bitmap.word0.bot_slot1;
+ unsigned long top = 0UL | bundle.bitmap.word1.top_slot1;
+
+ /* handle the rollback, slot 0 is actually slot 2 of
+ * the previous instruction (see above) */
+ switch (slot) {
+ case 0:
+ insn = bundle.bitmap.word1.slot2;
+ break;
+ case 1:
+ insn = bundle.bitmap.word0.slot0;
+ break;
+ case 2:
+ /* make sure we're shifting about longs */
+ insn = 0UL | bot | (top << 18UL);
+ break;
+ default:
+ printf("Ummm, can't find instruction slot?\n");
+ exit(1);
+ }
+
+ /* We need to support both the older break instruction
+ * type syscalls, and the new epc type ones.
+ *
+ * Bit 20 of the break constant is encoded in the "i"
+ * bit (bit 36) of the instruction, hence you should
+ * see 0x1000000000.
+ *
+ * An EPC call is just 0x1ffffffffff
+ */
+ if (insn == 0x1000000000 || insn == 0x1ffffffffff) {
+ *sysnum = r15;
+ if (proc->callstack_depth > 0 &&
+ proc->callstack[proc->callstack_depth-1].is_syscall) {
+ return 2;
+ }
+ return 1;
+ }
+ }
+ return 0;
+}
+
+long
+gimme_arg(enum tof type, struct process * proc, int arg_num) {
+
+ unsigned long bsp, cfm;
+
+ bsp = ptrace (PTRACE_PEEKUSER, proc->pid, PT_AR_BSP, 0);
+ cfm = ptrace(PTRACE_PEEKUSER, proc->pid, PT_CFM, 0);
+
+ if (arg_num==-1) /* return value */
+ return ptrace (PTRACE_PEEKUSER, proc->pid, PT_R8, 0);
+
+ /* First 8 arguments are passed in registers on the register
+ * stack, the following arguments are passed on the stack
+ * after a 16 byte scratch area
+ */
+ if (type==LT_TOF_FUNCTION || LT_TOF_FUNCTIONR) {
+ if (arg_num < 8)
+ return ptrace (PTRACE_PEEKDATA, proc->pid, (long)ia64_rse_skip_regs((long*)bsp, -cfm+arg_num), 0);
+ else {
+ unsigned long sp = ptrace (PTRACE_PEEKUSER, proc->pid, PT_R12, 0) + 16;
+ return ptrace (PTRACE_PEEKDATA, proc->pid, sp + (8*(arg_num - 8)));
+ }
+ }
+
+ if (type==LT_TOF_SYSCALL || LT_TOF_SYSCALLR )
+ return ptrace (PTRACE_PEEKDATA, proc->pid, (long)ia64_rse_skip_regs((long *) bsp, arg_num), 0);
+
+ /* error if we get here */
+ fprintf(stderr, "gimme_arg called with wrong arguments\n");
+ exit(1);
+}
+
+void
+save_register_args(enum tof type, struct process * proc) {
+}
+
+void
+get_arch_dep(struct process * proc) {
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/trace.c.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/trace.c 2006-01-09 14:31:13.000000000 +0100
@@ -141,7 +141,8 @@ continue_after_breakpoint(struct process
continue_process(proc->pid);
} else {
proc->breakpoint_being_enabled = sbp;
-#ifdef __sparc__
+#if defined __sparc__ || defined __ia64___
+ /* we don't want to singlestep here */
continue_process(proc->pid);
#else
ptrace(PTRACE_SINGLESTEP, proc->pid, 0, 0);
--- ltrace-0.3.36/debian/control.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/debian/control 2006-01-09 14:14:41.000000000 +0100
@@ -6,7 +6,7 @@ Standards-Version: 3.6.1
Build-Depends: binutils-dev, dpatch, libelfg0-dev
Package: ltrace
-Architecture: i386 arm m68k s390 powerpc sparc alpha amd64
+Architecture: i386 arm m68k s390 powerpc sparc alpha amd64 ia64
Depends: ${shlibs:Depends}
Description: Tracks runtime library calls in dynamically linked programs
ltrace is a debugging program which runs a specified command until it
--- ltrace-0.3.36/debian/copyright.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/debian/copyright 2006-01-09 14:14:41.000000000 +0100
@@ -4,7 +4,7 @@ Dynamic Library Tracer ``ltrace''.
Copyrights
----------
-Copyright (C) 1997-2004 Juan Cespedes <cespedes at debian.org>
+Copyright (C) 1997-2005 Juan Cespedes <cespedes at debian.org>
ARMLinux port: Copyright (C) 1998 Pat Beirne <pbeirne at home.com>
m68k port: Copyright (C) 1998 Roman Hodek <Roman.Hodek at informatik.uni-erlangen.de>
@@ -13,7 +13,7 @@ s390 port: Copyright (C) 2001 IBM Poughk
ELF hacking: Copyright (C) 1999 Silvio Cesare <silvio at big.net.au>
PowerPC port: Copyright (C) 2001-2002 Anton Blanchard <anton at samba.org>
SPARC port: Copyright (C) 1999 Jakub Jelinek <jakub at redhat.com>
-
+IA64 port: Copyright (C) 2004 Ian Wienand <ianw at gelato.unsw.edu.au>
Autoconf stuff: Copyright 1992-1996 Free Software Foundation, Inc.
install-sh: Copyright 1991 by the Massachusetts Institute of Technology
--- ltrace-0.3.36/debian/rules.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/debian/rules 2006-01-09 14:14:41.000000000 +0100
@@ -1,6 +1,6 @@
#! /usr/bin/make -f
#
-# Copyright (C) 1997-2004 Juan Cespedes <cespedes at debian.org>
+# Copyright (C) 1997-2005 Juan Cespedes <cespedes at debian.org>
#
.PHONY: binary binary-indep binary-arch clean
--- ltrace-0.3.36/ltrace.1.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/ltrace.1 2006-01-09 14:14:41.000000000 +0100
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1997-2004 Juan Cespedes <cespedes at debian.org>
+.\" Copyright (c) 1997-2005 Juan Cespedes <cespedes at debian.org>
.\" This file is covered by the GNU GPL
.TH ltrace 1
.SH NAME
--- ltrace-0.3.36/options.c.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/options.c 2006-01-09 14:15:10.000000000 +0100
@@ -290,7 +290,7 @@ process_options(int argc, char **argv) {
case 'u': opt_u = optarg;
break;
case 'V': printf("ltrace version " PACKAGE_VERSION ".\n"
-"Copyright (C) 1997-2005 Juan Cespedes <cespedes at debian.org>.\n"
+"Copyright (C) 1997-2006 Juan Cespedes <cespedes at debian.org>.\n"
"This is free software; see the GNU General Public Licence\n"
"version 2 or later for copying conditions. There is NO warranty.\n");
exit(0);
--- ltrace-0.3.36/elf.c.jj 2006-01-09 13:36:04.000000000 +0100
+++ ltrace-0.3.36/elf.c 2006-01-09 14:20:51.000000000 +0100
@@ -206,7 +206,10 @@ do_init_elf (struct ltelf *lte, const ch
else if (shdr.sh_type == SHT_PROGBITS || shdr.sh_type == SHT_NOBITS)
{
if (strcmp (name, ".plt") == 0)
- lte->plt_addr = shdr.sh_addr;
+ {
+ lte->plt_addr = shdr.sh_addr;
+ lte->plt_size = shdr.sh_size;
+ }
else if (strcmp (name, ".opd") == 0)
{
lte->opd_addr = (GElf_Addr *)shdr.sh_addr;
--- ltrace-0.3.36/README.jj 2004-11-10 00:08:55.000000000 +0100
+++ ltrace-0.3.36/README 2006-01-09 14:14:41.000000000 +0100
@@ -2,7 +2,7 @@
A Dynamic Library Tracer
- Copyright 1997-2004 Juan Cespedes <cespedes at debian.org>
+ Copyright 1997-2005 Juan Cespedes <cespedes at debian.org>
Contents
@@ -31,6 +31,7 @@ people have contributed significantly to
* Jakub Jelinek <jakub at redhat.com> (SPARC port, support for libelf, many fixes)
* Jakub Bogusz <qboosh at pld-linux.org> (alpha port)
* SuSE (amd64 port)
+* Ian Wienand <ianw at gelato.unsw.edu.au> (IA64 port)
1. Introduction
---------------
@@ -70,7 +71,7 @@ This file is very incomplete and out-of-
6. License
----------
- Copyright (C) 1997-2004 Juan Cespedes <cespedes at debian.org>
+ Copyright (C) 1997-2005 Juan Cespedes <cespedes at debian.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
--- ltrace-0.3.36/elf.h.jj 2006-01-09 13:16:44.000000000 +0100
+++ ltrace-0.3.36/elf.h 2006-01-09 14:17:17.000000000 +0100
@@ -15,6 +15,7 @@ struct ltelf
size_t dynsym_count;
const char *dynstr;
GElf_Addr plt_addr;
+ size_t plt_size;
Elf_Data *relplt;
size_t relplt_count;
Elf_Data *symtab;
ltrace-ppc64-2.patch:
breakpoints.c | 2 +-
elf.c | 16 +++++++++++-----
ltrace.1 | 14 +++++++++++++-
options.c | 19 ++++++++++++++-----
sysdeps/linux-gnu/alpha/arch.h | 1 +
sysdeps/linux-gnu/arm/arch.h | 1 +
sysdeps/linux-gnu/i386/arch.h | 1 +
sysdeps/linux-gnu/m68k/arch.h | 1 +
sysdeps/linux-gnu/ppc/arch.h | 3 ++-
sysdeps/linux-gnu/s390/arch.h | 1 +
sysdeps/linux-gnu/sparc/arch.h | 1 +
sysdeps/linux-gnu/x86_64/arch.h | 1 +
12 files changed, 48 insertions(+), 13 deletions(-)
--- NEW FILE ltrace-ppc64-2.patch ---
--- ltrace-0.3.36/breakpoints.c 26 Jun 2005 18:18:52 -0000 1.5
+++ ltrace-0.3.36/breakpoints.c 27 Sep 2005 17:23:27 -0000 1.6
@@ -48,7 +48,7 @@
sbp->addr = addr;
sbp->libsym = libsym;
if (libsym)
- libsym->brkpnt = addr;
+ libsym->brkpnt = sbp;
}
sbp->enabled++;
if (sbp->enabled==1 && proc->pid) enable_breakpoint(proc->pid, sbp);
--- ltrace-0.3.36/elf.c 26 Jun 2005 18:18:52 -0000 1.6
+++ ltrace-0.3.36/elf.c 23 Dec 2005 22:15:52 -0000 1.10
@@ -335,14 +335,14 @@
GElf_Addr ret_val;
if (!lte->opd)
- error (EXIT_FAILURE, 0, "Couldn't do static plt2addr");
+ return (GElf_Addr)addr;
base = (long)lte->opd->d_buf;
offset = (long)addr - (long)lte->opd_addr;
if (offset > lte->opd_size)
error (EXIT_FAILURE, 0, "static plt not in .opd");
- ret_val = (void *) *(long*)(base + offset);
+ ret_val = (GElf_Addr) *(long*)(base + offset);
return ret_val;
}
@@ -388,7 +388,7 @@
error (EXIT_FAILURE, 0, "Couldn't get relocation from \"%s\"",
proc->filename);
- if ( ! sym.st_value)
+ if ( ! sym.st_value && PLTs_initialized_by_here)
proc->need_to_reinitialize_breakpoints = 1;
name = lte->dynstr + sym.st_name;
@@ -441,14 +441,20 @@
/* FIXME: Should be able to use &library_symbols as above. But
when you do, none of the real library symbols cause breaks. */
add_library_symbol (elf_plt2addr(lte, (void *)addr), name, lib_tail, 1);
- xptr->name = NULL;
break;
}
}
for (xptr=opt_x; xptr; xptr=xptr->next)
if (xptr->name)
- fprintf (stderr, "Warning: Couldn't get symbol \"%s\" from \"%s\" or it's a duplicate",
+ {
+ if (strcmp(xptr->name, E_ENTRY_NAME) == 0)
+ add_library_symbol (elf_plt2addr(lte, (void*)lte->ehdr.e_entry),
+ "_start", lib_tail, 1);
+ else
+ fprintf (stderr, "Warning: Couldn't get symbol \"%s\" "
+ "from \"%s\" or it's a duplicate",
xptr->name, proc->filename);
+ }
for (i = 0; i < library_num + 1; ++i)
do_close_elf (<e[i]);
--- ltrace-0.3.36/ltrace.1 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/ltrace.1 27 Sep 2005 17:23:27 -0000 1.2
@@ -6,7 +6,7 @@
.SH SYNOPSIS
.B ltrace
-.I "[-CdfhiLrStttV] [-a column] [-e expr] [-l filename] [-n nr] [-o filename] [-p pid] ... [-s strsize] [-u username] [--align=column] [--debug] [--demangle] [--help] [--indent=nr] [--library=filename] [--output=filename] [--version] [command [arg ...]]"
+.I "[-CdfhiLrStttV] [-a column] [-e expr] [-l filename] [-n nr] [-o filename] [-p pid] ... [-s strsize] [-u username] [-X extern] [-x extern] ... [--align=column] [--debug] [--demangle] [--help] [--indent=nr] [--library=filename] [--output=filename] [--version] [command [arg ...]]"
.SH DESCRIPTION
.B ltrace
@@ -127,6 +127,18 @@
This option is only useful when running as root and enables the
correct execution of setuid and/or setgid binaries.
.TP
+.I \-X extern
+Some architectures need to know where to set a breakpoint that will be hit
+after the dynamic linker has run. If this flag is used, then the breakpoint
+is set at
+.IR extern ,
+which must be an external function. By default, 'main' is used.
+.TP
+.I \-x extern
+Trace the external function
+.IR extern .
+This option may be repeated.
+.TP
.I \-V, \-\-version
Show the version number of ltrace and exit.
--- ltrace-0.3.36/options.c 26 Jun 2005 18:15:15 -0000 1.4
+++ ltrace-0.3.36/options.c 20 Dec 2005 00:40:08 -0000 1.5
@@ -299,14 +299,23 @@
case 'x':
{
- struct opt_e_t * tmp = malloc(sizeof(struct opt_e_t));
- if (!tmp) {
+ struct opt_e_t * p = opt_x;
+
+ /* First, check for duplicate. */
+ while (p && strcmp(p->name, optarg)) {
+ p = p->next;
+ }
+ if (p) { break; }
+
+ /* If not duplicate, add to list. */
+ p = malloc(sizeof(struct opt_e_t));
+ if (!p) {
perror("ltrace: malloc");
exit(1);
}
- tmp->name = optarg;
- tmp->next = opt_x;
- opt_x = tmp;
+ p->name = optarg;
+ p->next = opt_x;
+ opt_x = p;
break;
}
--- ltrace-0.3.36/sysdeps/linux-gnu/alpha/arch.h 26 Jun 2005 18:15:26 -0000 1.3
+++ ltrace-0.3.36/sysdeps/linux-gnu/alpha/arch.h 22 Dec 2005 22:37:16 -0000 1.4
@@ -8,3 +8,4 @@
#define LT_ELF_MACHINE2 EM_FAKE_ALPHA
#define PLTs_INIT_BY_HERE NULL
+#define E_ENTRY_NAME "_start"
--- ltrace-0.3.36/sysdeps/linux-gnu/arm/arch.h 26 Jun 2005 18:15:26 -0000 1.2
+++ ltrace-0.3.36/sysdeps/linux-gnu/arm/arch.h 22 Dec 2005 22:37:16 -0000 1.3
@@ -6,3 +6,4 @@
#define LT_ELF_MACHINE EM_ARM
#define PLTs_INIT_BY_HERE NULL
+#define E_ENTRY_NAME "_start"
--- ltrace-0.3.36/sysdeps/linux-gnu/i386/arch.h 26 Jun 2005 18:15:26 -0000 1.2
+++ ltrace-0.3.36/sysdeps/linux-gnu/i386/arch.h 22 Dec 2005 22:37:16 -0000 1.3
@@ -6,3 +6,4 @@
#define LT_ELF_MACHINE EM_386
#define PLTs_INIT_BY_HERE NULL
+#define E_ENTRY_NAME "_start"
--- ltrace-0.3.36/sysdeps/linux-gnu/m68k/arch.h 26 Jun 2005 18:15:26 -0000 1.2
+++ ltrace-0.3.36/sysdeps/linux-gnu/m68k/arch.h 22 Dec 2005 22:37:16 -0000 1.3
@@ -6,3 +6,4 @@
#define LT_ELF_MACHINE EM_68K
#define PLTs_INIT_BY_HERE NULL
+#define E_ENTRY_NAME "_start"
--- ltrace-0.3.36/sysdeps/linux-gnu/ppc/arch.h 26 Jun 2005 18:15:26 -0000 1.3
+++ ltrace-0.3.36/sysdeps/linux-gnu/ppc/arch.h 22 Dec 2005 22:37:16 -0000 1.4
@@ -1,6 +1,7 @@
#define BREAKPOINT_VALUE { 0x7f, 0xe0, 0x00, 0x08 }
#define BREAKPOINT_LENGTH 4
#define DECR_PC_AFTER_BREAK 0
+#define E_ENTRY_NAME "_start"
#define LT_ELFCLASS ELFCLASS32
#define LT_ELF_MACHINE EM_PPC
@@ -8,7 +9,7 @@
#define LT_ELFCLASS2 ELFCLASS64
#define LT_ELF_MACHINE2 EM_PPC64
-#define PLTs_INIT_BY_HERE "main"
+#define PLTs_INIT_BY_HERE E_ENTRY_NAME
#else
--- ltrace-0.3.36/sysdeps/linux-gnu/s390/arch.h 26 Jun 2005 18:15:26 -0000 1.2
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/arch.h 29 Dec 2005 22:45:14 -0000 1.3
@@ -12,3 +12,4 @@
#define PLTs_INIT_BY_HERE NULL
+#define E_ENTRY_NAME "_start"
--- ltrace-0.3.36/sysdeps/linux-gnu/sparc/arch.h 26 Jun 2005 18:15:26 -0000 1.3
+++ ltrace-0.3.36/sysdeps/linux-gnu/sparc/arch.h 22 Dec 2005 22:37:16 -0000 1.4
@@ -8,3 +8,4 @@
#define LT_ELF_MACHINE2 EM_SPARC32PLUS
#define PLTs_INIT_BY_HERE NULL
+#define E_ENTRY_NAME "_start"
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/arch.h 26 Jun 2005 18:15:26 -0000 1.3
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/arch.h 22 Dec 2005 22:37:16 -0000 1.4
@@ -8,6 +8,7 @@
#define LT_ELF_MACHINE2 EM_386
#define PLTs_INIT_BY_HERE NULL
+#define E_ENTRY_NAME "_start"
/* __NR_fork, __NR_clone, __NR_clone2, __NR_vfork and __NR_execve
from asm-i386/unistd.h. */
ltrace-ppc64.patch:
Makefile.in | 5 -
breakpoints.c | 43 ++++++++-
configure.ac | 25 ++---
debug.c | 137 +++++++++++++++++++++++++++++
debug.h | 12 ++
dict.c | 2
display_args.c | 22 +++-
elf.c | 152 +++++++++++++++++++++++++++++----
elf.h | 8 +
ltrace.c | 2
ltrace.h | 27 ++++-
options.c | 37 ++++++--
options.h | 2
proc.c | 15 +--
process_event.c | 147 ++++++++++++++++++++-----------
sysdeps/linux-gnu/Makefile | 20 +++-
sysdeps/linux-gnu/alpha/arch.h | 3
sysdeps/linux-gnu/alpha/plt.c | 5 +
sysdeps/linux-gnu/arm/arch.h | 2
sysdeps/linux-gnu/arm/plt.c | 5 +
sysdeps/linux-gnu/breakpoint.c | 5 -
sysdeps/linux-gnu/i386/arch.h | 2
sysdeps/linux-gnu/i386/plt.c | 5 +
sysdeps/linux-gnu/m68k/arch.h | 2
sysdeps/linux-gnu/m68k/plt.c | 5 +
sysdeps/linux-gnu/ppc/arch.h | 11 ++
sysdeps/linux-gnu/ppc/plt.c | 33 +++++++
sysdeps/linux-gnu/ppc/regs.c | 8 -
sysdeps/linux-gnu/ppc/trace.c | 24 +++--
sysdeps/linux-gnu/s390/arch.h | 3
sysdeps/linux-gnu/s390/plt.c | 6 +
sysdeps/linux-gnu/sparc/arch.h | 3
sysdeps/linux-gnu/sparc/plt.c | 5 +
sysdeps/linux-gnu/trace.c | 66 +++++++++++---
sysdeps/linux-gnu/x86_64/arch.h | 8 +
sysdeps/linux-gnu/x86_64/plt.c | 5 +
sysdeps/linux-gnu/x86_64/regs.c | 18 +++
sysdeps/linux-gnu/x86_64/signalent1.h | 1
sysdeps/linux-gnu/x86_64/syscallent1.h | 1
sysdeps/linux-gnu/x86_64/trace.c | 41 ++++++++
40 files changed, 761 insertions(+), 162 deletions(-)
--- NEW FILE ltrace-ppc64.patch ---
--- ltrace-0.3.36/Makefile.in 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/Makefile.in 25 Jun 2005 00:58:14 -0000 1.2
@@ -13,9 +13,12 @@
mandir = @mandir@
docdir = $(prefix)/doc/ltrace
+cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
+ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+
CC = @CC@
-CPPFLAGS = -I$(TOPDIR) -I$(TOPDIR)/sysdeps/$(OS) -I- @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\"
CFLAGS = -Wall @CFLAGS@
+CPPFLAGS = -I$(TOPDIR) -I$(TOPDIR)/sysdeps/$(OS) $(call cc-option,-I-,-iquote) @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\" @CPPFLAGS@
LDFLAGS =
LIBS = @LIBS@
--- ltrace-0.3.36/breakpoints.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/breakpoints.c 26 Jun 2005 18:18:52 -0000 1.5
@@ -24,22 +24,31 @@
}
void
-insert_breakpoint(struct process * proc, void * addr) {
+insert_breakpoint(struct process * proc, void * addr, struct library_symbol * libsym) {
struct breakpoint * sbp;
if (!proc->breakpoints) {
proc->breakpoints = dict_init(dict_key2hash_int, dict_key_cmp_int);
/* atexit(brk_dict_clear); */ /* why bother to do this on exit? */
}
+
+ if (!addr)
+ return;
+
+ if (libsym)
+ libsym->needs_init = 0;
+
sbp = dict_find_entry(proc->breakpoints, addr);
if (!sbp) {
- sbp = malloc(sizeof(struct breakpoint));
+ sbp = calloc(1, sizeof(struct breakpoint));
if (!sbp) {
return; /* TODO FIXME XXX: error_mem */
}
dict_enter(proc->breakpoints, addr, sbp);
sbp->addr = addr;
- sbp->enabled = 0;
+ sbp->libsym = libsym;
+ if (libsym)
+ libsym->brkpnt = addr;
}
sbp->enabled++;
if (sbp->enabled==1 && proc->pid) enable_breakpoint(proc->pid, sbp);
@@ -76,7 +85,7 @@
* dont enable the breakpoints
*/
if (opt_L) {
- a = ptrace(PTRACE_PEEKTEXT, proc->pid, proc->list_of_symbols->enter_addr, 0);
+ a = ptrace(PTRACE_PEEKTEXT, proc->pid, plt2addr(proc, proc->list_of_symbols->enter_addr), 0);
if (a == 0x0)
return;
}
@@ -124,7 +133,7 @@
}
if (opt_L && proc->filename) {
- proc->list_of_symbols = read_elf(proc->filename);
+ proc->list_of_symbols = read_elf(proc);
if (opt_e) {
struct library_symbol ** tmp1 = &(proc->list_of_symbols);
while(*tmp1) {
@@ -149,9 +158,31 @@
}
sym = proc->list_of_symbols;
while (sym) {
- insert_breakpoint(proc, sym->enter_addr); /* proc->pid==0 delays enabling. */
+ /* proc->pid==0 delays enabling. */
+ if (sym->static_plt2addr) {
+ insert_breakpoint(proc, sym->enter_addr, sym);
+ } else {
+ insert_breakpoint(proc, plt2addr(proc, sym->enter_addr), sym); /* proc->pid==0 delays enabling. */
+ }
sym = sym->next;
}
proc->callstack_depth = 0;
proc->breakpoints_enabled = -1;
}
+
+void
+reinitialize_breakpoints (struct process * proc) {
+ struct library_symbol * sym = proc->list_of_symbols;
+
+ while (sym) {
+ if (sym->needs_init) {
+ insert_breakpoint(proc, plt2addr(proc, sym->enter_addr), sym);
+ if (sym->needs_init) {
+ fprintf(stderr, "could not re-initialize breakpoint for \"%s\" in file \"%s\"\n", sym->name, proc->filename);
+ exit(1);
+ }
+ }
+ sym = sym->next;
+ }
+}
+
--- ltrace-0.3.36/configure.ac 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/configure.ac 25 Jun 2005 01:06:54 -0000 1.3
@@ -1,7 +1,8 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(ltrace.c)
+AC_PREREQ(2.57)
+AC_INIT(ltrace,0.3.36,[Juan Cespedes <cespedes at debian.org>])
+AC_CONFIG_SRCDIR(ltrace.c)
AC_CONFIG_HEADER(config.h)
-AC_PREREQ(2.50)
dnl Check host system type
AC_CANONICAL_HOST
@@ -40,18 +41,14 @@
dnl AC_CHECK_FUNCS(gettimeofday strdup strerror strspn)
AC_CHECK_FUNCS(getopt getopt_long)
-AC_CHECK_HEADER(gelf.h,,[
- if test -f /usr/include/elfutils/gelf.h; then
- CPPFLAGS="$CPPFLAGS -I /usr/include/elfutils"
- elif test -f /usr/local/include/elfutils/gelf.h; then
- CPPFLAGS="$CPPFLAGS -I /usr/local/include/elfutils"
- elif test -f /usr/include/libelf/gelf.h; then
- CPPFLAGS="$CPPFLAGS -I /usr/include/libelf"
- elif test -f /usr/local/include/libelf/gelf.h; then
- CPPFLAGS="$CPPFLAGS -I /usr/local/include/libelf"
- else
- AC_MSG_ERROR(gelf.h not found)
- fi])
+for path in /usr/include/elfutils /usr/local/include/elfutils /usr/include/libelf /usr/local/include/libelf; do
+ if test -f ${path}/gelf.h; then
+ CPPFLAGS="$CPPFLAGS -I ${path}"
+ fi
+done
+
+AC_CHECK_HEADER(gelf.h,,AC_MSG_ERROR([***** gelf.h not found *****]))
+
AC_CHECK_LIB(elf,gelf_getdyn)
ac_cv_have_elf_c_read_mmap=no
--- ltrace-0.3.36/debug.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/debug.c 26 Jun 2005 19:01:57 -0000 1.3
@@ -6,7 +6,7 @@
#include "output.h"
void
-debug_(int level, char *file, int line, char *func, char *fmt, ...) {
+debug_(int level, const char *file, int line, const char *func, const char *fmt, ...) {
char buf[1024];
va_list args;
@@ -19,3 +19,138 @@
output_line(NULL, "DEBUG: %s:%d: %s(): %s", file, line, func, buf);
}
+
+// The following section provides a way to print things, like hex dumps,
+// with out using buffered output. This was written by Steve Munroe of IBM.
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/ptrace.h>
+
+int xwrite(const char *string, size_t len)
+{
+ int rc = 0;
+ rc = write (1, string, len);
+ return rc;
+}
+
+int xwrites(const char *string)
+{
+ size_t len = 0;
+ int rc = 0;
+ const char *tstring = string;
+
+ while (*tstring++ != '\0')
+ {
+ len++;
+ }
+
+ if (len >0)
+ {
+ rc = xwrite( string, len );
+ }
+
+ return rc;
+}
+
+int xwritehexi(int i)
+{
+ int rc = 0;
+ char text[9];
+ int j;
+ unsigned int temp = (unsigned int)i;
+
+ for ( j = 7; j >= 0; j--)
+ {
+ char c;
+ c = (char)((temp & 0x0f ) + '0');
+ if ( c > '9' )
+ {
+ c = (char)(c + ('a' - '9' - 1));
+ }
+ text[j] = c;
+ temp = temp>>4;
+ }
+
+ rc = write (1, text, 8);
+ return rc;
+}
+
+int xwritehexl(long i)
+{
+ int rc = 0;
+ char text[17];
+ int j;
+ unsigned long temp = (unsigned long)i;
+
+ for ( j = 15; j >= 0; j--)
+ {
+ char c;
+ c = (char)((temp & 0x0f ) + '0');
+ if ( c > '9' )
+ {
+ c = (char)(c + ('a' - '9' - 1));
+ }
+ text[j] = c;
+ temp = temp>>4;
+ }
+
+ rc = write (1, text, 16);
+ return rc;
+}
+
+int xwritec(char c)
+{
+ char temp = c;
+ char *text = &temp;
+ int rc = 0;
+ rc = write (1, text, 1);
+ return rc;
+}
+
+int xwritecr(void)
+{
+ return xwritec('\n');
+}
+
+int xwritedump(void *ptr, long addr, int len)
+{
+ int rc = 0;
+ long *tprt = (long*)ptr;
+ int i;
+
+ for ( i = 0; i < len ; i+=8 )
+ {
+ xwritehexl( addr);
+ xwritec('-');
+ xwritec('>');
+ xwritehexl( *tprt++);
+ xwritecr();
+ addr += sizeof(long);
+ }
+
+ return rc;
+}
+
+int xinfdump(long pid, void *ptr, int len)
+{
+ int rc;
+ int i;
+ long wrdcnt = len / sizeof(long) + 1;
+ long *infwords = malloc(wrdcnt*sizeof(long));
+ long addr = (long)ptr;
+
+ addr = ((addr + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
+
+ for (i=0; i<wrdcnt; ++i) {
+ infwords[i] = ptrace(PTRACE_PEEKTEXT, pid, addr);
+ addr += sizeof(long);
+ }
+
+ rc = xwritedump(infwords, (long)ptr, len);
+
+ free(infwords);
+ return rc;
+}
--- ltrace-0.3.36/debug.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/debug.h 26 Jun 2005 19:01:57 -0000 1.3
@@ -1,6 +1,16 @@
#include <features.h>
-void debug_(int level, char *file, int line, char *func, char *fmt, ...);
+void debug_(int level, const char *file, int line, const char *func, const char *fmt, ...);
+
+int xwrite(const char *, size_t);
+int xwrites(const char *);
+int xwritehexi(int);
+int xwritehexl(long);
+int xwritec(char);
+int xwritecr(void);
+int xwritedump(void *, long, int);
+int xinfdump(long, void *, int);
+
# define debug(level, expr...) debug_(level, __FILE__, __LINE__, DEBUG_FUNCTION, expr)
--- ltrace-0.3.36/dict.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/dict.c 26 Jun 2005 18:20:47 -0000 1.2
@@ -88,7 +88,7 @@
if (entry) entry->next = newentry;
else d->buckets[bucketpos] = newentry;
- debug(3, "new dict entry at %p[%d]: (%p,%p)\n", d, bucketpos, key, value);
+ debug(3, "new dict entry at %p[%d]: (%p,%p)", d, bucketpos, key, value);
return 0;
}
--- ltrace-0.3.36/display_args.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/display_args.c 25 Jun 2005 00:49:40 -0000 1.2
@@ -29,8 +29,12 @@
case ARGTYPE_UINT:
return fprintf(output, "%u", (unsigned)gimme_arg(type, proc, arg_num));
case ARGTYPE_LONG:
+ if (proc->mask_32bit)
+ return fprintf(output, "%d", (int)gimme_arg(type, proc, arg_num));
return fprintf(output, "%ld", gimme_arg(type, proc, arg_num));
case ARGTYPE_ULONG:
+ if (proc->mask_32bit)
+ return fprintf(output, "%u", (unsigned)gimme_arg(type, proc, arg_num));
return fprintf(output, "%lu", (unsigned long)gimme_arg(type, proc, arg_num));
case ARGTYPE_OCTAL:
return fprintf(output, "0%o", (unsigned)gimme_arg(type, proc, arg_num));
@@ -140,7 +144,12 @@
tmp = gimme_arg(type, proc, arg_num);
- if (tmp<1000000 && tmp>-1000000) {
+ if (proc->mask_32bit) {
+ if ((int)tmp<1000000 && (int)tmp>-1000000)
+ return fprintf(output, "%d", (int)tmp);
+ else
+ return fprintf(output, "%p", (void *)tmp);
+ } else if (tmp<1000000 && tmp>-1000000) {
return fprintf(output, "%ld", tmp);
} else {
return fprintf(output, "%p", (void *)tmp);
@@ -189,31 +198,32 @@
is_long++;
if (c == 'j')
is_long++;
- if (is_long > 1 && sizeof (long) < sizeof (long long)) {
+ if (is_long > 1
+ && (sizeof (long) < sizeof (long long) || proc->mask_32bit)) {
len += fprintf(output, ", ...");
str1[i+1]='\0';
break;
}
} else if (c=='d' || c=='i') {
- if (is_long)
+ if (!is_long || proc->mask_32bit)
len += fprintf(output, ", %d", (int)gimme_arg(type, proc, ++arg_num));
else
len += fprintf(output, ", %ld", gimme_arg(type, proc, ++arg_num));
break;
} else if (c=='u') {
- if (is_long)
+ if (!is_long || proc->mask_32bit)
len += fprintf(output, ", %u", (int)gimme_arg(type, proc, ++arg_num));
else
len += fprintf(output, ", %lu", gimme_arg(type, proc, ++arg_num));
break;
} else if (c=='o') {
- if (is_long)
+ if (!is_long || proc->mask_32bit)
len += fprintf(output, ", 0%o", (int)gimme_arg(type, proc, ++arg_num));
else
len += fprintf(output, ", 0%lo", gimme_arg(type, proc, ++arg_num));
break;
} else if (c=='x' || c=='X') {
- if (is_long)
+ if (!is_long || proc->mask_32bit)
len += fprintf(output, ", %#x", (int)gimme_arg(type, proc, ++arg_num));
else
len += fprintf(output, ", %#lx", gimme_arg(type, proc, ++arg_num));
--- ltrace-0.3.36/elf.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/elf.c 26 Jun 2005 18:18:52 -0000 1.6
@@ -15,12 +15,18 @@
#include "ltrace.h"
#include "elf.h"
#include "debug.h"
+#include "options.h"
static void do_init_elf (struct ltelf *lte, const char *filename);
static void do_close_elf (struct ltelf *lte);
static void add_library_symbol (GElf_Addr addr, const char *name,
- struct library_symbol **library_symbolspp);
+ struct library_symbol **library_symbolspp,
+ int use_elf_plt2addr);
static int in_load_libraries (const char *name, struct ltelf *lte);
+static GElf_Addr elf_plt2addr (struct ltelf *ltc, void *addr);
+
+
+extern char * PLTs_initialized_by_here;
static void
do_init_elf (struct ltelf *lte, const char *filename)
@@ -52,15 +58,17 @@
error (EXIT_FAILURE, 0, "\"%s\" is not an ELF executable nor shared library",
filename);
- if (lte->ehdr.e_ident[EI_CLASS] != LT_ELFCLASS
- || (lte->ehdr.e_machine != LT_ELF_MACHINE
+ if ((lte->ehdr.e_ident[EI_CLASS] != LT_ELFCLASS
+ || lte->ehdr.e_machine != LT_ELF_MACHINE)
#ifdef LT_ELF_MACHINE2
- && lte->ehdr.e_machine != LT_ELF_MACHINE2
+ && (lte->ehdr.e_ident[EI_CLASS] != LT_ELFCLASS2
+ || lte->ehdr.e_machine != LT_ELF_MACHINE2)
#endif
#ifdef LT_ELF_MACHINE3
- && lte->ehdr.e_machine != LT_ELF_MACHINE3
+ && (lte->ehdr.e_ident[EI_CLASS] != LT_ELFCLASS3
+ || lte->ehdr.e_machine != LT_ELF_MACHINE3)
#endif
- ))
+ )
error (EXIT_FAILURE, 0, "\"%s\" is ELF from incompatible architecture",
filename);
@@ -80,7 +88,31 @@
error (EXIT_FAILURE, 0, "Couldn't get section header from \"%s\"",
filename);
- if (shdr.sh_type == SHT_DYNSYM)
+ if (shdr.sh_type == SHT_SYMTAB)
+ {
+ Elf_Data *data;
+
+ lte->symtab = elf_getdata (scn,NULL);
+ lte->symtab_count = shdr.sh_size / shdr.sh_entsize;
+ if ((lte->symtab == NULL || elf_getdata(scn, lte->symtab) != NULL)
+ && opt_x != NULL)
+ error (EXIT_FAILURE, 0, "Couldn't get .symtab data from \"%s\"",
+ filename);
+
+ scn = elf_getscn (lte->elf, shdr.sh_link);
+ if (scn == NULL || gelf_getshdr (scn, &shdr) == NULL)
+ error (EXIT_FAILURE, 0, "Couldn't get section header from \"%s\"",
+ filename);
+
+ data = elf_getdata (scn, NULL);
+ if (data == NULL || elf_getdata (scn, data) != NULL
+ || shdr.sh_size != data->d_size || data->d_off)
+ error (EXIT_FAILURE, 0, "Couldn't get .strtab data from \"%s\"",
+ filename);
+
+ lte->strtab = data->d_buf;
+ }
+ else if (shdr.sh_type == SHT_DYNSYM)
{
Elf_Data *data;
@@ -171,9 +203,17 @@
error (EXIT_FAILURE, 0, "Unknown .hash sh_entsize in \"%s\"",
filename);
}
- else if ((shdr.sh_type == SHT_PROGBITS || shdr.sh_type == SHT_NOBITS)
- && strcmp (name, ".plt") == 0)
- lte->plt_addr = shdr.sh_addr;
+ else if (shdr.sh_type == SHT_PROGBITS || shdr.sh_type == SHT_NOBITS)
+ {
+ if (strcmp (name, ".plt") == 0)
+ lte->plt_addr = shdr.sh_addr;
+ else if (strcmp (name, ".opd") == 0)
+ {
+ lte->opd_addr = (GElf_Addr *)shdr.sh_addr;
+ lte->opd_size = shdr.sh_size;
+ lte->opd = elf_rawdata (scn, NULL);
+ }
+ }
}
if (lte->dynsym == NULL || lte->dynstr == NULL)
@@ -228,15 +268,19 @@
static void
add_library_symbol (GElf_Addr addr, const char *name,
- struct library_symbol **library_symbolspp)
+ struct library_symbol **library_symbolspp,
+ int use_elf_plt2addr)
{
struct library_symbol *s;
s = malloc (sizeof (struct library_symbol) + strlen (name) + 1);
if (s == NULL)
error (EXIT_FAILURE, errno, "add_library_symbol failed");
+ s->needs_init = 1;
+ s->static_plt2addr = use_elf_plt2addr;
s->next = *library_symbolspp;
s->enter_addr = (void *) (uintptr_t) addr;
+ s->brkpnt = NULL;
s->name = (char *) (s + 1);
strcpy (s->name, name);
*library_symbolspp = s;
@@ -283,16 +327,39 @@
return 0;
}
+static GElf_Addr
+elf_plt2addr (struct ltelf *lte, void *addr)
+{
+ long base;
+ long offset;
+ GElf_Addr ret_val;
+
+ if (!lte->opd)
+ error (EXIT_FAILURE, 0, "Couldn't do static plt2addr");
+
+ base = (long)lte->opd->d_buf;
+ offset = (long)addr - (long)lte->opd_addr;
+ if (offset > lte->opd_size)
+ error (EXIT_FAILURE, 0, "static plt not in .opd");
+
+ ret_val = (void *) *(long*)(base + offset);
+ return ret_val;
+}
+
struct library_symbol *
-read_elf (const char *filename)
+read_elf (struct process * proc)
{
struct library_symbol *library_symbols = NULL;
struct ltelf lte[MAX_LIBRARY + 1];
size_t i;
+ struct opt_e_t * xptr;
+ struct library_symbol **lib_tail = NULL;
+ struct opt_e_t *main_cheat;
elf_version (EV_CURRENT);
- do_init_elf (lte, filename);
+ do_init_elf (lte, proc->filename);
+ proc->e_machine = lte->ehdr.e_machine;
for (i = 0; i < library_num; ++i)
do_init_elf (<e[i + 1], library[i]);
@@ -319,17 +386,70 @@
|| ELF64_R_SYM (rela.r_info) >= lte->dynsym_count
|| gelf_getsym (lte->dynsym, ELF64_R_SYM (rela.r_info), &sym) == NULL)
error (EXIT_FAILURE, 0, "Couldn't get relocation from \"%s\"",
- filename);
+ proc->filename);
+
+ if ( ! sym.st_value)
+ proc->need_to_reinitialize_breakpoints = 1;
name = lte->dynstr + sym.st_name;
if (in_load_libraries (name, lte))
{
addr = arch_plt_sym_val (lte, i, &rela);
- if (addr != 0)
- add_library_symbol (addr, name, &library_symbols);
+ add_library_symbol (addr, name, &library_symbols, 0);
+ if (!lib_tail)
+ lib_tail = &(library_symbols->next);
}
}
+ if (proc->need_to_reinitialize_breakpoints)
+ {
+ /* Add "PLTs_initialized_by_here" to opt_x list, if not already there. */
+ main_cheat = (struct opt_e_t *)malloc(sizeof(struct opt_e_t));
+ if (main_cheat == NULL)
+ error (EXIT_FAILURE, 0, "Couldn allocate memory");
+ main_cheat->next = opt_x;
+ main_cheat->name = PLTs_initialized_by_here;
+
+ for (xptr=opt_x; xptr; xptr=xptr->next)
+ if (strcmp(xptr->name, PLTs_initialized_by_here) == 0 && main_cheat)
+ {
+ free(main_cheat);
+ main_cheat = NULL;
+ break;
+ }
+ if (main_cheat)
+ opt_x = main_cheat;
+ }
+
+ for (i = 0; i < lte->symtab_count; ++i)
+ {
+ GElf_Sym sym;
+ GElf_Addr addr;
+ const char *name;
+
+ if (gelf_getsym (lte->symtab, i, &sym) == NULL)
+ error (EXIT_FAILURE, 0, "Couldn't get symbol from \"%s\"", proc->filename);
+
+ name = lte->strtab + sym.st_name;
+ addr = sym.st_value;
+ if ( ! addr)
+ continue;
+
+ for (xptr=opt_x; xptr; xptr=xptr->next)
+ if (xptr->name && strcmp (xptr->name, name) == 0)
+ {
+ /* FIXME: Should be able to use &library_symbols as above. But
+ when you do, none of the real library symbols cause breaks. */
+ add_library_symbol (elf_plt2addr(lte, (void *)addr), name, lib_tail, 1);
+ xptr->name = NULL;
+ break;
+ }
+ }
+ for (xptr=opt_x; xptr; xptr=xptr->next)
+ if (xptr->name)
+ fprintf (stderr, "Warning: Couldn't get symbol \"%s\" from \"%s\" or it's a duplicate",
+ xptr->name, proc->filename);
+
for (i = 0; i < library_num + 1; ++i)
do_close_elf (<e[i]);
--- ltrace-0.3.36/elf.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/elf.h 26 Jun 2005 18:18:52 -0000 1.4
@@ -17,6 +17,12 @@
GElf_Addr plt_addr;
Elf_Data *relplt;
size_t relplt_count;
+ Elf_Data *symtab;
+ const char *strtab;
+ size_t symtab_count;
+ Elf_Data *opd;
+ GElf_Addr *opd_addr;
+ size_t opd_size;
Elf32_Word *hash;
int hash_malloced;
};
@@ -24,7 +30,7 @@
extern int library_num;
extern char *library[MAX_LIBRARY];
-extern struct library_symbol *read_elf (const char *);
+extern struct library_symbol *read_elf (struct process *);
extern GElf_Addr arch_plt_sym_val (struct ltelf *, size_t, GElf_Rela *);
--- ltrace-0.3.36/ltrace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/ltrace.c 26 Jun 2005 18:20:47 -0000 1.2
@@ -126,7 +126,7 @@
}
}
if (command) {
- execute_program(open_program(command), argv);
+ execute_program(open_program(command,0), argv);
}
opt_p_tmp = opt_p;
while (opt_p_tmp) {
--- ltrace-0.3.36/ltrace.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/ltrace.h 26 Jun 2005 18:20:47 -0000 1.7
@@ -25,6 +25,7 @@
void * addr;
unsigned char orig_value[BREAKPOINT_LENGTH];
int enabled;
+ struct library_symbol * libsym;
};
enum arg_type {
@@ -66,12 +67,16 @@
};
extern struct function * list_of_functions;
+extern char * PLTs_initialized_by_here;
struct library_symbol {
- char * name;
- void * enter_addr;
+ char * name;
+ void * enter_addr;
+ struct breakpoint *brkpnt;
+ char needs_init;
+ char static_plt2addr;
- struct library_symbol * next;
+ struct library_symbol * next;
};
struct callstack_element {
@@ -91,6 +96,8 @@
pid_t pid;
struct dict * breakpoints;
int breakpoints_enabled; /* -1:not enabled yet, 0:disabled, 1:enabled */
+ int mask_32bit; /* 1 if 64-bit ltrace is tracing 32-bit process. */
+ int personality;
int callstack_depth;
struct callstack_element callstack[MAX_CALLDEPTH];
@@ -102,6 +109,8 @@
void * return_addr;
struct breakpoint * breakpoint_being_enabled;
void * arch_ptr;
+ short e_machine;
+ short need_to_reinitialize_breakpoints;
/* output: */
enum tof type_being_displayed;
@@ -145,11 +154,13 @@
extern int display_arg(enum tof type, struct process * proc, int arg_num, enum arg_type at);
extern struct breakpoint * address2bpstruct(struct process * proc, void * addr);
extern void breakpoints_init(struct process * proc);
-extern void insert_breakpoint(struct process * proc, void * addr);
+extern void insert_breakpoint(struct process * proc, void * addr, struct library_symbol * libsym);
extern void delete_breakpoint(struct process * proc, void * addr);
extern void enable_all_breakpoints(struct process * proc);
extern void disable_all_breakpoints(struct process * proc);
-extern struct process * open_program(char * filename);
+extern void reinitialize_breakpoints (struct process *);
+
+extern struct process * open_program(char * filename, pid_t pid);
extern void open_pid(pid_t pid, int verbose);
extern void show_summary(void);
@@ -166,8 +177,8 @@
extern void * get_return_addr(struct process * proc, void * stack_pointer);
extern void enable_breakpoint(pid_t pid, struct breakpoint * sbp);
extern void disable_breakpoint(pid_t pid, const struct breakpoint * sbp);
-extern int fork_p(int sysnum);
-extern int exec_p(int sysnum);
+extern int fork_p(struct process * proc, int sysnum);
+extern int exec_p(struct process * proc, int sysnum);
extern int syscall_p(struct process * proc, int status, int * sysnum);
extern void continue_process(pid_t pid);
extern void continue_after_signal(pid_t pid, int signum);
@@ -177,6 +188,8 @@
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 ffcheck(void *maddr);
+extern void * plt2addr(struct process *, void **);
+
#if 0 /* not yet */
extern int umoven(struct process * proc, void * addr, int len, void * laddr);
#endif
--- ltrace-0.3.36/options.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/options.c 26 Jun 2005 18:15:15 -0000 1.4
@@ -2,8 +2,8 @@
#include "config.h"
#endif
-#ifndef VERSION
-# define VERSION "0.3.32"
+#ifndef PACKAGE_VERSION
+# define PACKAGE_VERSION "0.3.32"
#endif
#include <string.h>
@@ -50,6 +50,13 @@
struct opt_e_t * opt_e = NULL;
int opt_e_enable=1;
+/* List of global function names given to -x: */
+struct opt_e_t * opt_x = NULL;
+
+/* Set a break on the routine named here in order to re-initialize breakpoints
+ after all the PLTs have been initialzed */
+char * PLTs_initialized_by_here = PLTs_INIT_BY_HERE;
+
static void
usage(void) {
#if !(HAVE_GETOPT || HAVE_GETOPT_LONG)
@@ -113,6 +120,8 @@
# else
" -V output version information and exit.\n"
# endif
+" -x NAME treat the global NAME like a library subroutine.\n"
+" -X NAME same as -x; and PLT's will be initialized by here.\n"
"\nReport bugs to Juan Cespedes <cespedes at debian.org>\n"
, progname);
#endif
@@ -177,13 +186,13 @@
# ifdef USE_DEMANGLE
"C"
# endif
- "a:e:l:n:o:p:s:u:", long_options, &option_index);
+ "a:e:l:n:o:p:s:u:x:X:", long_options, &option_index);
#else
c = getopt(argc, argv, "+cdfhiLrStTV"
# ifdef USE_DEMANGLE
"C"
# endif
- "a:e:l:n:o:p:s:u:");
+ "a:e:l:n:o:p:s:u:x:X:");
#endif
if (c==-1) {
break;
@@ -280,11 +289,27 @@
break;
case 'u': opt_u = optarg;
break;
- case 'V': printf("ltrace version " VERSION ".\n"
-"Copyright (C) 1997-2004 Juan Cespedes <cespedes at debian.org>.\n"
+ case 'V': printf("ltrace version " PACKAGE_VERSION ".\n"
+"Copyright (C) 1997-2005 Juan Cespedes <cespedes at debian.org>.\n"
"This is free software; see the GNU General Public Licence\n"
"version 2 or later for copying conditions. There is NO warranty.\n");
exit(0);
+ case 'X': PLTs_initialized_by_here = optarg;
+ /* Fall Thru */
+
+ case 'x':
+ {
+ struct opt_e_t * tmp = malloc(sizeof(struct opt_e_t));
+ if (!tmp) {
+ perror("ltrace: malloc");
+ exit(1);
+ }
+ tmp->name = optarg;
+ tmp->next = opt_x;
+ opt_x = tmp;
+ break;
+ }
+
default:
#if HAVE_GETOPT_LONG
--- ltrace-0.3.36/options.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/options.h 26 Jun 2005 18:06:09 -0000 1.2
@@ -36,4 +36,6 @@
extern struct opt_e_t * opt_e; /* list of function names to display */
extern int opt_e_enable; /* 0 if '!' is used, 1 otherwise */
+extern struct opt_e_t * opt_x; /* list of functions to break at */
+
extern char ** process_options(int argc, char **argv);
--- ltrace-0.3.36/proc.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/proc.c 26 Jun 2005 18:20:47 -0000 1.3
@@ -13,22 +13,17 @@
#include "elf.h"
struct process *
-open_program(char * filename) {
+open_program(char * filename, pid_t pid) {
struct process * proc;
- proc = malloc(sizeof(struct process));
+ proc = calloc(sizeof(struct process), 1);
if (!proc) {
perror("malloc");
exit(1);
}
- memset(proc, 0, sizeof(struct process));
proc->filename = filename;
- proc->pid = 0;
- proc->breakpoints = NULL;
proc->breakpoints_enabled = -1;
- proc->callstack_depth = 0;
- proc->breakpoint_being_enabled = NULL;
+ if (pid) { proc->pid = pid; }
breakpoints_init(proc);
- proc->next = NULL;
proc->next = list_of_processes;
list_of_processes = proc;
@@ -56,6 +51,6 @@
}
#endif
- proc = open_program(filename);
- proc->pid = pid;
+ proc = open_program(filename, pid);
+ proc->breakpoints_enabled = 1;
}
--- ltrace-0.3.36/process_event.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/process_event.c 26 Jun 2005 18:20:47 -0000 1.6
@@ -33,32 +33,46 @@
static void callstack_pop(struct process * proc);
static char *
-shortsignal(int signum) {
+shortsignal(struct process *proc, int signum) {
static char * signalent0[] = {
#include "signalent.h"
};
- int nsignals0 = sizeof signalent0 / sizeof signalent0[0];
-
- if (signum < 0 || signum >= nsignals0) {
+ static char * signalent1[] = {
+ #include "signalent1.h"
+ };
+ static char **signalents[] = { signalent0, signalent1 };
+ int nsignals[] = { sizeof signalent0 / sizeof signalent0[0],
+ sizeof signalent1 / sizeof signalent1[0] };
+
+ if (proc->personality > sizeof signalents / sizeof signalents[0])
+ abort ();
+ if (signum < 0 || signum >= nsignals[proc->personality]) {
return "UNKNOWN_SIGNAL";
} else {
- return signalent0[signum];
+ return signalents[proc->personality][signum];
}
}
static char *
-sysname(int sysnum) {
+sysname(struct process *proc, int sysnum) {
static char result[128];
static char * syscalent0[] = {
#include "syscallent.h"
};
- int nsyscals0 = sizeof syscalent0 / sizeof syscalent0[0];
-
- if (sysnum < 0 || sysnum >= nsyscals0) {
+ static char * syscalent1[] = {
+ #include "syscallent1.h"
+ };
+ static char **syscalents[] = { syscalent0, syscalent1 };
+ int nsyscals[] = { sizeof syscalent0 / sizeof syscalent0[0],
+ sizeof syscalent1 / sizeof syscalent1[0] };
+
+ if (proc->personality > sizeof syscalents / sizeof syscalents[0])
+ abort ();
+ if (sysnum < 0 || sysnum >= nsyscals[proc->personality]) {
sprintf(result, "SYS_%d", sysnum);
return result;
} else {
- sprintf(result, "SYS_%s", syscalent0[sysnum]);
+ sprintf(result, "SYS_%s", syscalents[proc->personality][sysnum]);
return result;
}
}
@@ -70,7 +84,7 @@
debug(1, "event: none");
return;
case LT_EV_SIGNAL:
- debug(1, "event: signal (%s [%d])", shortsignal(event->e_un.signum), event->e_un.signum);
+ debug(1, "event: signal (%s [%d])", shortsignal(event->proc, event->e_un.signum), event->e_un.signum);
process_signal(event);
return;
case LT_EV_EXIT:
@@ -78,15 +92,15 @@
process_exit(event);
return;
case LT_EV_EXIT_SIGNAL:
- debug(1, "event: exit signal (%s [%d])", shortsignal(event->e_un.signum), event->e_un.signum);
+ debug(1, "event: exit signal (%s [%d])", shortsignal(event->proc, event->e_un.signum), event->e_un.signum);
process_exit_signal(event);
return;
case LT_EV_SYSCALL:
- debug(1, "event: syscall (%s [%d])", sysname (event->e_un.sysnum), event->e_un.sysnum);
+ debug(1, "event: syscall (%s [%d])", sysname (event->proc, event->e_un.sysnum), event->e_un.sysnum);
process_syscall(event);
return;
case LT_EV_SYSRET:
- debug(1, "event: sysret (%s [%d])", sysname (event->e_un.sysnum), event->e_un.sysnum);
+ debug(1, "event: sysret (%s [%d])", sysname (event->proc, event->e_un.sysnum), event->e_un.sysnum);
process_sysret(event);
return;
case LT_EV_BREAKPOINT:
@@ -110,7 +124,7 @@
return;
}
output_line(event->proc, "--- %s (%s) ---",
- shortsignal(event->e_un.signum), strsignal(event->e_un.signum));
+ shortsignal(event->proc, event->e_un.signum), strsignal(event->e_un.signum));
continue_after_signal(event->proc->pid, event->e_un.signum);
}
@@ -124,7 +138,7 @@
static void
process_exit_signal(struct event * event) {
output_line(event->proc, "+++ killed by %s +++",
- shortsignal(event->e_un.signum));
+ shortsignal(event->proc, event->e_un.signum));
remove_proc(event->proc);
}
@@ -155,11 +169,12 @@
static void
process_syscall(struct event * event) {
if (opt_S) {
- output_left(LT_TOF_SYSCALL, event->proc, sysname(event->e_un.sysnum));
+ output_left(LT_TOF_SYSCALL, event->proc, sysname(event->proc, event->e_un.sysnum));
}
- if (fork_p(event->e_un.sysnum)) {
+ if (fork_p(event->proc, event->e_un.sysnum)
+ || exec_p(event->proc, event->e_un.sysnum)) {
disable_all_breakpoints(event->proc);
- } else if (!event->proc->breakpoints_enabled) {
+ } else if (event->proc->breakpoints_enabled == 0) {
enable_all_breakpoints(event->proc);
}
callstack_push_syscall(event->proc, event->e_un.sysnum);
@@ -194,7 +209,7 @@
if (opt_T || opt_c) {
calc_time_spent(event->proc);
}
- if (fork_p(event->e_un.sysnum)) {
+ if (fork_p(event->proc, event->e_un.sysnum)) {
if (opt_f) {
pid_t child = gimme_arg(LT_TOF_SYSCALLR,event->proc,-1);
if (child>0) {
@@ -205,21 +220,31 @@
}
callstack_pop(event->proc);
if (opt_S) {
- output_right(LT_TOF_SYSCALLR, event->proc, sysname(event->e_un.sysnum));
+ output_right(LT_TOF_SYSCALLR, event->proc, sysname(event->proc, event->e_un.sysnum));
}
- if (exec_p(event->e_un.sysnum)) {
+ if (exec_p(event->proc, event->e_un.sysnum)) {
if (gimme_arg(LT_TOF_SYSCALLR,event->proc,-1)==0) {
+ pid_t saved_pid;
+ event->proc->mask_32bit = 0;
+ event->proc->personality = 0;
+ /* FIXME: Leak, should have arch_dep_free.
+ But we are leaking here much more than that. */
+ event->proc->arch_ptr = NULL;
event->proc->filename = pid2name(event->proc->pid);
+ saved_pid = event->proc->pid;
+ event->proc->pid = 0;
breakpoints_init(event->proc);
- }
+ event->proc->pid = saved_pid;
+ } else
+ enable_all_breakpoints(event->proc);
}
continue_process(event->proc->pid);
}
static void
process_breakpoint(struct event * event) {
- struct library_symbol * tmp;
int i,j;
+ struct breakpoint *sbp;
debug(2, "event: breakpoint (%p)", event->e_un.brk_addr);
if (event->proc->breakpoint_being_enabled) {
@@ -232,22 +257,33 @@
for(i=event->proc->callstack_depth-1; i>=0; i--) {
if (event->e_un.brk_addr == event->proc->callstack[i].return_addr) {
#ifdef __powerpc__
- unsigned long a;
- unsigned long addr = event->proc->callstack[i].c_un.libfunc->enter_addr;
- struct breakpoint *sbp = address2bpstruct(event->proc, addr);
- unsigned char break_insn[] = BREAKPOINT_VALUE;
-
- /*
- * PPC HACK! (XXX FIXME TODO)
- * The PLT gets modified during the first call,
- * so be sure to re-enable the breakpoint.
- */
- a = ptrace(PTRACE_PEEKTEXT, event->proc->pid, addr);
-
- if (memcmp(&a, break_insn, 4)) {
- sbp->enabled--;
- insert_breakpoint(event->proc, addr);
- }
+ /*
+ * PPC HACK! (XXX FIXME TODO)
+ * The PLT gets modified during the first call,
+ * so be sure to re-enable the breakpoint.
+ */
+ unsigned long a;
+ struct library_symbol *libsym =
+ event->proc->callstack[i].c_un.libfunc;
+ void *addr = plt2addr(event->proc, libsym->enter_addr);
+
+ if (event->proc->e_machine == EM_PPC) {
+ unsigned char break_insn[] = BREAKPOINT_VALUE;
+
+ sbp = address2bpstruct(event->proc, addr);
+ assert(sbp);
+ a = ptrace(PTRACE_PEEKTEXT, event->proc->pid, addr);
+
+ if (memcmp(&a, break_insn, 4)) {
+ sbp->enabled--;
+ insert_breakpoint(event->proc, addr, libsym);
+ }
+ } else {
+ sbp = libsym->brkpnt;
+ assert(sbp);
+ if (addr != sbp->addr)
+ insert_breakpoint(event->proc, addr, libsym);
+ }
#endif
for(j=event->proc->callstack_depth-1; j>i; j--) {
callstack_pop(event->proc);
@@ -265,19 +301,22 @@
}
}
- tmp = event->proc->list_of_symbols;
- while(tmp) {
- if (event->e_un.brk_addr == tmp->enter_addr) {
- event->proc->stack_pointer = get_stack_pointer(event->proc);
- event->proc->return_addr = get_return_addr(event->proc, event->proc->stack_pointer);
- output_left(LT_TOF_FUNCTION, event->proc, tmp->name);
- callstack_push_symfunc(event->proc, tmp);
- continue_after_breakpoint(event->proc, address2bpstruct(event->proc, tmp->enter_addr));
- return;
- }
- tmp = tmp->next;
- }
- output_line(event->proc, "breakpointed at %p (?)",
+ if ((sbp = address2bpstruct(event->proc, event->e_un.brk_addr)))
+ {
+ event->proc->stack_pointer = get_stack_pointer(event->proc);
+ event->proc->return_addr = get_return_addr(event->proc, event->proc->stack_pointer);
+ output_left(LT_TOF_FUNCTION, event->proc, sbp->libsym->name);
+ callstack_push_symfunc(event->proc, sbp->libsym);
+ if (PLTs_initialized_by_here
+ && event->proc->need_to_reinitialize_breakpoints
+ && (strcmp(sbp->libsym->name, PLTs_initialized_by_here) == 0))
+ reinitialize_breakpoints(event->proc);
+
+ continue_after_breakpoint(event->proc, sbp);
+ return;
+ }
+
+ output_line(event->proc, "unexpected breakpoint at %p",
(void *)event->e_un.brk_addr);
continue_process(event->proc->pid);
}
@@ -319,7 +358,7 @@
elem->c_un.libfunc = sym;
elem->return_addr = proc->return_addr;
- insert_breakpoint(proc, elem->return_addr);
+ insert_breakpoint(proc, elem->return_addr, 0);
proc->callstack_depth++;
if (opt_T || opt_c) {
--- ltrace-0.3.36/sysdeps/linux-gnu/Makefile 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/Makefile 25 Jun 2005 01:09:01 -0000 1.3
@@ -1,20 +1,33 @@
-ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
+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/)
CPPFLAGS += -I$(TOPDIR)/sysdeps/linux-gnu/$(ARCH)
OBJ = trace.o proc.o breakpoint.o
-all: sysdep.h signalent.h syscallent.h ../sysdep.o
+all: sysdep.h signalent.h syscallent.h signalent1.h syscallent1.h ../sysdep.o
sysdep.h: $(ARCH)/arch.h
cat $(ARCH)/arch.h > sysdep.h
signalent.h:
cp $(ARCH)/signalent.h signalent.h
+signalent1.h:
+ if [ -f $(ARCH)/signalent1.h ]; then \
+ cp $(ARCH)/signalent1.h signalent1.h; \
+ else \
+ > signalent1.h; \
+ fi
syscallent.h:
cp $(ARCH)/syscallent.h syscallent.h
+syscallent1.h:
+ if [ -f $(ARCH)/syscallent1.h ]; then \
+ cp $(ARCH)/syscallent1.h syscallent1.h; \
+ else \
+ > syscallent1.h; \
+ fi
+
../sysdep.o: os.o $(ARCH)/arch.o
$(CC) -nostdlib -r -o ../sysdep.o os.o $(ARCH)/arch.o
@@ -26,6 +39,7 @@
clean:
$(MAKE) -C $(ARCH) clean
- rm -f $(OBJ) sysdep.h signalent.h syscallent.h os.o sysdep.o ../sysdep.o
+ rm -f $(OBJ) sysdep.h signalent.h signalent1.h syscallent.h
+ rm -f syscallent1.h os.o sysdep.o ../sysdep.o
dummy:
--- ltrace-0.3.36/sysdeps/linux-gnu/breakpoint.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/breakpoint.c 26 Jun 2005 18:20:55 -0000 1.2
@@ -6,6 +6,7 @@
#include "arch.h"
#include "options.h"
#include "output.h"
+#include "debug.h"
static unsigned char break_insn[] = BREAKPOINT_VALUE;
@@ -13,9 +14,7 @@
enable_breakpoint(pid_t pid, struct breakpoint * sbp) {
int i,j;
- if (opt_d>1) {
- output_line(0, "enable_breakpoint(%d,%p)", pid, sbp->addr);
- }
+ debug(1, "enable_breakpoint(%d,%p)", pid, sbp->addr);
for(i=0; i < 1+((BREAKPOINT_LENGTH-1)/sizeof(long)); i++) {
long a = ptrace(PTRACE_PEEKTEXT, pid, sbp->addr + i*sizeof(long), 0);
--- ltrace-0.3.36/sysdeps/linux-gnu/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/trace.c 25 Jun 2005 00:49:56 -0000 1.2
@@ -9,31 +9,69 @@
#include "ltrace.h"
#include "options.h"
+#include "sysdep.h"
+
+static int fork_exec_syscalls[][5] = {
+{
+#ifdef __NR_fork
+ __NR_fork,
+#else
+ -1,
+#endif
+#ifdef __NR_clone
+ __NR_clone,
+#else
+ -1,
+#endif
+#ifdef __NR_clone2
+ __NR_clone2,
+#else
+ -1,
+#endif
+#ifdef __NR_vfork
+ __NR_vfork,
+#else
+ -1,
+#endif
+#ifdef __NR_execve
+ __NR_execve,
+#else
+ -1,
+#endif
+}
+#ifdef FORK_EXEC_SYSCALLS
+FORK_EXEC_SYSCALLS
+#endif
+};
/* Returns 1 if the sysnum may make a new child to be created
* (ie, with fork() or clone())
* Returns 0 otherwise.
*/
int
-fork_p(int sysnum) {
- return 0
-#if defined(__NR_fork)
- || (sysnum == __NR_fork)
-#endif
-#if defined(__NR_clone)
- || (sysnum == __NR_clone)
-#endif
-#if defined(__NR_vfork)
- || (sysnum == __NR_vfork)
-#endif
- ;
+fork_p(struct process * proc, int sysnum) {
+ int i;
+ if (proc->personality
+ >= sizeof fork_exec_syscalls / sizeof (fork_exec_syscalls [0]))
+ return 0;
+ for (i = 0; i < sizeof (fork_exec_syscalls[0]) / sizeof (int) - 1; ++i)
+ if (sysnum == fork_exec_syscalls[proc->personality][i])
+ return 1;
+ return 0;
}
/* Returns 1 if the sysnum may make the process exec other program
*/
int
-exec_p(int sysnum) {
- return (sysnum == __NR_execve);
+exec_p(struct process * proc, int sysnum) {
+ int i;
+ if (proc->personality
+ >= sizeof fork_exec_syscalls / sizeof (fork_exec_syscalls [0]))
+ return 0;
+ i = sizeof (fork_exec_syscalls[0]) / sizeof (int) - 1;
+ if (sysnum == fork_exec_syscalls[proc->personality][i])
+ return 1;
+ return 0;
}
void
--- ltrace-0.3.36/sysdeps/linux-gnu/alpha/arch.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/alpha/arch.h 26 Jun 2005 18:15:26 -0000 1.3
@@ -4,4 +4,7 @@
#define LT_ELFCLASS ELFCLASS64
#define LT_ELF_MACHINE EM_ALPHA
+#define LT_ELFCLASS2 ELFCLASS64
#define LT_ELF_MACHINE2 EM_FAKE_ALPHA
+
+#define PLTs_INIT_BY_HERE NULL
--- ltrace-0.3.36/sysdeps/linux-gnu/alpha/plt.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/alpha/plt.c 26 Jun 2005 18:18:59 -0000 1.2
@@ -7,3 +7,8 @@
{
return lte->plt_addr + ndx * 12 + 32;
}
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ return (void *) plt;
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/arm/arch.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/arm/arch.h 26 Jun 2005 18:15:26 -0000 1.2
@@ -4,3 +4,5 @@
#define LT_ELFCLASS ELFCLASS32
#define LT_ELF_MACHINE EM_ARM
+
+#define PLTs_INIT_BY_HERE NULL
--- ltrace-0.3.36/sysdeps/linux-gnu/arm/plt.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/arm/plt.c 26 Jun 2005 18:18:59 -0000 1.2
@@ -7,3 +7,8 @@
{
return lte->plt_addr + 20 + ndx * 12;
}
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ return (void *) plt;
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/i386/arch.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/i386/arch.h 26 Jun 2005 18:15:26 -0000 1.2
@@ -4,3 +4,5 @@
#define LT_ELFCLASS ELFCLASS32
#define LT_ELF_MACHINE EM_386
+
+#define PLTs_INIT_BY_HERE NULL
--- ltrace-0.3.36/sysdeps/linux-gnu/i386/plt.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/i386/plt.c 26 Jun 2005 18:18:59 -0000 1.2
@@ -7,3 +7,8 @@
{
return lte->plt_addr + (ndx + 1) * 16;
}
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ return (void *) plt;
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/m68k/arch.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/m68k/arch.h 26 Jun 2005 18:15:26 -0000 1.2
@@ -4,3 +4,5 @@
#define LT_ELFCLASS ELFCLASS32
#define LT_ELF_MACHINE EM_68K
+
+#define PLTs_INIT_BY_HERE NULL
--- ltrace-0.3.36/sysdeps/linux-gnu/m68k/plt.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/m68k/plt.c 26 Jun 2005 18:18:59 -0000 1.2
@@ -8,3 +8,8 @@
return lte->plt_addr + (ndx + 1)
* ((lte->ehdr.e_flags & EF_CPU32) ? 24 : 12);
}
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ return (void *) plt;
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/ppc/arch.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/ppc/arch.h 26 Jun 2005 18:15:26 -0000 1.3
@@ -4,3 +4,14 @@
#define LT_ELFCLASS ELFCLASS32
#define LT_ELF_MACHINE EM_PPC
+#ifdef __powerpc64__
+#define LT_ELFCLASS2 ELFCLASS64
+#define LT_ELF_MACHINE2 EM_PPC64
+
+#define PLTs_INIT_BY_HERE "main"
+
+#else
+
+#define PLTs_INIT_BY_HERE NULL
+
+#endif
--- ltrace-0.3.36/sysdeps/linux-gnu/ppc/plt.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/ppc/plt.c 26 Jun 2005 18:18:59 -0000 1.2
@@ -1,9 +1,42 @@
#include <gelf.h>
#include "ltrace.h"
#include "elf.h"
+#include "debug.h"
+#include "ptrace.h"
+#include "options.h"
GElf_Addr
arch_plt_sym_val (struct ltelf *lte, size_t ndx, GElf_Rela *rela)
{
return rela->r_offset;
}
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ long addr;
+
+ debug(3, 0);
+
+ if (proc->e_machine == EM_PPC || plt == 0)
+ return (void *)plt;
+
+ if (proc->pid == 0)
+ return (void *)0;
+
+ // On a PowerPC-64 system, a plt is three 64-bit words: the first is the
+ // 64-bit address of the routine. Before the PLT has been initialized, this
+ // will be 0x0. In fact, the symbol table won't have the plt's address even.
+ // Ater the PLT has been initialized, but before it has been resolved, the
+ // first word will be the address of the function in the dynamic linker that
+ // will reslove the PLT. After the PLT is resolved, this will will be the
+ // address of the routine whose symbol is in the symbol table.
+
+ addr = ptrace(PTRACE_PEEKTEXT, proc->pid, plt);
+
+ if (opt_d >= 3) {
+ xinfdump(proc->pid, plt, sizeof(void*)*3);
+ }
+
+ return (void *)addr;
+}
+
--- ltrace-0.3.36/sysdeps/linux-gnu/ppc/regs.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/ppc/regs.c 25 Jun 2005 01:33:12 -0000 1.2
@@ -18,20 +18,20 @@
void *
get_instruction_pointer(struct process * proc) {
- return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 4*PT_NIP, 0);
+ return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long)*PT_NIP, 0);
}
void
set_instruction_pointer(struct process * proc, void * addr) {
- ptrace(PTRACE_POKEUSER, proc->pid, 4*PT_NIP, addr);
+ ptrace(PTRACE_POKEUSER, proc->pid, sizeof(long)*PT_NIP, addr);
}
void *
get_stack_pointer(struct process * proc) {
- return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 4*PT_R1, 0);
+ return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long)*PT_R1, 0);
}
void *
get_return_addr(struct process * proc, void * stack_pointer) {
- return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 4*PT_LNK, 0);
+ return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long)*PT_LNK, 0);
}
--- ltrace-0.3.36/sysdeps/linux-gnu/ppc/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/ppc/trace.c 26 Jun 2005 18:18:59 -0000 1.3
@@ -7,6 +7,9 @@
#include <signal.h>
#include <sys/ptrace.h>
#include <asm/ptrace.h>
+#ifdef __powerpc64__
+#include <elf.h>
+#endif
#include "ltrace.h"
@@ -18,21 +21,28 @@
# define PTRACE_POKEUSER PTRACE_POKEUSR
#endif
-void
-get_arch_dep(struct process * proc) {
+void get_arch_dep(struct process *proc)
+{
+#ifdef __powerpc64__
+ if (proc->arch_ptr)
+ return;
+ proc->mask_32bit = (proc->e_machine == EM_PPC);
+ proc->arch_ptr = (void *) 1;
+#endif
}
+
/* Returns 1 if syscall, 2 if sysret, 0 otherwise.
*/
#define SYSCALL_INSN 0x44000002
int
syscall_p(struct process * proc, int status, int * sysnum) {
if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
- int pc = ptrace(PTRACE_PEEKUSER, proc->pid, 4*PT_NIP, 0);
- int insn = ptrace(PTRACE_PEEKTEXT, proc->pid, pc-4, 0);
+ long pc = (long)get_instruction_pointer(proc);
+ int insn = (int)ptrace(PTRACE_PEEKTEXT, proc->pid, pc-sizeof(long), 0);
if (insn == SYSCALL_INSN) {
- *sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4*PT_R0, 0);
+ *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) {
return 2;
@@ -46,9 +56,9 @@
long
gimme_arg(enum tof type, struct process * proc, int arg_num) {
if (arg_num==-1) { /* return value */
- return ptrace(PTRACE_PEEKUSER, proc->pid, 4*PT_R3, 0);
+ return ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long)*PT_R3, 0);
} else if (arg_num < 8) {
- return ptrace(PTRACE_PEEKUSER, proc->pid, 4*(arg_num+PT_R3), 0);
+ 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);
}
--- ltrace-0.3.36/sysdeps/linux-gnu/s390/arch.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/arch.h 26 Jun 2005 18:15:26 -0000 1.2
@@ -9,3 +9,6 @@
#define LT_ELFCLASS ELFCLASS32
#define LT_ELF_MACHINE EM_S390
+
+
+#define PLTs_INIT_BY_HERE NULL
--- ltrace-0.3.36/sysdeps/linux-gnu/s390/plt.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/plt.c 26 Jun 2005 18:18:59 -0000 1.2
@@ -7,3 +7,9 @@
{
return lte->plt_addr + (ndx + 1) * 32;
}
+
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ return (void *) plt;
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/sparc/arch.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/sparc/arch.h 26 Jun 2005 18:15:26 -0000 1.3
@@ -4,4 +4,7 @@
#define LT_ELFCLASS ELFCLASS32
#define LT_ELF_MACHINE EM_SPARC
+#define LT_ELFCLASS2 ELFCLASS32
#define LT_ELF_MACHINE2 EM_SPARC32PLUS
+
+#define PLTs_INIT_BY_HERE NULL
--- ltrace-0.3.36/sysdeps/linux-gnu/sparc/plt.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/sparc/plt.c 26 Jun 2005 18:18:59 -0000 1.2
@@ -7,3 +7,8 @@
{
return rela->r_offset + 4;
}
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ return (void *) plt;
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/arch.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/arch.h 26 Jun 2005 18:15:26 -0000 1.3
@@ -4,3 +4,11 @@
#define LT_ELFCLASS ELFCLASS64
#define LT_ELF_MACHINE EM_X86_64
+#define LT_ELFCLASS2 ELFCLASS32
+#define LT_ELF_MACHINE2 EM_386
+
+#define PLTs_INIT_BY_HERE NULL
+
+/* __NR_fork, __NR_clone, __NR_clone2, __NR_vfork and __NR_execve
+ from asm-i386/unistd.h. */
+#define FORK_EXEC_SYSCALLS , { 2, 120, -1, 190, 11 }
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/plt.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/plt.c 26 Jun 2005 18:18:59 -0000 1.2
@@ -7,3 +7,8 @@
{
return lte->plt_addr + (ndx + 1) * 16;
}
+
+void * plt2addr(struct process *proc, void ** plt)
+{
+ return (void *) plt;
+}
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/regs.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/regs.c 25 Jun 2005 00:49:56 -0000 1.2
@@ -18,20 +18,32 @@
void *
get_instruction_pointer(struct process * proc) {
- return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 8*RIP, 0);
+ long int ret = ptrace(PTRACE_PEEKUSER, proc->pid, 8*RIP, 0);
+ if (proc->mask_32bit)
+ ret &= 0xffffffff;
+ return (void *)ret;
}
void
set_instruction_pointer(struct process * proc, void * addr) {
+ if (proc->mask_32bit)
+ addr = (void *)((long int) addr & 0xffffffff);
ptrace(PTRACE_POKEUSER, proc->pid, 8*RIP, addr);
}
void *
get_stack_pointer(struct process * proc) {
- return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, 8*RSP, 0);
+ long int ret = ptrace(PTRACE_PEEKUSER, proc->pid, 8*RSP, 0);
+ if (proc->mask_32bit)
+ ret &= 0xffffffff;
+ return (void *)ret;
}
void *
get_return_addr(struct process * proc, void * stack_pointer) {
- return (void *)ptrace(PTRACE_PEEKTEXT, proc->pid, stack_pointer, 0);
+ unsigned long int ret;
+ ret = ptrace(PTRACE_PEEKTEXT, proc->pid, stack_pointer, 0);
+ if (proc->mask_32bit)
+ ret &= 0xffffffff;
+ return (void *)ret;
}
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/signalent1.h 1 Jan 1970 00:00:00 -0000
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/signalent1.h 25 Jun 2005 00:52:21 -0000 1.1
@@ -0,0 +1 @@
+#include "i386/signalent.h"
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/syscallent1.h 1 Jan 1970 00:00:00 -0000
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/syscallent1.h 25 Jun 2005 00:52:21 -0000 1.1
@@ -0,0 +1 @@
+#include "i386/syscallent.h"
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/trace.c 25 Jun 2005 00:49:56 -0000 1.2
@@ -21,6 +21,15 @@
void get_arch_dep(struct process *proc)
{
+ unsigned long cs;
+ if (proc->arch_ptr)
+ return;
+ cs = ptrace(PTRACE_PEEKUSER, proc->pid, 8*CS, 0);
+ if (cs == 0x23) {
+ proc->mask_32bit = 1;
+ proc->personality = 1;
+ }
+ proc->arch_ptr = (void *) 1;
}
/* Returns 1 if syscall, 2 if sysret, 0 otherwise.
@@ -42,8 +51,36 @@
return 0;
}
+static unsigned int
+gimme_arg32(enum tof type, struct process * proc, int arg_num) {
+ if (arg_num==-1) { /* return value */
+ return ptrace(PTRACE_PEEKUSER, proc->pid, 8*RAX, 0);
+ }
+
+ if (type==LT_TOF_FUNCTION || type==LT_TOF_FUNCTIONR) {
+ return ptrace(PTRACE_PEEKTEXT, proc->pid, proc->stack_pointer+4*(arg_num+1), 0);
+ } else if (type==LT_TOF_SYSCALL || type==LT_TOF_SYSCALLR) {
+ switch(arg_num) {
+ case 0: return ptrace(PTRACE_PEEKUSER, proc->pid, 8*RBX, 0);
+ case 1: return ptrace(PTRACE_PEEKUSER, proc->pid, 8*RCX, 0);
+ case 2: return ptrace(PTRACE_PEEKUSER, proc->pid, 8*RDX, 0);
+ case 3: return ptrace(PTRACE_PEEKUSER, proc->pid, 8*RSI, 0);
+ case 4: return ptrace(PTRACE_PEEKUSER, proc->pid, 8*RDI, 0);
+ case 5: return ptrace(PTRACE_PEEKUSER, proc->pid, 8*RBP, 0);
+ default:
+ fprintf(stderr, "gimme_arg32 called with wrong arguments\n");
+ exit(2);
+ }
+ }
+ fprintf(stderr, "gimme_arg called with wrong arguments\n");
+ exit(1);
+}
+
long
gimme_arg(enum tof type, struct process * proc, int arg_num) {
+ if (proc->mask_32bit)
+ return (unsigned int)gimme_arg32(type, proc, arg_num);
+
if (arg_num==-1) { /* return value */
return ptrace(PTRACE_PEEKUSER, proc->pid, 8*RAX, 0);
}
@@ -58,9 +95,7 @@
case 5: return ptrace(PTRACE_PEEKUSER, proc->pid, 8*R9, 0);
default:
return ptrace(PTRACE_PEEKTEXT, proc->pid,
- proc->stack_pointer + 8 * (arg_num - 6 + 1), 0);
- fprintf(stderr, "gimme_arg called with wrong arguments\n");
- exit(2);
+ proc->stack_pointer + 8 * (arg_num - 6 + 1), 0);
}
} else if (type==LT_TOF_SYSCALL || LT_TOF_SYSCALLR) {
switch(arg_num) {
ltrace-s390x.patch:
ltrace.h | 2
sysdeps/linux-gnu/Makefile | 3
sysdeps/linux-gnu/alpha/trace.c | 2
sysdeps/linux-gnu/arm/trace.c | 2
sysdeps/linux-gnu/i386/trace.c | 2
sysdeps/linux-gnu/m68k/trace.c | 2
sysdeps/linux-gnu/ppc/trace.c | 2
sysdeps/linux-gnu/s390/arch.h | 8
sysdeps/linux-gnu/s390/regs.c | 32 +++
sysdeps/linux-gnu/s390/signalent.h | 3
sysdeps/linux-gnu/s390/signalent1.h | 1
sysdeps/linux-gnu/s390/syscallent.h | 282 ----------------------------------
sysdeps/linux-gnu/s390/syscallent1.h | 1
sysdeps/linux-gnu/s390/syscalls31.h | 287 +++++++++++++++++++++++++++++++++++
sysdeps/linux-gnu/s390/syscalls64.h | 287 +++++++++++++++++++++++++++++++++++
sysdeps/linux-gnu/s390/trace.c | 159 +++++++++++++++----
sysdeps/linux-gnu/sparc/trace.c | 2
sysdeps/linux-gnu/trace.c | 21 ++
sysdeps/linux-gnu/x86_64/trace.c | 2
wait_for_something.c | 4
20 files changed, 782 insertions(+), 322 deletions(-)
--- NEW FILE ltrace-s390x.patch ---
--- ltrace-0.3.36/ltrace.h 26 Jun 2005 18:20:47 -0000 1.7
+++ ltrace-0.3.36/ltrace.h 22 Dec 2005 22:37:16 -0000 1.8
@@ -98,6 +98,7 @@
int breakpoints_enabled; /* -1:not enabled yet, 0:disabled, 1:enabled */
int mask_32bit; /* 1 if 64-bit ltrace is tracing 32-bit process. */
int personality;
+ int tracesysgood; /* signal indicating a PTRACE_SYSCALL trap */
int callstack_depth;
struct callstack_element callstack[MAX_CALLDEPTH];
@@ -167,6 +168,7 @@
/* Arch-dependent stuff: */
extern char * pid2name(pid_t pid);
+extern void trace_set_options(struct process * proc, pid_t pid);
extern void trace_me(void);
extern int trace_pid(pid_t pid);
extern void untrace_pid(pid_t pid);
--- ltrace-0.3.36/wait_for_something.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/wait_for_something.c 22 Dec 2005 22:37:16 -0000 1.2
@@ -54,6 +54,7 @@
if (event.proc->breakpoints_enabled == -1) {
enable_all_breakpoints(event.proc);
event.thing = LT_EV_NONE;
+ trace_set_options(event.proc, event.proc->pid);
continue_process(event.proc->pid);
return &event;
}
@@ -82,7 +83,8 @@
event.thing = LT_EV_UNKNOWN;
return &event;
}
- if (WSTOPSIG(status) != SIGTRAP) {
+ if ((WSTOPSIG(status) != (SIGTRAP | event.proc->tracesysgood)) &&
+ (WSTOPSIG(status) != SIGTRAP)) {
event.thing = LT_EV_SIGNAL;
event.e_un.signum = WSTOPSIG(status);
return &event;
--- ltrace-0.3.36/sysdeps/linux-gnu/Makefile 25 Jun 2005 01:09:01 -0000 1.3
+++ ltrace-0.3.36/sysdeps/linux-gnu/Makefile 22 Dec 2005 22:37:16 -0000 1.4
@@ -1,4 +1,5 @@
-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/)
+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)
--- ltrace-0.3.36/sysdeps/linux-gnu/trace.c 25 Jun 2005 00:49:56 -0000 1.2
+++ ltrace-0.3.36/sysdeps/linux-gnu/trace.c 22 Dec 2005 22:37:16 -0000 1.3
@@ -91,6 +91,27 @@
}
void
+trace_set_options(struct process * proc, pid_t pid) {
+#ifndef PTRACE_SETOPTIONS
+ #define PTRACE_SETOPTIONS 0x4200
+#endif
+#ifndef PTRACE_OLDSETOPTIONS
+ #define PTRACE_OLDSETOPTIONS 21
+#endif
+#ifndef PTRACE_O_TRACESYSGOOD
+ #define PTRACE_O_TRACESYSGOOD 0x00000001
+#endif
+ if (proc->tracesysgood & 0x80)
+ return;
+ if (ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD) < 0 &&
+ ptrace(PTRACE_OLDSETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD) < 0) {
+ perror("PTRACE_SETOPTIONS");
+ return;
+ }
+ proc->tracesysgood |= 0x80;
+}
+
+void
untrace_pid(pid_t pid) {
ptrace(PTRACE_DETACH, pid, 1, 0);
}
--- ltrace-0.3.36/sysdeps/linux-gnu/alpha/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/alpha/trace.c 22 Dec 2005 22:37:16 -0000 1.2
@@ -27,7 +27,7 @@
*/
int
syscall_p(struct process * proc, int status, int * sysnum) {
- if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
+ if (WIFSTOPPED(status) && WSTOPSIG(status)==(SIGTRAP | proc->tracesysgood)) {
char *ip=get_instruction_pointer(proc) - 4;
long x = ptrace(PTRACE_PEEKTEXT, proc->pid, ip, 0);
debug(2, "instr: %016lx", x);
--- ltrace-0.3.36/sysdeps/linux-gnu/arm/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/arm/trace.c 22 Dec 2005 22:37:16 -0000 1.2
@@ -34,7 +34,7 @@
*/
int
syscall_p(struct process * proc, int status, int * sysnum) {
- if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
+ if (WIFSTOPPED(status) && WSTOPSIG(status)==(SIGTRAP | proc->tracesysgood)) {
/* get the user's pc (plus 8) */
int pc = ptrace(PTRACE_PEEKUSER, proc->pid, off_pc, 0);
/* fetch the SWI instruction */
--- ltrace-0.3.36/sysdeps/linux-gnu/i386/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/i386/trace.c 22 Dec 2005 22:37:16 -0000 1.2
@@ -27,7 +27,7 @@
*/
int
syscall_p(struct process * proc, int status, int * sysnum) {
- if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
+ if (WIFSTOPPED(status) && WSTOPSIG(status)==(SIGTRAP | proc->tracesysgood)) {
*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4*ORIG_EAX, 0);
if (proc->callstack_depth > 0 &&
--- ltrace-0.3.36/sysdeps/linux-gnu/m68k/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/m68k/trace.c 22 Dec 2005 22:37:16 -0000 1.2
@@ -28,7 +28,7 @@
syscall_p(struct process * proc, int status, int * sysnum) {
int depth;
- if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
+ if (WIFSTOPPED(status) && WSTOPSIG(status)==(SIGTRAP | proc->tracesysgood)) {
*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 4*PT_ORIG_D0, 0);
if (*sysnum == -1) return 0;
if (*sysnum>=0) {
--- ltrace-0.3.36/sysdeps/linux-gnu/ppc/trace.c 26 Jun 2005 18:18:59 -0000 1.3
+++ ltrace-0.3.36/sysdeps/linux-gnu/ppc/trace.c 22 Dec 2005 22:37:16 -0000 1.4
@@ -37,7 +37,7 @@
#define SYSCALL_INSN 0x44000002
int
syscall_p(struct process * proc, int status, int * sysnum) {
- if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
+ if (WIFSTOPPED(status) && WSTOPSIG(status)==(SIGTRAP | proc->tracesysgood)) {
long pc = (long)get_instruction_pointer(proc);
int insn = (int)ptrace(PTRACE_PEEKTEXT, proc->pid, pc-sizeof(long), 0);
--- ltrace-0.3.36/sysdeps/linux-gnu/s390/arch.h 29 Dec 2005 22:45:14 -0000 1.3
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/arch.h 29 Dec 2005 23:00:35 -0000 1.4
@@ -7,9 +7,15 @@
#define BREAKPOINT_LENGTH 2
#define DECR_PC_AFTER_BREAK 2
+#ifdef __s390x__
+#define LT_ELFCLASS ELFCLASS64
+#define LT_ELF_MACHINE EM_S390
+#define LT_ELFCLASS2 ELFCLASS32
+#define LT_ELF_MACHINE2 EM_S390
+#else
#define LT_ELFCLASS ELFCLASS32
#define LT_ELF_MACHINE EM_S390
-
+#endif
#define PLTs_INIT_BY_HERE NULL
#define E_ENTRY_NAME "_start"
--- ltrace-0.3.36/sysdeps/linux-gnu/s390/regs.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/regs.c 22 Dec 2005 22:37:16 -0000 1.2
@@ -21,22 +21,48 @@
# define PTRACE_POKEUSER PTRACE_POKEUSR
#endif
+#ifdef __s390x__
+#define PSW_MASK 0xffffffffffffffff
+#define PSW_MASK31 0x7fffffff
+#else
+#define PSW_MASK 0x7fffffff
+#endif
+
void *
get_instruction_pointer(struct process * proc) {
- return (void *)(ptrace(PTRACE_PEEKUSER, proc->pid, PT_PSWADDR, 0) & 0x7fffffff);
+ long ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_PSWADDR, 0) & PSW_MASK;
+#ifdef __s390x__
+ if (proc->mask_32bit)
+ ret &= PSW_MASK31;
+#endif
+ return (void *) ret;
}
void
set_instruction_pointer(struct process * proc, void * addr) {
+#ifdef __s390x__
+ if (proc->mask_32bit)
+ addr = (void *) ((long) addr & PSW_MASK31);
+#endif
ptrace(PTRACE_POKEUSER, proc->pid, PT_PSWADDR, addr);
}
void *
get_stack_pointer(struct process * proc) {
- return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR15, 0);
+ long ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR15, 0) & PSW_MASK;
+#ifdef __s390x__
+ if (proc->mask_32bit)
+ ret &= PSW_MASK31;
+#endif
+ return (void *) ret;
}
void *
get_return_addr(struct process * proc, void * stack_pointer) {
- return (void *)(ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR14, 0) & 0x7fffffff);
+ long ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR14, 0) & PSW_MASK;
+#ifdef __s390x__
+ if (proc->mask_32bit)
+ ret &= PSW_MASK31;
+#endif
+ return (void *) ret;
}
--- ltrace-0.3.36/sysdeps/linux-gnu/s390/signalent.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/signalent.h 22 Dec 2005 22:37:16 -0000 1.2
@@ -29,4 +29,5 @@
"SIGWINCH", /* 28 */
"SIGIO", /* 29 */
"SIGPWR", /* 30 */
- "SIGSYS", /* 31 */
+ "SIGUNUSED", /* 31 */
+ "SIGRTMIN", /* 32 */
--- ltrace-0.3.36//dev/null 1 Jan 1970 00:00:00 -0000
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/signalent1.h 22 Dec 2005 22:37:16 -0000 1.1
@@ -0,0 +1 @@
+#include "s390/signalent.h"
--- ltrace-0.3.36/sysdeps/linux-gnu/s390/syscallent.h 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/syscallent.h 22 Dec 2005 22:37:16 -0000 1.2
@@ -1,277 +1,5 @@
- "0", /* 0 */
- "exit", /* 1 */
- "fork", /* 2 */
- "read", /* 3 */
- "write", /* 4 */
- "open", /* 5 */
- "close", /* 6 */
- "7", /* 7 */
- "creat", /* 8 */
- "link", /* 9 */
- "unlink", /* 10 */
- "execve", /* 11 */
- "chdir", /* 12 */
- "time", /* 13 */
- "mknod", /* 14 */
- "chmod", /* 15 */
- "lchown", /* 16 */
- "17", /* 17 */
- "18", /* 18 */
- "lseek", /* 19 */
- "getpid", /* 20 */
- "mount", /* 21 */
- "umount", /* 22 */
- "setuid", /* 23 */
- "getuid", /* 24 */
- "stime", /* 25 */
- "ptrace", /* 26 */
- "alarm", /* 27 */
- "28", /* 28 */
- "pause", /* 29 */
- "utime", /* 30 */
- "31", /* 31 */
- "32", /* 32 */
- "access", /* 33 */
- "nice", /* 34 */
- "35", /* 35 */
- "sync", /* 36 */
- "kill", /* 37 */
- "rename", /* 38 */
- "mkdir", /* 39 */
- "rmdir", /* 40 */
- "dup", /* 41 */
- "pipe", /* 42 */
- "times", /* 43 */
- "44", /* 44 */
- "brk", /* 45 */
- "setgid", /* 46 */
- "getgid", /* 47 */
- "signal", /* 48 */
- "geteuid", /* 49 */
- "getegid", /* 50 */
- "acct", /* 51 */
- "umount2", /* 52 */
- "53", /* 53 */
- "ioctl", /* 54 */
- "fcntl", /* 55 */
- "56", /* 56 */
- "setpgid", /* 57 */
- "58", /* 58 */
- "59", /* 59 */
- "umask", /* 60 */
- "chroot", /* 61 */
- "ustat", /* 62 */
- "dup2", /* 63 */
- "getppid", /* 64 */
- "getpgrp", /* 65 */
- "setsid", /* 66 */
- "sigaction", /* 67 */
- "68", /* 68 */
- "69", /* 69 */
- "setreuid", /* 70 */
- "setregid", /* 71 */
- "sigsuspend", /* 72 */
- "sigpending", /* 73 */
- "sethostname", /* 74 */
- "setrlimit", /* 75 */
- "getrlimit", /* 76 */
- "getrusage", /* 77 */
- "gettimeofday", /* 78 */
- "settimeofday", /* 79 */
- "getgroups", /* 80 */
- "setgroups", /* 81 */
- "82", /* 82 */
- "symlink", /* 83 */
- "84", /* 84 */
- "readlink", /* 85 */
- "uselib", /* 86 */
- "swapon", /* 87 */
- "reboot", /* 88 */
- "readdir", /* 89 */
- "mmap", /* 90 */
- "munmap", /* 91 */
- "truncate", /* 92 */
- "ftruncate", /* 93 */
- "fchmod", /* 94 */
- "fchown", /* 95 */
- "getpriority", /* 96 */
- "setpriority", /* 97 */
- "98", /* 98 */
- "statfs", /* 99 */
- "fstatfs", /* 100 */
- "ioperm", /* 101 */
- "socketcall", /* 102 */
- "syslog", /* 103 */
- "setitimer", /* 104 */
- "getitimer", /* 105 */
- "stat", /* 106 */
- "lstat", /* 107 */
- "fstat", /* 108 */
- "109", /* 109 */
- "110", /* 110 */
- "vhangup", /* 111 */
- "idle", /* 112 */
- "113", /* 113 */
- "wait4", /* 114 */
- "swapoff", /* 115 */
- "sysinfo", /* 116 */
- "ipc", /* 117 */
- "fsync", /* 118 */
- "sigreturn", /* 119 */
- "clone", /* 120 */
- "setdomainname", /* 121 */
- "uname", /* 122 */
- "123", /* 123 */
- "adjtimex", /* 124 */
- "mprotect", /* 125 */
- "sigprocmask", /* 126 */
- "create_module", /* 127 */
- "init_module", /* 128 */
- "delete_module", /* 129 */
- "get_kernel_syms", /* 130 */
- "quotactl", /* 131 */
- "getpgid", /* 132 */
- "fchdir", /* 133 */
- "bdflush", /* 134 */
- "sysfs", /* 135 */
- "personality", /* 136 */
- "afs_syscall", /* 137 */
- "setfsuid", /* 138 */
- "setfsgid", /* 139 */
- "_llseek", /* 140 */
- "getdents", /* 141 */
- "_newselect", /* 142 */
- "flock", /* 143 */
- "msync", /* 144 */
- "readv", /* 145 */
- "writev", /* 146 */
- "getsid", /* 147 */
- "fdatasync", /* 148 */
- "_sysctl", /* 149 */
- "mlock", /* 150 */
- "munlock", /* 151 */
- "mlockall", /* 152 */
- "munlockall", /* 153 */
- "sched_setparam", /* 154 */
- "sched_getparam", /* 155 */
- "sched_setscheduler", /* 156 */
- "sched_getscheduler", /* 157 */
- "sched_yield", /* 158 */
- "sched_get_priority_max", /* 159 */
- "sched_get_priority_min", /* 160 */
- "sched_rr_get_interval", /* 161 */
- "nanosleep", /* 162 */
- "mremap", /* 163 */
- "setresuid", /* 164 */
- "getresuid", /* 165 */
- "166", /* 166 */
- "query_module", /* 167 */
- "poll", /* 168 */
- "nfsservctl", /* 169 */
- "setresgid", /* 170 */
- "getresgid", /* 171 */
- "prctl", /* 172 */
- "rt_sigreturn", /* 173 */
- "rt_sigaction", /* 174 */
- "rt_sigprocmask", /* 175 */
- "rt_sigpending", /* 176 */
- "rt_sigtimedwait", /* 177 */
- "rt_sigqueueinfo", /* 178 */
- "rt_sigsuspend", /* 179 */
- "pread", /* 180 */
- "pwrite", /* 181 */
- "chown", /* 182 */
- "getcwd", /* 183 */
- "capget", /* 184 */
- "capset", /* 185 */
- "sigaltstack", /* 186 */
- "sendfile", /* 187 */
- "getpmsg", /* 188 */
- "putpmsg", /* 189 */
- "vfork", /* 190 */
- "ugetrlimit", /* 191 */
- "mmap2", /* 192 */
- "truncate64", /* 193 */
- "ftruncate64", /* 194 */
- "stat64", /* 195 */
- "lstat64", /* 196 */
- "fstat64", /* 197 */
- "lchown32", /* 198 */
- "getuid32", /* 199 */
- "getgid32", /* 200 */
- "geteuid32", /* 201 */
- "getegid32", /* 202 */
- "setreuid32", /* 203 */
- "setregid32", /* 204 */
- "getgroups32", /* 205 */
- "setgroups32", /* 206 */
- "fchown32", /* 207 */
- "setresuid32", /* 208 */
- "getresuid32", /* 209 */
- "setresgid32", /* 210 */
- "getresgid32", /* 211 */
- "chown32", /* 212 */
- "setuid32", /* 213 */
- "setgid32", /* 214 */
- "setfsuid32", /* 215 */
- "setfsgid32", /* 216 */
- "pivot_root", /* 217 */
- "mincore", /* 218 */
- "madvise", /* 219 */
- "getdents64", /* 220 */
- "fcntl64", /* 221 */
- "readahead", /* 222 */
- "sendfile64", /* 223 */
- "setxattr", /* 224 */
- "lsetxattr", /* 225 */
- "fsetxattr", /* 226 */
- "getxattr", /* 227 */
- "lgetxattr", /* 228 */
- "fgetxattr", /* 229 */
- "listxattr", /* 230 */
- "llistxattr", /* 231 */
- "flistxattr", /* 232 */
- "removexattr", /* 233 */
- "lremovexattr", /* 234 */
- "fremovexattr", /* 235 */
- "gettid", /* 236 */
- "tkill", /* 237 */
- "futex", /* 238 */
- "sched_setaffinity", /* 239 */
- "sched_getaffinity", /* 240 */
- "241", /* 241 */
- "242", /* 242 */
- "io_setup", /* 243 */
- "io_destroy", /* 244 */
- "io_getevents", /* 245 */
- "io_submit", /* 246 */
- "io_cancel", /* 247 */
- "exit_group", /* 248 */
- "epoll_create", /* 249 */
- "epoll_ctl", /* 250 */
- "epoll_wait", /* 251 */
- "set_tid_address", /* 252 */
- "fadvise64", /* 253 */
- "timer_create", /* 254 */
- "timer_settime", /* 255 */
- "timer_gettime", /* 256 */
- "timer_getoverrun", /* 257 */
- "timer_delete", /* 258 */
- "clock_settime", /* 259 */
- "clock_gettime", /* 260 */
- "clock_getres", /* 261 */
- "clock_nanosleep", /* 262 */
- "263", /* 263 */
- "fadvise64_64", /* 264 */
- "statfs64", /* 265 */
- "fstatfs64", /* 266 */
- "267", /* 267 */
- "268", /* 268 */
- "269", /* 269 */
- "270", /* 270 */
- "mq_open", /* 271 */
- "mq_unlink", /* 272 */
- "mq_timedsend", /* 273 */
- "mq_timedreceive", /* 274 */
- "mq_notify", /* 275 */
- "mq_getsetattr", /* 276 */
+#ifdef __s390x__
+#include "s390/syscalls64.h"
+#else
+#include "s390/syscalls31.h"
+#endif
--- ltrace-0.3.36//dev/null 1 Jan 1970 00:00:00 -0000
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/syscallent1.h 22 Dec 2005 22:37:16 -0000 1.1
@@ -0,0 +1 @@
+#include "s390/syscalls31.h"
--- ltrace-0.3.36//dev/null 1 Jan 1970 00:00:00 -0000
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/syscalls31.h 22 Dec 2005 22:37:16 -0000 1.1
@@ -0,0 +1,287 @@
+"0",
+"exit",
+"fork",
+"read",
+"write",
+"open",
+"close",
+"7",
+"creat",
+"link",
+"unlink",
+"execve",
+"chdir",
+"time",
+"mknod",
+"chmod",
+"lchown16",
+"17",
+"18",
+"lseek",
+"getpid",
+"mount",
+"oldumount",
+"setuid16",
+"getuid16",
+"stime",
+"ptrace",
+"alarm",
+"28",
+"pause",
+"utime",
+"31",
+"32",
+"access",
+"nice",
+"35",
+"sync",
+"kill",
+"rename",
+"mkdir",
+"rmdir",
+"dup",
+"pipe",
+"times",
+"44",
+"brk",
+"setgid16",
+"getgid16",
+"signal",
+"geteuid16",
+"getegid16",
+"acct",
+"umount",
+"53",
+"ioctl",
+"fcntl",
+"56",
+"setpgid",
+"58",
+"59",
+"umask",
+"chroot",
+"ustat",
+"dup2",
+"getppid",
+"getpgrp",
+"setsid",
+"sigaction",
+"68",
+"69",
+"setreuid16",
+"setregid16",
+"sigsuspend",
+"sigpending",
+"sethostname",
+"setrlimit",
+"old_getrlimit",
+"getrusage",
+"gettimeofday",
+"settimeofday",
+"getgroups16",
+"setgroups16",
+"82",
+"symlink",
+"84",
+"readlink",
+"uselib",
+"swapon",
+"reboot",
+"89",
+"old_mmap",
+"munmap",
+"truncate",
+"ftruncate",
+"fchmod",
+"fchown16",
+"getpriority",
+"setpriority",
+"98",
+"statfs",
+"fstatfs",
+"101",
+"socketcall",
+"syslog",
+"setitimer",
+"getitimer",
+"newstat",
+"newlstat",
+"newfstat",
+"109",
+"lookup_dcookie",
+"vhangup",
+"112",
+"113",
+"wait4",
+"swapoff",
+"sysinfo",
+"ipc",
+"fsync",
+"sigreturn",
+"clone",
+"setdomainname",
+"newuname",
+"123",
+"adjtimex",
+"mprotect",
+"sigprocmask",
+"127",
+"init_module",
+"delete_module",
+"130",
+"quotactl",
+"getpgid",
+"fchdir",
+"bdflush",
+"sysfs",
+"personality",
+"137",
+"setfsuid16",
+"setfsgid16",
+"llseek",
+"getdents",
+"select",
+"flock",
+"msync",
+"readv",
+"writev",
+"getsid",
+"fdatasync",
+"sysctl",
+"mlock",
+"munlock",
+"mlockall",
+"munlockall",
+"sched_setparam",
+"sched_getparam",
+"sched_setscheduler",
+"sched_getscheduler",
+"sched_yield",
+"sched_get_priority_max",
+"sched_get_priority_min",
+"sched_rr_get_interval",
+"nanosleep",
+"mremap",
+"setresuid16",
+"getresuid16",
+"166",
+"167",
+"poll",
+"nfsservctl",
+"setresgid16",
+"getresgid16",
+"prctl",
+"rt_sigreturn",
+"rt_sigaction",
+"rt_sigprocmask",
+"rt_sigpending",
+"rt_sigtimedwait",
+"rt_sigqueueinfo",
+"rt_sigsuspend",
+"pread64",
+"pwrite64",
+"chown16",
+"getcwd",
+"capget",
+"capset",
+"sigaltstack",
+"sendfile",
+"188",
+"189",
+"vfork",
+"getrlimit",
+"mmap2",
+"truncate64",
+"ftruncate64",
+"stat64",
+"lstat64",
+"fstat64",
+"lchown",
+"getuid",
+"getgid",
+"geteuid",
+"getegid",
+"setreuid",
+"setregid",
+"getgroups",
+"setgroups",
+"fchown",
+"setresuid",
+"getresuid",
+"setresgid",
+"getresgid",
+"chown",
+"setuid",
+"setgid",
+"setfsuid",
+"setfsgid",
+"pivot_root",
+"mincore",
+"madvise",
+"getdents64",
+"fcntl64",
+"readahead",
+"sendfile64",
+"setxattr",
+"lsetxattr",
+"fsetxattr",
+"getxattr",
+"lgetxattr",
+"fgetxattr",
+"listxattr",
+"llistxattr",
+"flistxattr",
+"removexattr",
+"lremovexattr",
+"fremovexattr",
+"gettid",
+"tkill",
+"futex",
+"sched_setaffinity",
+"sched_getaffinity",
+"tgkill",
+"242",
+"io_setup",
+"io_destroy",
+"io_getevents",
+"io_submit",
+"io_cancel",
+"exit_group",
+"epoll_create",
+"epoll_ctl",
+"epoll_wait",
+"set_tid_address",
+"fadvise64",
+"timer_create",
+"timer_settime",
+"timer_gettime",
+"timer_getoverrun",
+"timer_delete",
+"clock_settime",
+"clock_gettime",
+"clock_getres",
+"clock_nanosleep",
+"263",
+"fadvise64_64",
+"statfs64",
+"fstatfs64",
+"remap_file_pages",
+"268",
+"269",
+"270",
+"mq_open",
+"mq_unlink",
+"mq_timedsend",
+"mq_timedreceive",
+"mq_notify",
+"mq_getsetattr",
+"kexec_load",
+"add_key",
+"request_key",
+"keyctl",
+"waitid",
+"ioprio_set",
+"ioprio_get",
+"inotify_init",
+"inotify_add_watch",
+"inotify_rm_watch",
--- ltrace-0.3.36//dev/null 1 Jan 1970 00:00:00 -0000
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/syscalls64.h 22 Dec 2005 22:37:16 -0000 1.1
@@ -0,0 +1,287 @@
+"0",
+"exit",
+"fork",
+"read",
+"write",
+"open",
+"close",
+"7",
+"creat",
+"link",
+"unlink",
+"execve",
+"chdir",
+"13",
+"mknod",
+"chmod",
+"16",
+"17",
+"18",
+"lseek",
+"getpid",
+"mount",
+"oldumount",
+"23",
+"24",
+"25",
+"ptrace",
+"alarm",
+"28",
+"pause",
+"utime",
+"31",
+"32",
+"access",
+"nice",
+"35",
+"sync",
+"kill",
+"rename",
+"mkdir",
+"rmdir",
+"dup",
+"pipe",
+"times",
+"44",
+"brk",
+"46",
+"47",
+"signal",
+"49",
+"50",
+"acct",
+"umount",
+"53",
+"ioctl",
+"fcntl",
+"56",
+"setpgid",
+"58",
+"59",
+"umask",
+"chroot",
+"ustat",
+"dup2",
+"getppid",
+"getpgrp",
+"setsid",
+"sigaction",
+"68",
+"69",
+"70",
+"71",
+"sigsuspend",
+"sigpending",
+"sethostname",
+"setrlimit",
+"getrlimit",
+"getrusage",
+"gettimeofday",
+"settimeofday",
+"80",
+"81",
+"82",
+"symlink",
+"84",
+"readlink",
+"uselib",
+"swapon",
+"reboot",
+"89",
+"old_mmap",
+"munmap",
+"truncate",
+"ftruncate",
+"fchmod",
+"95",
+"getpriority",
+"setpriority",
+"98",
+"statfs",
+"fstatfs",
+"101",
+"socketcall",
+"syslog",
+"setitimer",
+"getitimer",
+"newstat",
+"newlstat",
+"newfstat",
+"109",
+"lookup_dcookie",
+"vhangup",
+"112",
+"113",
+"wait4",
+"swapoff",
+"sysinfo",
+"ipc",
+"fsync",
+"sigreturn",
+"clone",
+"setdomainname",
+"newuname",
+"123",
+"adjtimex",
+"mprotect",
+"sigprocmask",
+"127",
+"init_module",
+"delete_module",
+"130",
+"quotactl",
+"getpgid",
+"fchdir",
+"bdflush",
+"sysfs",
+"personality",
+"137",
+"138",
+"139",
+"llseek",
+"getdents",
+"select",
+"flock",
+"msync",
+"readv",
+"writev",
+"getsid",
+"fdatasync",
+"sysctl",
+"mlock",
+"munlock",
+"mlockall",
+"munlockall",
+"sched_setparam",
+"sched_getparam",
+"sched_setscheduler",
+"sched_getscheduler",
+"sched_yield",
+"sched_get_priority_max",
+"sched_get_priority_min",
+"sched_rr_get_interval",
+"nanosleep",
+"mremap",
+"164",
+"165",
+"166",
+"167",
+"poll",
+"nfsservctl",
+"170",
+"171",
+"prctl",
+"rt_sigreturn",
+"rt_sigaction",
+"rt_sigprocmask",
+"rt_sigpending",
+"rt_sigtimedwait",
+"rt_sigqueueinfo",
+"rt_sigsuspend",
+"pread64",
+"pwrite64",
+"182",
+"getcwd",
+"capget",
+"capset",
+"sigaltstack",
+"sendfile64",
+"188",
+"189",
+"vfork",
+"getrlimit",
+"mmap2",
+"193",
+"194",
+"195",
+"196",
+"197",
+"lchown",
+"getuid",
+"getgid",
+"geteuid",
+"getegid",
+"setreuid",
+"setregid",
+"getgroups",
+"setgroups",
+"fchown",
+"setresuid",
+"getresuid",
+"setresgid",
+"getresgid",
+"chown",
+"setuid",
+"setgid",
+"setfsuid",
+"setfsgid",
+"pivot_root",
+"mincore",
+"madvise",
+"getdents64",
+"221",
+"readahead",
+"223",
+"setxattr",
+"lsetxattr",
+"fsetxattr",
+"getxattr",
+"lgetxattr",
+"fgetxattr",
+"listxattr",
+"llistxattr",
+"flistxattr",
+"removexattr",
+"lremovexattr",
+"fremovexattr",
+"gettid",
+"tkill",
+"futex",
+"sched_setaffinity",
+"sched_getaffinity",
+"tgkill",
+"242",
+"io_setup",
+"io_destroy",
+"io_getevents",
+"io_submit",
+"io_cancel",
+"exit_group",
+"epoll_create",
+"epoll_ctl",
+"epoll_wait",
+"set_tid_address",
+"fadvise64_64",
+"timer_create",
+"timer_settime",
+"timer_gettime",
+"timer_getoverrun",
+"timer_delete",
+"clock_settime",
+"clock_gettime",
+"clock_getres",
+"clock_nanosleep",
+"263",
+"264",
+"statfs64",
+"fstatfs64",
+"remap_file_pages",
+"268",
+"269",
+"270",
+"mq_open",
+"mq_unlink",
+"mq_timedsend",
+"mq_timedreceive",
+"mq_notify",
+"mq_getsetattr",
+"kexec_load",
+"add_key",
+"request_key",
+"keyctl",
+"waitid",
+"ioprio_set",
+"ioprio_get",
+"inotify_init",
+"inotify_add_watch",
+"inotify_rm_watch",
--- ltrace-0.3.36/sysdeps/linux-gnu/s390/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/s390/trace.c 22 Dec 2005 22:37:16 -0000 1.2
@@ -4,14 +4,15 @@
** Other routines are in ../trace.c and need to be combined
** at link time with this code.
**
-** S/390 version
-** Copyright (C) 2001 IBM Poughkeepsie, IBM Corporation
+** Copyright (C) 2001,2005 IBM Corp.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#include <errno.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
@@ -30,46 +31,129 @@
void
get_arch_dep(struct process * proc) {
+#ifdef __s390x__
+ unsigned long psw;
+
+ if (proc->arch_ptr)
+ return;
+
+ psw = ptrace(PTRACE_PEEKUSER, proc->pid, PT_PSWMASK, 0);
+
+ if ((psw & 0x000000180000000) == 0x000000080000000) {
+ proc->mask_32bit = 1;
+ proc->personality = 1;
+ }
+
+ proc->arch_ptr = (void *) 1;
+#endif
}
/* Returns 1 if syscall, 2 if sysret, 0 otherwise.
*/
int
syscall_p(struct process * proc, int status, int * sysnum) {
- long pswa;
- long svcinst;
- long svcno;
- long svcop;
-
- if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
+ long pc, opcode, offset_reg, scno, tmp;
+ void *svc_addr;
+ int gpr_offset[16] = {PT_GPR0, PT_GPR1, PT_ORIGGPR2, PT_GPR3,
+ PT_GPR4, PT_GPR5, PT_GPR6, PT_GPR7,
+ PT_GPR8, PT_GPR9, PT_GPR10, PT_GPR11,
+ PT_GPR12, PT_GPR13, PT_GPR14, PT_GPR15};
+
+ if (WIFSTOPPED(status) && WSTOPSIG(status)==(SIGTRAP | proc->tracesysgood)) {
+
+ /*
+ * If we have PTRACE_O_TRACESYSGOOD and we have the new style
+ * of passing the system call number to user space via PT_GPR2
+ * then the task is quite easy.
+ */
- pswa = ptrace(PTRACE_PEEKUSER, proc->pid, PT_PSWADDR, 0);
- svcinst = ptrace(PTRACE_PEEKTEXT, proc->pid, (char *)(pswa-4),0);
- svcop = (svcinst >> 8) & 0xFF;
- svcno = svcinst & 0xFF;
+ *sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR2, 0);
- *sysnum = svcno;
-
- if (*sysnum == -1) {
- return 0;
- }
- if (svcop == 0 && svcno == 1) {
- /* Breakpoint was hit... */
- return 0;
- }
- if (svcop == 10 && *sysnum>=0) {
+ if (proc->tracesysgood) {
/* System call was encountered... */
if (proc->callstack_depth > 0 &&
- proc->callstack[proc->callstack_depth-1].is_syscall) {
+ proc->callstack[proc->callstack_depth-1].is_syscall) {
+ /* syscall exit */
+ *sysnum = proc->callstack[proc->callstack_depth-1].c_un.syscall;
return 2;
} else {
- return 1;
+ /* syscall enter */
+ if (*sysnum != -ENOSYS)
+ return 1;
}
}
+
+ /*
+ * At least one of the two requirements mentioned above is not
+ * met. Therefore the fun part starts here:
+ * We try to do some instruction decoding without even knowing
+ * the instruction code length of the last instruction executed.
+ * Needs to be done to get the system call number or to decide
+ * if we reached a breakpoint or even checking for a completely
+ * unrelated instruction.
+ * Just a heuristic that most of the time appears to work...
+ */
+
+ pc = ptrace(PTRACE_PEEKUSER, proc->pid, PT_PSWADDR, 0);
+ opcode = ptrace(PTRACE_PEEKTEXT, proc->pid,
+ (char *)(pc-sizeof(long)),0);
+
+ if ((opcode & 0xffff) == 0x0001) {
+ /* Breakpoint */
+ return 0;
+ }
+ else if ((opcode & 0xff00) == 0x0a00) {
+ /* SVC opcode */
+ scno = opcode & 0xff;
+ }
+ else if ((opcode & 0xff000000) == 0x44000000) {
+ /* Instruction decoding of EXECUTE... */
+ svc_addr = (void *) (opcode & 0xfff);
+
+ offset_reg = (opcode & 0x000f0000) >> 16;
+ if (offset_reg)
+ svc_addr += ptrace(PTRACE_PEEKUSER, proc->pid,
+ gpr_offset[offset_reg], 0);
+
+ offset_reg = (opcode & 0x0000f000) >> 12;
+ if (offset_reg)
+ svc_addr += ptrace(PTRACE_PEEKUSER, proc->pid,
+ gpr_offset[offset_reg], 0);
+
+ scno = ptrace(PTRACE_PEEKTEXT, proc->pid, svc_addr, 0);
+#ifdef __s390x__
+ scno >>= 48;
+#else
+ scno >>= 16;
+#endif
+ if ((scno & 0xff00) != 0x0a000)
+ return 0;
+
+ tmp = 0;
+ offset_reg = (opcode & 0x00f00000) >> 20;
+ if (offset_reg)
+ tmp = ptrace(PTRACE_PEEKUSER, proc->pid,
+ gpr_offset[offset_reg], 0);
+
+ scno = (scno | tmp) & 0xff;
+ }
else {
- /* Unknown trap was encountered... */
+ /* No opcode related to syscall handling */
return 0;
}
+
+ if (scno == 0)
+ scno = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR1, 0);
+
+ *sysnum = scno;
+
+ /* System call was encountered... */
+ if (proc->callstack_depth > 0 &&
+ proc->callstack[proc->callstack_depth-1].is_syscall) {
+ return 2;
+ } else {
+ return 1;
+ }
}
/* Unknown status... */
return 0;
@@ -77,18 +161,31 @@
long
gimme_arg(enum tof type, struct process * proc, int arg_num) {
+ long ret;
+
switch(arg_num) {
case -1: /* return value */
- return ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR2, 0);
- case 0: return ptrace(PTRACE_PEEKUSER, proc->pid, PT_ORIGGPR2, 0);
- case 1: return ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR3, 0);
- case 2: return ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR4, 0);
- case 3: return ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR5, 0);
- case 4: return ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR6, 0);
+ ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR2, 0);
+ break;
+ case 0: ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_ORIGGPR2, 0);
+ break;
+ case 1: ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR3, 0);
+ break;
+ case 2: ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR4, 0);
+ break;
+ case 3: ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR5, 0);
+ break;
+ case 4: ret = ptrace(PTRACE_PEEKUSER, proc->pid, PT_GPR6, 0);
+ break;
default:
fprintf(stderr, "gimme_arg called with wrong arguments\n");
exit(2);
}
+#ifdef __s390x__
+ if (proc->mask_32bit)
+ ret &= 0xffffffff;
+#endif
+ return ret;
}
void
--- ltrace-0.3.36/sysdeps/linux-gnu/sparc/trace.c 25 Jun 2005 00:37:30 -0000 1.1.1.1
+++ ltrace-0.3.36/sysdeps/linux-gnu/sparc/trace.c 22 Dec 2005 22:37:16 -0000 1.2
@@ -27,7 +27,7 @@
*/
int syscall_p(struct process *proc, int status, int *sysnum)
{
- if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
+ if (WIFSTOPPED(status) && WSTOPSIG(status)==(SIGTRAP | proc->tracesysgood)) {
void *ip = get_instruction_pointer(proc);
unsigned int insn;
if (ip == (void *)-1) return 0;
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/trace.c 25 Jun 2005 00:49:56 -0000 1.2
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/trace.c 22 Dec 2005 22:37:16 -0000 1.3
@@ -36,7 +36,7 @@
*/
int
syscall_p(struct process * proc, int status, int * sysnum) {
- if (WIFSTOPPED(status) && WSTOPSIG(status)==SIGTRAP) {
+ if (WIFSTOPPED(status) && WSTOPSIG(status)==(SIGTRAP | proc->tracesysgood)) {
*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, 8*ORIG_RAX, 0);
if (proc->callstack_depth > 0 &&
ltrace-syscallent-update.patch:
i386/syscallent.h | 9 +++++++++
ppc/syscallent.h | 9 +++++++++
sparc/syscallent.h | 14 +++++++++-----
x86_64/syscallent.h | 8 ++++++++
4 files changed, 35 insertions(+), 5 deletions(-)
--- NEW FILE ltrace-syscallent-update.patch ---
--- ltrace-0.3.36/sysdeps/linux-gnu/ppc/syscallent.h.jj 2004-11-09 13:25:16.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/ppc/syscallent.h 2006-01-09 11:58:09.000000000 +0100
@@ -261,3 +261,12 @@
"mq_notify", /* 266 */
"mq_getsetattr", /* 267 */
"kexec_load", /* 268 */
+ "add_key", /* 269 */
+ "request_key", /* 270 */
+ "keyctl", /* 271 */
+ "waitid", /* 272 */
+ "ioprio_set", /* 273 */
+ "ioprio_get", /* 274 */
+ "inotify_init", /* 275 */
+ "inotify_add_watch", /* 276 */
+ "inotify_rm_watch", /* 277 */
--- ltrace-0.3.36/sysdeps/linux-gnu/i386/syscallent.h.jj 2004-11-09 13:25:16.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/i386/syscallent.h 2006-01-09 11:58:09.000000000 +0100
@@ -283,3 +283,12 @@
"mq_getsetattr", /* 282 */
"kexec_load", /* 283 */
"waitid", /* 284 */
+ "285", /* 285 */
+ "add_key", /* 286 */
+ "request_key", /* 287 */
+ "keyctl", /* 288 */
+ "ioprio_set", /* 289 */
+ "ioprio_get", /* 290 */
+ "inotify_init", /* 291 */
+ "inotify_add_watch", /* 292 */
+ "inotify_rm_watch", /* 293 */
--- ltrace-0.3.36/sysdeps/linux-gnu/sparc/syscallent.h.jj 2004-11-09 13:25:16.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/sparc/syscallent.h 2006-01-09 11:58:09.000000000 +0100
@@ -149,12 +149,12 @@
"pciconfig_read", /* 148 */
"pciconfig_write", /* 149 */
"getsockname", /* 150 */
- "151", /* 151 */
- "152", /* 152 */
+ "inotify_init", /* 151 */
+ "inotify_add_watch", /* 152 */
"poll", /* 153 */
"getdents64", /* 154 */
"fcntl64", /* 155 */
- "156", /* 156 */
+ "inotify_rm_watch", /* 156 */
"statfs", /* 157 */
"fstatfs", /* 158 */
"umount", /* 159 */
@@ -194,7 +194,7 @@
"epoll_create", /* 193 */
"epoll_ctl", /* 194 */
"epoll_wait", /* 195 */
- "196", /* 196 */
+ "ioprio_set", /* 196 */
"getppid", /* 197 */
"sigaction", /* 198 */
"sgetmask", /* 199 */
@@ -216,7 +216,7 @@
"ipc", /* 215 */
"sigreturn", /* 216 */
"clone", /* 217 */
- "218", /* 218 */
+ "ioprio_get", /* 218 */
"adjtimex", /* 219 */
"sigprocmask", /* 220 */
"create_module", /* 221 */
@@ -278,3 +278,7 @@
"mq_notify", /* 277 */
"mq_getsetattr", /* 278 */
"waitid", /* 279 */
+ "setaltroot", /* 280 */
+ "add_key", /* 281 */
+ "request_key", /* 282 */
+ "keyctl", /* 283 */
--- ltrace-0.3.36/sysdeps/linux-gnu/x86_64/syscallent.h.jj 2004-11-09 13:25:16.000000000 +0100
+++ ltrace-0.3.36/sysdeps/linux-gnu/x86_64/syscallent.h 2006-01-09 11:58:09.000000000 +0100
@@ -246,3 +246,11 @@
"mq_getsetattr", /* 245 */
"kexec_load", /* 246 */
"waitid", /* 247 */
+ "add_key", /* 248 */
+ "request_key", /* 249 */
+ "keyctl", /* 250 */
+ "ioprio_set", /* 251 */
+ "ioprio_get", /* 252 */
+ "inotify_init", /* 253 */
+ "inotify_add_watch", /* 254 */
+ "inotify_rm_watch", /* 255 */
Index: ltrace.spec
===================================================================
RCS file: /cvs/dist/rpms/ltrace/devel/ltrace.spec,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ltrace.spec 9 Dec 2005 22:41:50 -0000 1.19
+++ ltrace.spec 9 Jan 2006 14:06:43 -0000 1.20
@@ -1,13 +1,18 @@
Summary: Tracks runtime library calls from dynamically linked executables.
Name: ltrace
Version: 0.3.36
-Release: 3.1
+Release: 4
Source: ftp://ftp.debian.org/debian/pool/main/l/ltrace/ltrace_%{version}.orig.tar.gz
Patch1: ftp://ftp.debian.org/debian/pool/main/l/ltrace/ltrace_0.3.36-2.diff.gz
-Patch2: ltrace_0.3.36-biarch.patch
+Patch2: ltrace-ppc64.patch
+Patch3: ltrace-ppc64-2.patch
+Patch4: ltrace-s390x.patch
+Patch5: ltrace-syscallent-update.patch
+Patch6: ltrace-fixes.patch
+Patch7: ltrace-ia64.patch
License: GPL
Group: Development/Debuggers
-ExclusiveArch: i386 s390 ppc x86_64 alpha sparc
+ExclusiveArch: i386 x86_64 ia64 ppc ppc64 s390 s390x alpha sparc
Prefix: %{_prefix}
BuildRoot: /var/tmp/%{name}-root
BuildRequires: elfutils-libelf-devel
@@ -26,9 +31,15 @@
%setup -q
%patch1 -p1
%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
%build
-%configure
+export CC="gcc`echo $RPM_OPT_FLAGS | sed -n 's/^.*\(-m[36][124]\).*$/ \1/p'`"
+%configure CC="$CC"
make
%install
@@ -47,8 +58,9 @@
%config /etc/ltrace.conf
%changelog
-* Fri Dec 09 2005 Jesse Keating <jkeating at redhat.com>
-- rebuilt
+* Mon Jan 9 2006 Jakub Jelinek <jakub at redhat.com> 0.3.36-4
+- added ppc64 and s390x support (IBM)
+- added ia64 support (Ian Wienand)
* Sat Mar 5 2005 Jakub Jelinek <jakub at redhat.com> 0.3.36-3
- rebuilt with GCC 4
--- ltrace_0.3.36-biarch.patch DELETED ---
- Previous message (by thread): rpms/kernel/devel linux-2.6-softmac-git.patch, NONE, 1.1.2.1 linux-2.6.15-usb-find-interface.patch, NONE, 1.1.2.1 linux-2.6.15-usblp-fixes.patch, NONE, 1.1.2.1 .cvsignore, 1.313, 1.313.2.1 kernel-2.6.spec, 1.1826.2.5, 1.1826.2.6 linux-2.6-bcm43xx-resume.patch, 1.1, 1.1.2.1 linux-2.6-bcm43xx.patch, 1.1, 1.1.2.1 sources, 1.255, 1.255.2.1 linux-2.6-bcm43xx-device-table.patch, 1.1, NONE linux-2.6-bcm43xx-promisc.patch, 1.1, NONE linux-2.6-bcm43xx-quiet.patch, 1.1, NONE linux-2.6.14-ieee80211-hw-wep.patch, 1.1, NONE
- Next message (by thread): rpms/ltrace/devel ltrace.spec,1.20,1.21
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-cvs-commits
mailing list