From 219a6dab8995aad9ac4860cc1a84d6f3509a03a4 Mon Sep 17 00:00:00 2001 From: wbx Date: Sun, 17 May 2009 14:41:34 +0200 Subject: Initial import --- package/strace/Config.in | 11 +++ package/strace/Makefile | 26 +++++++ package/strace/ipkg/strace.control | 4 ++ package/strace/patches/patch-config_h_in | 15 ++++ package/strace/patches/patch-configure | 26 +++++++ package/strace/patches/patch-configure_ac | 18 +++++ package/strace/patches/patch-process_c | 109 ++++++++++++++++++++++++++++++ package/strace/patches/patch-signal_c | 42 ++++++++++++ package/strace/patches/patch-syscall_c | 81 ++++++++++++++++++++++ package/strace/patches/patch-util_c | 53 +++++++++++++++ 10 files changed, 385 insertions(+) create mode 100644 package/strace/Config.in create mode 100644 package/strace/Makefile create mode 100644 package/strace/ipkg/strace.control create mode 100644 package/strace/patches/patch-config_h_in create mode 100644 package/strace/patches/patch-configure create mode 100644 package/strace/patches/patch-configure_ac create mode 100644 package/strace/patches/patch-process_c create mode 100644 package/strace/patches/patch-signal_c create mode 100644 package/strace/patches/patch-syscall_c create mode 100644 package/strace/patches/patch-util_c (limited to 'package/strace') diff --git a/package/strace/Config.in b/package/strace/Config.in new file mode 100644 index 000000000..53e147d01 --- /dev/null +++ b/package/strace/Config.in @@ -0,0 +1,11 @@ +config ADK_PACKAGE_STRACE + prompt "strace............................ System call tracer" + tristate + default n + help + A useful diagnostic, instructional, and debugging tool. + Allows you to track what system calls a program makes + while it is running. + + http://sourceforge.net/projects/strace/ + diff --git a/package/strace/Makefile b/package/strace/Makefile new file mode 100644 index 000000000..6bd719cfe --- /dev/null +++ b/package/strace/Makefile @@ -0,0 +1,26 @@ +# $Id$ +#- +# This file is part of the OpenADK project. OpenADK is copyrighted +# material, please see the LICENCE file in the top-level directory. + +include ${TOPDIR}/rules.mk + +PKG_NAME:= strace +PKG_VERSION:= 4.5.18 +PKG_RELEASE:= 1 +PKG_MD5SUM:= e9449fcee97e6a8ed73934c883c870e0 +MASTER_SITES:= ${MASTER_SITE_SOURCEFORGE:=strace/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2 + +include ${TOPDIR}/mk/package.mk + +$(eval $(call PKG_template,STRACE,strace,${PKG_VERSION}-${PKG_RELEASE},${ARCH})) + +CONFIGURE_STYLE:= gnu +BUILD_STYLE:= auto + +do-install: + ${INSTALL_DIR} ${IDIR_STRACE}/usr/sbin/ + ${INSTALL_BIN} ${WRKBUILD}/${PKG_NAME} ${IDIR_STRACE}/usr/sbin/ + +include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/strace/ipkg/strace.control b/package/strace/ipkg/strace.control new file mode 100644 index 000000000..8561e55b4 --- /dev/null +++ b/package/strace/ipkg/strace.control @@ -0,0 +1,4 @@ +Package: strace +Priority: optional +Section: net +Description: System call trace program diff --git a/package/strace/patches/patch-config_h_in b/package/strace/patches/patch-config_h_in new file mode 100644 index 000000000..ea06ade61 --- /dev/null +++ b/package/strace/patches/patch-config_h_in @@ -0,0 +1,15 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- strace-4.5.18.orig/config.h.in 2008-08-28 23:36:28.000000000 +0200 ++++ strace-4.5.18/config.h.in 2009-01-02 21:24:05.414089778 +0100 +@@ -409,6 +409,11 @@ + /* Define for the AMD x86-64 architecture. */ + #undef X86_64 + ++/* Define for the CRISv10 architecture. */ ++#undef CRISV10 ++ ++/* Define for the CRISv32 architecture. */ ++#undef CRISV32 + /* Enable GNU extensions on systems that have them. */ + #ifndef _GNU_SOURCE + # undef _GNU_SOURCE diff --git a/package/strace/patches/patch-configure b/package/strace/patches/patch-configure new file mode 100644 index 000000000..eadd57304 --- /dev/null +++ b/package/strace/patches/patch-configure @@ -0,0 +1,26 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- strace-4.5.18.orig/configure 2008-08-28 23:36:06.000000000 +0200 ++++ strace-4.5.18/configure 2009-01-02 21:26:59.664979346 +0100 +@@ -2531,6 +2531,22 @@ cat >>confdefs.h <<\_ACEOF + _ACEOF + + ;; ++cris|crisv10) ++ arch=crisv10 ++ ++cat >>confdefs.h <<\_ACEOF ++#define CRISV10 1 ++_ACEOF ++ ++ ;; ++crisv32) ++ arch=crisv32 ++ ++cat >>confdefs.h <<\_ACEOF ++#define CRISV32 1 ++_ACEOF ++ ++ ;; + *) + { echo "$as_me:$LINENO: result: NO!" >&5 + echo "${ECHO_T}NO!" >&6; } diff --git a/package/strace/patches/patch-configure_ac b/package/strace/patches/patch-configure_ac new file mode 100644 index 000000000..28abf1d1a --- /dev/null +++ b/package/strace/patches/patch-configure_ac @@ -0,0 +1,18 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- strace-4.5.18.orig/configure.ac 2008-08-28 23:15:56.000000000 +0200 ++++ strace-4.5.18/configure.ac 2009-01-02 21:24:05.482095139 +0100 +@@ -103,6 +103,14 @@ x86?64*) + arch=x86_64 + AC_DEFINE([X86_64], 1, [Define for the AMD x86-64 architecture.]) + ;; ++cris|crisv10) ++ arch=crisv10 ++ AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.]) ++ ;; ++crisv32) ++ arch=crisv32 ++ AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.]) ++ ;; + *) + AC_MSG_RESULT([NO!]) + AC_MSG_ERROR([architecture $host_cpu is not supported by strace]) diff --git a/package/strace/patches/patch-process_c b/package/strace/patches/patch-process_c new file mode 100644 index 000000000..7309200d0 --- /dev/null +++ b/package/strace/patches/patch-process_c @@ -0,0 +1,109 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- strace-4.5.18.orig/process.c 2008-07-18 04:16:47.000000000 +0200 ++++ strace-4.5.18/process.c 2009-01-02 21:24:05.490094969 +0100 +@@ -584,7 +584,7 @@ extern void print_ldt_entry(); + # define ARG_PTID (known_scno(tcp) == SYS_clone2 ? 3 : 2) + # define ARG_CTID (known_scno(tcp) == SYS_clone2 ? 4 : 3) + # define ARG_TLS (known_scno(tcp) == SYS_clone2 ? 5 : 4) +-# elif defined S390 || defined S390X ++# elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32 + # define ARG_STACK 0 + # define ARG_FLAGS 1 + # define ARG_PTID 2 +@@ -740,6 +740,10 @@ int new; + 0x100000 | new) < 0) + return -1; + return 0; ++#elif defined(CRISV10) || defined(CRISV32) ++ if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*PT_R9), new) < 0) ++ return -1; ++ return 0; + #elif defined(ARM) + /* Some kernels support this, some (pre-2.6.16 or so) don't. */ + # ifndef PTRACE_SET_SYSCALL +@@ -3003,7 +3007,77 @@ const struct xlat struct_user_offsets[] + { 69, "fpcsr" }, + { 70, "fpeir" }, + #endif ++#ifdef CRISV10 ++ { 4*PT_FRAMETYPE, "4*PT_FRAMETYPE" }, ++ { 4*PT_ORIG_R10, "4*PT_ORIG_R10" }, ++ { 4*PT_R13, "4*PT_R13" }, ++ { 4*PT_R12, "4*PT_R12" }, ++ { 4*PT_R11, "4*PT_R11" }, ++ { 4*PT_R10, "4*PT_R10" }, ++ { 4*PT_R9, "4*PT_R9" }, ++ { 4*PT_R8, "4*PT_R8" }, ++ { 4*PT_R7, "4*PT_R7" }, ++ { 4*PT_R6, "4*PT_R6" }, ++ { 4*PT_R5, "4*PT_R5" }, ++ { 4*PT_R4, "4*PT_R4" }, ++ { 4*PT_R3, "4*PT_R3" }, ++ { 4*PT_R2, "4*PT_R2" }, ++ { 4*PT_R1, "4*PT_R1" }, ++ { 4*PT_R0, "4*PT_R0" }, ++ { 4*PT_MOF, "4*PT_MOF" }, ++ { 4*PT_DCCR, "4*PT_DCCR" }, ++ { 4*PT_SRP, "4*PT_SRP" }, ++ { 4*PT_IRP, "4*PT_IRP" }, ++ { 4*PT_CSRINSTR, "4*PT_CSRINSTR" }, ++ { 4*PT_CSRADDR, "4*PT_CSRADDR" }, ++ { 4*PT_CSRDATA, "4*PT_CSRDATA" }, ++ { 4*PT_USP, "4*PT_USP" }, ++#endif ++#ifdef CRISV32 ++ { 4*PT_ORIG_R10, "4*PT_ORIG_R10" }, ++ { 4*PT_R0, "4*PT_R0" }, ++ { 4*PT_R1, "4*PT_R1" }, ++ { 4*PT_R2, "4*PT_R2" }, ++ { 4*PT_R3, "4*PT_R3" }, ++ { 4*PT_R4, "4*PT_R4" }, ++ { 4*PT_R5, "4*PT_R5" }, ++ { 4*PT_R6, "4*PT_R6" }, ++ { 4*PT_R7, "4*PT_R7" }, ++ { 4*PT_R8, "4*PT_R8" }, ++ { 4*PT_R9, "4*PT_R9" }, ++ { 4*PT_R10, "4*PT_R10" }, ++ { 4*PT_R11, "4*PT_R11" }, ++ { 4*PT_R12, "4*PT_R12" }, ++ { 4*PT_R13, "4*PT_R13" }, ++ { 4*PT_ACR, "4*PT_ACR" }, ++ { 4*PT_SRS, "4*PT_SRS" }, ++ { 4*PT_MOF, "4*PT_MOF" }, ++ { 4*PT_SPC, "4*PT_SPC" }, ++ { 4*PT_CCS, "4*PT_CCS" }, ++ { 4*PT_SRP, "4*PT_SRP" }, ++ { 4*PT_ERP, "4*PT_ERP" }, ++ { 4*PT_EXS, "4*PT_EXS" }, ++ { 4*PT_EDA, "4*PT_EDA" }, ++ { 4*PT_USP, "4*PT_USP" }, ++ { 4*PT_PPC, "4*PT_PPC" }, ++ { 4*PT_BP_CTRL, "4*PT_BP_CTRL" }, ++ { 4*PT_BP+4, "4*PT_BP+4" }, ++ { 4*PT_BP+8, "4*PT_BP+8" }, ++ { 4*PT_BP+12, "4*PT_BP+12" }, ++ { 4*PT_BP+16, "4*PT_BP+16" }, ++ { 4*PT_BP+20, "4*PT_BP+20" }, ++ { 4*PT_BP+24, "4*PT_BP+24" }, ++ { 4*PT_BP+28, "4*PT_BP+28" }, ++ { 4*PT_BP+32, "4*PT_BP+32" }, ++ { 4*PT_BP+36, "4*PT_BP+36" }, ++ { 4*PT_BP+40, "4*PT_BP+40" }, ++ { 4*PT_BP+44, "4*PT_BP+44" }, ++ { 4*PT_BP+48, "4*PT_BP+48" }, ++ { 4*PT_BP+52, "4*PT_BP+52" }, ++ { 4*PT_BP+56, "4*PT_BP+56" }, ++#endif + ++#if !defined(CRISV10) && !defined(CRISV32) + #if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) + { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" }, + #endif +@@ -3041,6 +3115,7 @@ const struct xlat struct_user_offsets[] + #if defined(I386) || defined(X86_64) + { uoff(u_debugreg), "offsetof(struct user, u_debugreg)" }, + #endif /* I386 */ ++#endif /* !CRISV10/!CRISV32 */ + #endif /* !IA64 */ + #endif /* !ALPHA */ + #endif /* !POWERPC/!SPARC */ diff --git a/package/strace/patches/patch-signal_c b/package/strace/patches/patch-signal_c new file mode 100644 index 000000000..76795fbf6 --- /dev/null +++ b/package/strace/patches/patch-signal_c @@ -0,0 +1,42 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- strace-4.5.18.orig/signal.c 2008-08-20 03:59:40.000000000 +0200 ++++ strace-4.5.18/signal.c 2009-01-02 21:24:05.502094888 +0100 +@@ -1485,9 +1485,38 @@ struct tcb *tcp; + } + return 0; + #else ++#if defined(CRISV10) || defined(CRISV32) ++ struct sigcontext sc; ++ ++ if (entering(tcp)) { ++ long regs[PT_MAX+1]; ++ ++ tcp->u_arg[0] = 0; ++ ++ if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long)regs) < 0) { ++ perror("sigreturn: PTRACE_GETREGS"); ++ return 0; ++ } ++ if (umove(tcp, regs[PT_USP], &sc) < 0) ++ return 0; ++ tcp->u_arg[0] = 1; ++ tcp->u_arg[1] = sc.oldmask; ++ } else { ++ sigset_t sigm; ++ ++ long_to_sigset(tcp->u_arg[1], &sigm); ++ tcp->u_rval = tcp->u_error = 0; ++ if (tcp->u_arg[0] == 0) ++ return 0; ++ tcp->auxstr = sprintsigmask("mask now ", &sigm, 0); ++ return RVAL_NONE | RVAL_STR; ++ } ++ return 0; ++#else + #warning No sys_sigreturn() for this architecture + #warning (no problem, just a reminder :-) + return 0; ++#endif /* !CRISV10/!CRISV32 */ + #endif /* MIPS */ + #endif /* LINUX_MIPSN32 || LINUX_MIPSN64 */ + #endif /* SPARC || SPARC64 */ diff --git a/package/strace/patches/patch-syscall_c b/package/strace/patches/patch-syscall_c new file mode 100644 index 000000000..700d9be09 --- /dev/null +++ b/package/strace/patches/patch-syscall_c @@ -0,0 +1,81 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- strace-4.5.18.orig/syscall.c 2008-08-25 05:16:26.000000000 +0200 ++++ strace-4.5.18/syscall.c 2009-01-02 21:24:05.514097112 +0100 +@@ -772,6 +772,8 @@ internal_syscall(struct tcb *tcp) + static long r9; + #elif defined(X86_64) + static long rax; ++#elif defined(CRISV10) || defined(CRISV32) ++ static long r10; + #endif + #endif /* LINUX */ + #ifdef FREEBSD +@@ -1273,7 +1275,10 @@ struct tcb *tcp; + return 0; + } + } +-#endif /* SH64 */ ++#elif defined(CRISV10) || defined(CRISV32) ++ if (upeek(pid, 4*PT_R9, &scno) < 0) ++ return -1; ++#endif /* CRISV10/CRISV32 */ + #endif /* LINUX */ + #ifdef SUNOS4 + if (upeek(pid, uoff(u_arg[7]), &scno) < 0) +@@ -1468,6 +1473,14 @@ struct tcb *tcp; + fprintf(stderr, "stray syscall exit: r8 = %ld\n", r8); + return 0; + } ++#elif defined(CRISV10) || defined(CRISV32) ++ if (upeek(pid, 4*PT_R10, &r10) < 0) ++ return -1; ++ if (r10 != -ENOSYS && !(tcp->flags & TCB_INSYSCALL)) { ++ if (debug) ++ fprintf(stderr, "stray syscall exit: r10 = %ld\n", r10); ++ return 0; ++ } + #endif + #endif /* LINUX */ + return 1; +@@ -1649,6 +1662,17 @@ struct tcb *tcp; + tcp->u_rval = r9; + u_error = 0; + } ++#else ++#if defined(CRISV10) || defined(CRISV32) ++ if (r10 && (unsigned) -r10 < nerrnos) { ++ tcp->u_rval = -1; ++ u_error = -r10; ++ } ++ else { ++ tcp->u_rval = r10; ++ u_error = 0; ++ } ++#endif /* CRISV10/CRISV32 */ + #endif /* SH64 */ + #endif /* SH */ + #endif /* HPPA */ +@@ -2169,6 +2193,23 @@ struct tcb *tcp; + return -1; + } + } ++#elif defined(CRISV10) || defined(CRISV32) ++ { ++ int i; ++ static const int crisregs[] = { ++ 4*PT_ORIG_R10, 4*PT_R11, 4*PT_R12, ++ 4*PT_R13, 4*PT_MOF, 4*PT_SRP ++ }; ++ ++ if (tcp->scno >= 0 && tcp->scno < nsyscalls) ++ tcp->u_nargs = sysent[tcp->scno].nargs; ++ else ++ tcp->u_nargs = 0; ++ for (i = 0; i < tcp->u_nargs; i++) { ++ if (upeek(pid, crisregs[i], &tcp->u_arg[i]) < 0) ++ return -1; ++ } ++ } + #else /* Other architecture (like i386) (32bits specific) */ + { + int i; diff --git a/package/strace/patches/patch-util_c b/package/strace/patches/patch-util_c new file mode 100644 index 000000000..17112f30e --- /dev/null +++ b/package/strace/patches/patch-util_c @@ -0,0 +1,53 @@ +$Id: update-patches 24 2008-08-31 14:56:13Z wbx $ +--- strace-4.5.18.orig/util.c 2008-08-19 06:47:51.000000000 +0200 ++++ strace-4.5.18/util.c 2009-01-02 21:24:05.530098238 +0100 +@@ -1097,6 +1097,12 @@ struct tcb *tcp; + #elif defined(SH64) + if (upeek(tcp->pid, REG_PC ,&pc) < 0) + return -1; ++#elif defined(CRISV10) ++ if (upeek(tcp->pid, 4*PT_IRP, &pc) < 0) ++ return -1; ++#elif defined(CRISV32) ++ if (upeek(tcp->pid, 4*PT_ERP, &pc) < 0) ++ return -1; + #endif + return pc; + #endif /* LINUX */ +@@ -1245,6 +1251,22 @@ struct tcb *tcp; + return; + } + tprintf("[%08lx] ", pc); ++#elif defined(CRISV10) ++ long pc; ++ ++ if (upeek(tcp->pid, 4*PT_IRP, &pc) < 0) { ++ PRINTBADPC; ++ return; ++ } ++ tprintf("[%08lx] ", (unsigned long)pc); ++#elif defined(CRISV32) ++ long pc; ++ ++ if (upeek(tcp->pid, 4*PT_ERP, &pc) < 0) { ++ PRINTBADPC; ++ return; ++ } ++ tprintf("[%08lx] ", (unsigned long)pc); + #endif /* !architecture */ + #endif /* LINUX */ + +@@ -1444,6 +1466,13 @@ typedef struct regs arg_setup_state; + # define arg0_offset (REG_OFFSET+16) + # define arg1_offset (REG_OFFSET+24) + # define restore_arg0(tcp, state, val) 0 ++# elif defined CRISV10 || defined CRISV32 ++# define arg0_offset (4*PT_R11) ++# define arg1_offset (4*PT_ORIG_R10) ++# define restore_arg0(tcp, state, val) 0 ++# define restore_arg1(tcp, state, val) 0 ++# define arg0_index 1 ++# define arg1_index 0 + # else + # define arg0_offset 0 + # define arg1_offset 4 -- cgit v1.2.3