12006-03-30 Daniel Jacobowitz <dan@codesourcery.com> 2 3 * process.c (change_syscall): Add ARM support. 4 * syscall.c (get_scno): Handle ARM EABI. 5 6Index: strace/process.c 7=================================================================== 8--- strace.orig/process.c 2006-03-30 17:36:14.000000000 -0500 9+++ strace/process.c 2006-03-30 17:44:16.000000000 -0500 10@@ -694,6 +694,16 @@ int new; 11 0x100000 | new) < 0) 12 return -1; 13 return 0; 14+#elif defined(ARM) 15+ /* Some kernels support this, some (pre-2.6.16 or so) don't. */ 16+# ifndef PTRACE_SET_SYSCALL 17+# define PTRACE_SET_SYSCALL 23 18+# endif 19+ 20+ if (ptrace (PTRACE_SET_SYSCALL, tcp->pid, 0, new) != 0) 21+ return -1; 22+ 23+ return 0; 24 #else 25 #warning Do not know how to handle change_syscall for this architecture 26 #endif /* architecture */ 27Index: strace/syscall.c 28=================================================================== 29--- strace.orig/syscall.c 2006-03-30 17:36:14.000000000 -0500 30+++ strace/syscall.c 2006-03-30 17:44:16.000000000 -0500 31@@ -1108,16 +1108,25 @@ struct tcb *tcp; 32 return 0; 33 } 34 35- if ((scno & 0x0ff00000) != 0x0f900000) { 36- fprintf(stderr, "syscall: unknown syscall trap 0x%08lx\n", 37- scno); 38- return -1; 39- } 40+ /* Handle the EABI syscall convention. We do not 41+ bother converting structures between the two 42+ ABIs, but basic functionality should work even 43+ if strace and the traced program have different 44+ ABIs. */ 45+ if (scno == 0xef000000) { 46+ scno = regs.ARM_r7; 47+ } else { 48+ if ((scno & 0x0ff00000) != 0x0f900000) { 49+ fprintf(stderr, "syscall: unknown syscall trap 0x%08lx\n", 50+ scno); 51+ return -1; 52+ } 53 54- /* 55- * Fixup the syscall number 56- */ 57- scno &= 0x000fffff; 58+ /* 59+ * Fixup the syscall number 60+ */ 61+ scno &= 0x000fffff; 62+ } 63 } 64 65 if (tcp->flags & TCB_INSYSCALL) { 66