am 4868ff1a: Fix aarch64 handling of error code.
* commit '4868ff1ab2b82a52a1abb48bcf6dcbf795d3c4db':
Fix aarch64 handling of error code.
diff --git a/src/aarch64/Gis_signal_frame.c b/src/aarch64/Gis_signal_frame.c
index 0a79842..d1ba021 100644
--- a/src/aarch64/Gis_signal_frame.c
+++ b/src/aarch64/Gis_signal_frame.c
@@ -54,7 +54,9 @@
ret = (*a->access_mem) (as, ip, &w0, 0, arg);
if (ret < 0)
- return ret;
+ /* ANDROID support update. */
+ return 0;
+ /* End ANDROID update. */
/* FIXME: distinguish 32bit insn vs 64bit registers. */
if (w0 != 0xd4000001d2801168)
diff --git a/src/aarch64/Gstep.c b/src/aarch64/Gstep.c
index 8a517fd..fd1159d 100644
--- a/src/aarch64/Gstep.c
+++ b/src/aarch64/Gstep.c
@@ -107,17 +107,41 @@
unw_step (unw_cursor_t *cursor)
{
struct cursor *c = (struct cursor *) cursor;
- int ret;
+ int ret = -UNW_ENOINFO;
Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx))\n",
c, c->dwarf.ip, c->dwarf.cfa);
/* Check if this is a signal frame. */
if (unw_is_signal_frame (cursor))
- return unw_handle_signal_frame (cursor);
+ /* ANDROID support update. */
+ ret = unw_handle_signal_frame (cursor);
+ /* End ANDROID update. */
- ret = dwarf_step (&c->dwarf);
- Debug(1, "dwarf_step()=%d\n", ret);
+ /* ANDROID support update. */
+ if (ret < 0)
+ {
+ ret = dwarf_step (&c->dwarf);
+ Debug(1, "dwarf_step()=%d\n", ret);
+ }
+
+ if (ret < 0 && c->dwarf.frame == 0)
+ {
+ /* If this is the first frame, the code may be executing garbage
+ * in the middle of nowhere. In this case, try using the lr as
+ * the pc.
+ */
+ unw_word_t lr;
+ if (dwarf_get(&c->dwarf, c->dwarf.loc[UNW_AARCH64_X30], &lr) >= 0)
+ {
+ if (lr != c->dwarf.ip)
+ {
+ ret = 1;
+ c->dwarf.ip = lr;
+ }
+ }
+ }
+ /* End ANDROID update. */
if (ret >= 0)
{
diff --git a/src/arm/Gis_signal_frame.c b/src/arm/Gis_signal_frame.c
index e8efe7f..4126de9 100644
--- a/src/arm/Gis_signal_frame.c
+++ b/src/arm/Gis_signal_frame.c
@@ -66,7 +66,9 @@
ip = c->dwarf.ip;
if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0)
- return ret;
+ /* ANDROID support update. */
+ return 0;
+ /* End ANDROID update. */
/* Return 1 if the IP points to a non-RT sigreturn sequence. */
if (w0 == MOV_R7_SIGRETURN || w0 == ARM_SIGRETURN || w0 == THUMB_SIGRETURN)