Always set the sp reg to the cfa for DWARF.
There are a few places where it is assumed that this register is
set to the cfa value when interpreting DWARF information.
Add a testcase for unwinding art_quick_osr_stub on ARM.
Bug: 73954823
Test: Ran libunwindstack/libbacktrace unit tests.
Test: Random debuggerd -b of process on a hikey.
Test: Ran the 137 art test on host.
Change-Id: Ida6ccdc38c3cfeea6b57fe861a0cc127b150b790
diff --git a/libunwindstack/DwarfSection.cpp b/libunwindstack/DwarfSection.cpp
index ddbc12e..5586e72 100644
--- a/libunwindstack/DwarfSection.cpp
+++ b/libunwindstack/DwarfSection.cpp
@@ -190,8 +190,6 @@
// Always set the dex pc to zero when evaluating.
cur_regs->set_dex_pc(0);
- AddressType prev_cfa = regs->sp();
-
EvalInfo<AddressType> eval_info{.loc_regs = &loc_regs,
.cie = cie,
.regular_memory = regular_memory,
@@ -204,14 +202,7 @@
last_error_.code = DWARF_ERROR_ILLEGAL_VALUE;
return false;
}
- // If the stack pointer register is the CFA, and the stack
- // pointer register does not have any associated location
- // information, use the current cfa value.
- if (regs->sp_reg() == loc->values[0] && loc_regs.count(regs->sp_reg()) == 0) {
- eval_info.cfa = prev_cfa;
- } else {
- eval_info.cfa = (*cur_regs)[loc->values[0]];
- }
+ eval_info.cfa = (*cur_regs)[loc->values[0]];
eval_info.cfa += loc->values[1];
break;
case DWARF_LOCATION_VAL_EXPRESSION: {