+2006-04-24 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * arm-tdep.c (thumb_heuristic_function_start): New function.
+ (thumb_scan_prologue): Use it.
+ (arm_prologue_this_id): Adjust LOWEST_PC check.
+
2006-04-19 Daniel Jacobowitz <dan@codesourcery.com>
Merge from gdb-csl-20060226-branch:
return skip_pc; /* End of prologue */
}
+/* Attempt to find the start of the function containing PREV_PC, and
+ store it in *PROLOGUE_START. Returns 1 if found, 0 if not. */
+
+static int
+thumb_heuristic_function_start (CORE_ADDR prev_pc, CORE_ADDR *prologue_start)
+{
+ unsigned short insn;
+
+ /* Right now, we only support a very simple case: if this is a push
+ instruction that pushes lr, then we are probably at the very start
+ of a function. */
+ insn = read_memory_unsigned_integer (prev_pc, 2);
+ if ((insn & 0xff00) == 0xb500)
+ {
+ *prologue_start = prev_pc;
+ return 1;
+ }
+
+ return 0;
+}
+
/* *INDENT-OFF* */
/* Function: thumb_scan_prologue (helper function for arm_scan_prologue)
This function decodes a Thumb function prologue to determine:
prologue_end = prev_pc;
else if (sal.end < prologue_end) /* next line begins after fn end */
prologue_end = sal.end; /* (probably means no prologue) */
+
+ prologue_end = min (prologue_end, prev_pc);
}
+ else if (thumb_heuristic_function_start (prev_pc, &prologue_start))
+ /* We think we found it! */
+ prologue_end = prev_pc;
else
/* We're in the boondocks: we have no idea where the start of the
function is. */
return;
- prologue_end = min (prologue_end, prev_pc);
-
thumb_analyze_prologue (current_gdbarch, prologue_start, prologue_end,
cache);
}
func = frame_func_unwind (next_frame);
/* This is meant to halt the backtrace at "_start". Make sure we
- don't halt it at a generic dummy frame. */
- if (func <= LOWEST_PC)
+ don't halt it just because we don't have a symbol table; so
+ we use the PC, not the (possibly unknown) function start. */
+ if (frame_pc_unwind (next_frame) <= LOWEST_PC)
return;
/* If we've hit a wall, stop. */