MichelinoK wrote: > "Hinko Kocevar" <[EMAIL PROTECTED]> ha scritto nel messaggio > news:[EMAIL PROTECTED] >> MichelinoK wrote: >>> Is there a way to have a more verbose "boot" (to see where it hangs) ? >>> >>> >> Run sysinit scripts in /etc/inittab with '#!/bin/sh -x' or use strace to >> start the script. It might help if strace and/or init are both statically >> linked. >> >> HTH, >> Hinko > > 1) You mean that I must modify the sources and edit all the scripts and add > "-x"?
At least the /etc/init.d/rcS - this one is run first. > 2) How can statically link strace/init ? if /sbin/init is from busybox, correct me if I'm wrong, so all that is needed is to build busybox as static binary - there is a config option in busybox for this. strace is not in openwrt, yet. I have made a port of 4.5.8 cris patch for 4.5.15. If someone could make the openwrt package I'll provide the patch for cris architecture. To build strace statically add '-static' flag to the final link command. Regards, Hinko -- ČETRTA POT, d.o.o., Kranj Planina 3 4000 Kranj Slovenia, Europe Tel. +386 (0) 4 280 66 03 E-mail: [EMAIL PROTECTED] Http: www.cetrtapot.si
diff -urN strace-4.5.15/config.h.in strace-4.5.15.1/config.h.in --- strace-4.5.15/config.h.in 2007-01-11 23:23:56.000000000 +0100 +++ strace-4.5.15.1/config.h.in 2008-05-11 01:50:45.000000000 +0200 @@ -397,6 +397,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 -urN strace-4.5.15/configure strace-4.5.15.1/configure --- strace-4.5.15/configure 2007-01-11 23:23:33.000000000 +0100 +++ strace-4.5.15.1/configure 2008-05-11 01:58:16.000000000 +0200 @@ -2017,6 +2017,22 @@ _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 -urN strace-4.5.15/configure.ac strace-4.5.15.1/configure.ac --- strace-4.5.15/configure.ac 2007-01-11 12:37:55.000000000 +0100 +++ strace-4.5.15.1/configure.ac 2008-05-11 01:20:53.000000000 +0200 @@ -103,6 +103,14 @@ 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 -urN strace-4.5.15/process.c strace-4.5.15.1/process.c --- strace-4.5.15/process.c 2007-01-11 23:08:38.000000000 +0100 +++ strace-4.5.15.1/process.c 2008-05-11 01:32:17.000000000 +0200 @@ -548,7 +548,7 @@ # 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 @@ -704,6 +704,10 @@ 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 @@ -2882,7 +2886,77 @@ { uoff(regs.ARM_pc), "pc" }, { uoff(regs.ARM_cpsr), "cpsr" }, #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 @@ -2920,6 +2994,7 @@ #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 -urN strace-4.5.15/signal.c strace-4.5.15.1/signal.c --- strace-4.5.15/signal.c 2007-01-11 23:08:38.000000000 +0100 +++ strace-4.5.15.1/signal.c 2008-05-11 01:35:25.000000000 +0200 @@ -1445,9 +1445,38 @@ } 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 /* SPARC || SPARC64 */ #endif /* ALPHA */ diff -urN strace-4.5.15/syscall.c strace-4.5.15.1/syscall.c --- strace-4.5.15/syscall.c 2006-12-21 23:13:33.000000000 +0100 +++ strace-4.5.15.1/syscall.c 2008-05-11 01:45:42.000000000 +0200 @@ -809,6 +809,8 @@ static long r9; #elif defined(X86_64) static long rax; +#elif defined(CRISV10) || defined(CRISV32) + static long r10; #endif #endif /* LINUX */ #ifdef FREEBSD @@ -1264,7 +1266,10 @@ 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) @@ -1459,6 +1464,14 @@ 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; @@ -1623,6 +1636,17 @@ 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 */ @@ -2120,6 +2144,23 @@ 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 -urN strace-4.5.15/util.c strace-4.5.15.1/util.c --- strace-4.5.15/util.c 2007-01-11 23:08:38.000000000 +0100 +++ strace-4.5.15.1/util.c 2008-05-11 01:49:31.000000000 +0200 @@ -1069,6 +1069,12 @@ #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 */ @@ -1217,6 +1223,22 @@ 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 */ @@ -1398,6 +1420,13 @@ # 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
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel