Support unwinding though the switch interpreter.
Wrap the switch interpreter in small assembly method which defines
DEX PC in CFI and thus it allows libunwind to backtrace through it.
Bug: 22414682
Test: testrunner.py --host -t 137
Test: testrunner.py --target -t 137
Change-Id: I31dad9f0fb446151baaa99234b64f25c8ca2fa87
diff --git a/runtime/arch/arm64/quick_entrypoints_arm64.S b/runtime/arch/arm64/quick_entrypoints_arm64.S
index 375b050..fb449ed 100644
--- a/runtime/arch/arm64/quick_entrypoints_arm64.S
+++ b/runtime/arch/arm64/quick_entrypoints_arm64.S
@@ -15,6 +15,7 @@
*/
#include "asm_support_arm64.S"
+#include "interpreter/cfi_asm_support.h"
#include "arch/quick_alloc_entrypoints.S"
@@ -2928,3 +2929,16 @@
.text
END art_quick_invoke_polymorphic
+
+// Wrap ExecuteSwitchImpl in assembly method which specifies DEX PC for unwinding.
+// Argument 0: x0: The context pointer for ExecuteSwitchImpl.
+// Argument 1: x1: Pointer to the templated ExecuteSwitchImpl to call.
+// Argument 2: x2: The value of DEX PC (memory address of the methods bytecode).
+ENTRY ExecuteSwitchImplAsm
+ SAVE_TWO_REGS_INCREASE_FRAME x19, xLR, 16
+ mov x19, x2 // x19 = DEX PC
+ CFI_DEFINE_DEX_PC_WITH_OFFSET(0 /* x0 */, 19 /* x19 */, 0)
+ blr x1 // Call the wrapped method.
+ RESTORE_TWO_REGS_DECREASE_FRAME x19, xLR, 16
+ ret
+END ExecuteSwitchImplAsm