path: root/src/pal/src/exception/seh-unwind.cpp
diff options
authorMyungJoo Ham <>2016-03-02 21:27:00 +0900
committerMyungJoo Ham <>2016-03-04 14:28:35 +0900
commitb15c9d4f8a2bdad6dc7ecc03df037783e31d7d0c (patch)
tree74ca902157851a30265e137c55ec72a9a71ddade /src/pal/src/exception/seh-unwind.cpp
parent3c0d5e85c59107a4710317f445bec0528cbe232b (diff)
Fix PAL_VirtualUnwind Behavior with Clutters in PC
Libunwind-ARM recommends to read LR to get value of PC while unwinding stack, which often causes the caller (PAL_VirtualUnwind) to have LSB of PC set. Such behavior incurs errornous behavior of PAL_VirtualUnwind if the output is fed back to PAL_VirtualUnwind as the input, which is observed with VirtualUnwindToFirstManagedCallFrame(). This commit clears LSB of PC in WinContext to prevent it. Note that this is a partial fix for the issue #3462. (this does not fix assembly stacks) Fix #3462 Signed-off-by: MyungJoo Ham <>
Diffstat (limited to 'src/pal/src/exception/seh-unwind.cpp')
1 files changed, 1 insertions, 0 deletions
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index ea17cce29e..333544379a 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -138,6 +138,7 @@ static void UnwindContextToWinContext(unw_cursor_t *cursor, CONTEXT *winContext)
#elif defined(_ARM_)
unw_get_reg(cursor, UNW_REG_SP, (unw_word_t *) &winContext->Sp);
unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->Pc);
+ winContext->Pc &= ~0x1;
unw_get_reg(cursor, UNW_ARM_R14, (unw_word_t *) &winContext->Lr);
unw_get_reg(cursor, UNW_ARM_R4, (unw_word_t *) &winContext->R4);
unw_get_reg(cursor, UNW_ARM_R5, (unw_word_t *) &winContext->R5);