[Ltrace-devel] [PATCH 4/4] Ensure ARM PC sets Thumb mode.

Zachary T Welch zwelch at codesourcery.com
Fri Oct 8 18:47:51 UTC 2010


The low bit of the PC must contain the Thumb mode state.

Signed-off-by: Zachary T Welch <zwelch at codesourcery.com>
---
 ChangeLog                    |    4 ++++
 sysdeps/linux-gnu/arm/regs.c |    3 ++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 526e5f2..af159fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-10-08  Zach Welch <zwelch at codesourcery.com>
 
+	* Ensure Thumb mode gets set correct when updating ARM PC.
+
+2010-10-08  Zach Welch <zwelch at codesourcery.com>
+
 	* Allow ARM PLT lookups to work when containing Thumb stubs.
 
 2010-10-07  Zach Welch <zwelch at codesourcery.com>
diff --git a/sysdeps/linux-gnu/arm/regs.c b/sysdeps/linux-gnu/arm/regs.c
index 2488b0a..b8aed6e 100644
--- a/sysdeps/linux-gnu/arm/regs.c
+++ b/sysdeps/linux-gnu/arm/regs.c
@@ -47,5 +47,6 @@ get_return_addr(Process *proc, void *stack_pointer) {
 
 void
 set_return_addr(Process *proc, void *addr) {
-	ptrace(PTRACE_POKEUSER, proc->pid, off_lr, addr);
+	long iaddr = (int)addr | proc->thumb_mode;
+	ptrace(PTRACE_POKEUSER, proc->pid, off_lr, (void *)iaddr);
 }
-- 
1.7.2.2




More information about the Ltrace-devel mailing list