]> granicus.if.org Git - strace/commitdiff
2006-03-30 Daniel Jacobowitz <dan@codesourcery.com>
authorRoland McGrath <roland@redhat.com>
Tue, 25 Apr 2006 07:34:41 +0000 (07:34 +0000)
committerRoland McGrath <roland@redhat.com>
Tue, 25 Apr 2006 07:34:41 +0000 (07:34 +0000)
* process.c (change_syscall): Add ARM support.
* syscall.c (get_scno): Handle ARM EABI.
Fixes Debian#360152.

process.c
syscall.c

index 0b34ae61dc862c39310b2d56c772ef60ee78900f..1e03ff5ccd642365c36697a4978c958bff887c26 100644 (file)
--- a/process.c
+++ b/process.c
@@ -694,6 +694,16 @@ int new;
                                    0x100000 | 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
+#  define PTRACE_SET_SYSCALL 23
+# endif
+
+       if (ptrace (PTRACE_SET_SYSCALL, tcp->pid, 0, new) != 0)
+               return -1;
+
+       return 0;
 #else
 #warning Do not know how to handle change_syscall for this architecture
 #endif /* architecture */
index 22893a790fd5f9723fc1f7e9a2333bdbcb7f089f..2e5053a4f600facca94914622e969e11139b7c58 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -1108,16 +1108,25 @@ struct tcb *tcp;
                                return 0;
                        }
 
-                       if ((scno & 0x0ff00000) != 0x0f900000) {
-                               fprintf(stderr, "syscall: unknown syscall trap 0x%08lx\n",
-                                       scno);
-                               return -1;
-                       }
+                       /* Handle the EABI syscall convention.  We do not
+                          bother converting structures between the two
+                          ABIs, but basic functionality should work even
+                          if strace and the traced program have different
+                          ABIs.  */
+                       if (scno == 0xef000000) {
+                               scno = regs.ARM_r7;
+                       } else {
+                               if ((scno & 0x0ff00000) != 0x0f900000) {
+                                       fprintf(stderr, "syscall: unknown syscall trap 0x%08lx\n",
+                                               scno);
+                                       return -1;
+                               }
 
-                       /*
-                        * Fixup the syscall number
-                        */
-                       scno &= 0x000fffff;
+                               /*
+                                * Fixup the syscall number
+                                */
+                               scno &= 0x000fffff;
+                       }
                }
 
                if (tcp->flags & TCB_INSYSCALL) {