The attached patch improves ltrace's ARM support by allowing it to
identify Thumb-2 system calls. I also posted this patch as the solution
to the relevant LaunchPad issue:

  https://bugs.launchpad.net/bugs/639796

Enjoy,
-- 
Zach Welch
CodeSourcery
[email protected]
(650) 331-3385 x743
>From 5e2645b613ee53cae2032cbc2b83db7e4337affb Mon Sep 17 00:00:00 2001
From: Zach Welch <[email protected]>
Date: Thu, 30 Sep 2010 23:56:59 +0000
Subject: [PATCH] Fix ARM syscall_p to handle Thumb-2 mode.

Identify ARM syscalls in Thumb-2 mode.  Tested on IGEP v2 board.
Fixes LP:639796.

Signed-off-by: Zach Welch <[email protected]>
---
 ChangeLog                     |    4 ++++
 sysdeps/linux-gnu/arm/trace.c |    3 ++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 49b785f..0501982 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-09-30  Zach Welch <[email protected]>
+
+	* Improve ARM syscall_p to handle Thumb-2 syscalls.
+
 2009-07-25  Juan Cespedes <[email protected]>
 
 	* New release 0.5.3
diff --git a/sysdeps/linux-gnu/arm/trace.c b/sysdeps/linux-gnu/arm/trace.c
index 10f7cc4..f68f2a9 100644
--- a/sysdeps/linux-gnu/arm/trace.c
+++ b/sysdeps/linux-gnu/arm/trace.c
@@ -49,7 +49,8 @@ syscall_p(Process *proc, int status, int *sysnum) {
 		int insn = ptrace(PTRACE_PEEKTEXT, proc->pid, pc - 4, 0);
 		int ip = ptrace(PTRACE_PEEKUSER, proc->pid, off_ip, 0);
 
-		if (insn == 0xef000000 || insn == 0x0f000000) {
+		if (insn == 0xef000000 || insn == 0x0f000000
+		    || (insn & 0xffff0000) == 0xdf000000) {
 			/* EABI syscall */
 			*sysnum = ptrace(PTRACE_PEEKUSER, proc->pid, off_r7, 0);
 		} else if ((insn & 0xfff00000) == 0xef900000) {
-- 
1.7.1

_______________________________________________
Ltrace-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/ltrace-devel

Reply via email to