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

Signed-off-by: Zachary T Welch <[email protected]>
---
 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 <[email protected]>
 
+       * Ensure Thumb mode gets set correct when updating ARM PC.
+
+2010-10-08  Zach Welch <[email protected]>
+
        * Allow ARM PLT lookups to work when containing Thumb stubs.
 
 2010-10-07  Zach Welch <[email protected]>
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


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

Reply via email to