If the pc is set to zero, the unwind is done.
Bug: 68047085
Test: Ran new unit tests, verified new unwinder does not show an
Test: extra pc zero frame for arm 32 bit processes.
Change-Id: Ic6532e56fbb786a8b7d41638abae777c2d0f1d59
diff --git a/libunwindstack/DwarfSection.cpp b/libunwindstack/DwarfSection.cpp
index 8b30b76..b8164c5 100644
--- a/libunwindstack/DwarfSection.cpp
+++ b/libunwindstack/DwarfSection.cpp
@@ -225,11 +225,13 @@
// Find the return address location.
if (return_address_undefined) {
cur_regs->set_pc(0);
- *finished = true;
} else {
cur_regs->set_pc((*cur_regs)[cie->return_address_register]);
- *finished = false;
}
+
+ // If the pc was set to zero, consider this the final frame.
+ *finished = (cur_regs->pc() == 0) ? true : false;
+
cur_regs->set_sp(cfa);
// Return false if the unwind is not finished or the cfa and pc didn't change.
return *finished || prev_cfa != cfa || prev_pc != cur_regs->pc();