static CORE_ADDR
aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR func_addr, limit_pc;
+ CORE_ADDR func_addr, func_end_addr, limit_pc;
/* See if we can determine the end of the prologue via the symbol
table. If so, then return either PC, or the PC after the
prologue, whichever is greater. */
- if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
+ bool func_addr_found
+ = find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr);
+
+ if (func_addr_found)
{
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (limit_pc == 0)
limit_pc = pc + 128; /* Magic. */
+ limit_pc
+ = func_end_addr == 0? limit_pc : std::min (limit_pc, func_end_addr - 4);
+
/* Try disassembling prologue. */
return aarch64_analyze_prologue (gdbarch, pc, limit_pc, NULL);
}
static CORE_ADDR
arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR func_addr, limit_pc;
+ CORE_ADDR func_addr, func_end_addr, limit_pc;
/* See if we can determine the end of the prologue via the symbol table.
If so, then return either PC, or the PC after the prologue, whichever
is greater. */
- if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
+ bool func_addr_found
+ = find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr);
+
+ /* Whether the function is thumb mode or not. */
+ bool func_is_thumb = false;
+
+ if (func_addr_found)
{
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
associate prologue code with the opening brace; so this
lets us skip the first line if we think it is the opening
brace. */
- if (arm_pc_is_thumb (gdbarch, func_addr))
+ func_is_thumb = arm_pc_is_thumb (gdbarch, func_addr);
+ if (func_is_thumb)
analyzed_limit = thumb_analyze_prologue (gdbarch, func_addr,
post_prologue_pc, NULL);
else
if (limit_pc == 0)
limit_pc = pc + 64; /* Magic. */
+ /* Set the correct adjustment based on whether the function is thumb mode or
+ not. We use it to get the address of the last instruction in the
+ function (as opposed to the first address of the next function). */
+ CORE_ADDR adjustment = func_is_thumb? 2 : 4;
+
+ limit_pc
+ = func_end_addr == 0? limit_pc : std::min (limit_pc,
+ func_end_addr - adjustment);
/* Check if this is Thumb code. */
if (arm_pc_is_thumb (gdbarch, pc))
return
}
-# Get the "foo_label" address.
+# Get the "bar_label" address.
-set foo_label_addr ""
-gdb_test_multiple "print /x &foo_label" "" {
+set bar_label_addr ""
+gdb_test_multiple "print /x &bar_label" "" {
-re -wrap "= ($hex)" {
- set foo_label_addr $expect_out(1,string)
+ set bar_label_addr $expect_out(1,string)
pass $gdb_test_name
}
}
-if { $foo_label_addr == "" } {
+if { $bar_label_addr == "" } {
return
}
# Check that the breakpoint is set at the expected address. Regression test
# for PR30369.
-gdb_assert { $break_addr == $foo_label_addr }
+gdb_assert { $break_addr < $bar_label_addr }