@@ -841,33 +841,22 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
static CORE_ADDR
aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- unsigned long inst;
- CORE_ADDR skip_pc;
- CORE_ADDR func_addr, limit_pc;
- struct symtab_and_line sal;
+ CORE_ADDR limit_pc;
+ CORE_ADDR post_prologue_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))
- {
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
-
- if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
/* Can't determine prologue from the symbol table, need to examine
instructions. */
- /* Find an upper limit on the function prologue using the debug
- information. If the debug information could not be used to
- provide that bound, then use an arbitrary large number as the
- upper bound. */
- limit_pc = skip_prologue_using_sal (gdbarch, pc);
- if (limit_pc == 0)
- limit_pc = pc + 128; /* Magic. */
+ /* Use an arbitrary large number as the upper bound. */
+ limit_pc = pc + 128; /* Magic. */
+ /* FIXME: could do what rs6000-tdep.c does here */
/* Try disassembling prologue. */
return aarch64_analyze_prologue (gdbarch, pc, limit_pc, NULL);
@@ -2359,21 +2359,19 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
struct amd64_frame_cache cache;
CORE_ADDR pc;
- CORE_ADDR func_addr;
+ CORE_ADDR post_prologue_pc;
- if (find_pc_partial_function (start_pc, NULL, &func_addr, NULL))
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, start_pc);
+ if (post_prologue_pc != 0)
{
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
- struct symtab *s = find_pc_symtab (func_addr);
+ struct symtab *s = find_pc_symtab (start_pc);
/* Clang always emits a line note before the prologue and another
one after. We trust clang to emit usable line notes. */
- if (post_prologue_pc
- && (s != NULL
- && s->producer != NULL
- && strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0))
- return max (start_pc, post_prologue_pc);
+ if (s != NULL
+ && s->producer != NULL
+ && strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0)
+ return max (start_pc, post_prologue_pc);
}
amd64_init_frame_cache (&cache);
@@ -1095,9 +1095,9 @@ static const struct frame_unwind amd64_windows_frame_unwind =
static CORE_ADDR
amd64_windows_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR func_addr;
CORE_ADDR unwind_info = 0;
CORE_ADDR image_base, start_rva, end_rva;
+ CORE_ADDR post_prologue_pc;
struct external_pex64_unwind_info ex_ui;
/* Use prologue size from unwind info. */
@@ -1118,14 +1118,9 @@ amd64_windows_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* See if we can determine the end of the prologue via the symbol
table. If so, then return either the PC, or the PC after
the prologue, whichever is greater. */
- if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
- {
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
-
- if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
return pc;
}
@@ -1384,22 +1384,16 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
unsigned long inst;
- CORE_ADDR skip_pc;
- CORE_ADDR func_addr, limit_pc;
+ CORE_ADDR skip_pc, limit_pc, post_prologue_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))
+ /* See if we can determine the end of the prologue via the symbol table. */
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
{
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
- struct symtab *s = find_pc_symtab (func_addr);
-
- if (post_prologue_pc)
- post_prologue_pc
- = arm_skip_stack_protector (post_prologue_pc, gdbarch);
+ struct symtab *s = find_pc_symtab (pc);
+ CORE_ADDR analyzed_limit;
+ post_prologue_pc = arm_skip_stack_protector (post_prologue_pc, gdbarch);
/* GCC always emits a line note before the prologue and another
one after, even if the two are at the same address or on the
@@ -1407,38 +1401,32 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
know every instruction that might appear in the prologue. We
will have producer information for most binaries; if it is
missing (e.g. for -gstabs), assuming the GNU tools. */
- if (post_prologue_pc
- && (s == NULL
- || s->producer == NULL
- || strncmp (s->producer, "GNU ", sizeof ("GNU ") - 1) == 0
- || strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0))
+ if (s == NULL
+ || s->producer == NULL
+ || strncmp (s->producer, "GNU ", sizeof ("GNU ") - 1) == 0
+ || strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0)
return post_prologue_pc;
- if (post_prologue_pc != 0)
- {
- CORE_ADDR analyzed_limit;
-
- /* For non-GCC compilers, make sure the entire line is an
- acceptable prologue; GDB will round this function's
- return value up to the end of the following line so we
- can not skip just part of a line (and we do not want to).
+ /* For non-GCC compilers, make sure the entire line is an
+ acceptable prologue; GDB will round this function's
+ return value up to the end of the following line so we
+ can not skip just part of a line (and we do not want to).
- RealView does not treat the prologue specially, but does
- 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))
- analyzed_limit = thumb_analyze_prologue (gdbarch, func_addr,
- post_prologue_pc, NULL);
- else
- analyzed_limit = arm_analyze_prologue (gdbarch, func_addr,
- post_prologue_pc, NULL);
+ RealView does not treat the prologue specially, but does
+ 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, pc))
+ analyzed_limit = thumb_analyze_prologue (gdbarch, pc,
+ post_prologue_pc, NULL);
+ else
+ analyzed_limit = arm_analyze_prologue (gdbarch, pc,
+ post_prologue_pc, NULL);
- if (analyzed_limit != post_prologue_pc)
- return func_addr;
+ if (analyzed_limit != post_prologue_pc)
+ return pc;
- return post_prologue_pc;
- }
+ return post_prologue_pc;
}
/* Can't determine prologue from the symbol table, need to examine
@@ -874,15 +874,14 @@ avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
CORE_ADDR func_addr, func_end;
CORE_ADDR post_prologue_pc;
- /* See what the symbol table says */
+ /* See what the symbol table says. */
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
return pc;
- post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
- if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
-
{
CORE_ADDR prologue_end = pc;
struct avr_unwind_cache info = {0};
@@ -1812,20 +1812,18 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
CORE_ADDR pc;
gdb_byte op;
int i;
- CORE_ADDR func_addr;
+ CORE_ADDR post_prologue_pc;
- if (find_pc_partial_function (start_pc, NULL, &func_addr, NULL))
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, start_pc);
+ if (post_prologue_pc != 0)
{
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
- struct symtab *s = find_pc_symtab (func_addr);
+ struct symtab *s = find_pc_symtab (start_pc);
/* Clang always emits a line note before the prologue and another
one after. We trust clang to emit usable line notes. */
- if (post_prologue_pc
- && (s != NULL
- && s->producer != NULL
- && strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0))
+ if (s != NULL
+ && s->producer != NULL
+ && strncmp (s->producer, "clang ", sizeof ("clang ") - 1) == 0)
return max (start_pc, post_prologue_pc);
}
@@ -185,20 +185,16 @@ lm32_analyze_prologue (struct gdbarch *gdbarch,
static CORE_ADDR
lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR func_addr, limit_pc;
+ CORE_ADDR post_prologue_pc, limit_pc;
struct lm32_frame_cache frame_info;
struct trad_frame_saved_reg saved_regs[SIM_LM32_NUM_REGS];
/* 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))
- {
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
- if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
/* Can't determine prologue from the symbol table, need to examine
instructions. */
@@ -206,9 +202,8 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Find an upper limit on the function prologue using the debug
information. If the debug information could not be used to provide
that bound, then use an arbitrary large number as the upper bound. */
- limit_pc = skip_prologue_using_sal (gdbarch, pc);
- if (limit_pc == 0)
- limit_pc = pc + 100; /* Magic. */
+ limit_pc = pc + 100; /* Magic. */
+ /* FIXME: could do what rs6000-tdep.c does here */
frame_info.saved_regs = saved_regs;
return lm32_analyze_prologue (gdbarch, pc, limit_pc, &frame_info);
@@ -6398,18 +6398,14 @@ static CORE_ADDR
mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
CORE_ADDR limit_pc;
- CORE_ADDR func_addr;
+ CORE_ADDR post_prologue_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))
- {
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
- if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
/* Can't determine prologue from the symbol table, need to examine
instructions. */
@@ -6417,9 +6413,8 @@ mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Find an upper limit on the function prologue using the debug
information. If the debug information could not be used to provide
that bound, then use an arbitrary large number as the upper bound. */
- limit_pc = skip_prologue_using_sal (gdbarch, pc);
- if (limit_pc == 0)
- limit_pc = pc + 100; /* Magic. */
+ limit_pc = pc + 100; /* Magic. */
+ /* FIXME: could do what rs6000-tdep.c does here */
if (mips_pc_is_mips16 (gdbarch, pc))
return mips16_scan_prologue (gdbarch, pc, limit_pc, NULL, NULL);
@@ -215,49 +215,43 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
static CORE_ADDR
moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
- CORE_ADDR func_addr = 0, func_end = 0;
+ CORE_ADDR func_addr, func_end;
+ CORE_ADDR post_prologue_pc;
const char *func_name;
/* 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. */
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
+
if (find_pc_partial_function (pc, &func_name, &func_addr, &func_end))
{
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
- if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
- else
+ /* Can't determine prologue from the symbol table, need to examine
+ instructions. */
+ struct symtab_and_line sal;
+ struct symbol *sym;
+ struct moxie_frame_cache cache;
+ CORE_ADDR plg_end;
+
+ memset (&cache, 0, sizeof cache);
+
+ plg_end = moxie_analyze_prologue (func_addr, func_end, &cache, gdbarch);
+ /* Found a function. */
+ sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
+ /* Don't use line number debug info for assembly source files. */
+ if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
{
- /* Can't determine prologue from the symbol table, need to examine
- instructions. */
- struct symtab_and_line sal;
- struct symbol *sym;
- struct moxie_frame_cache cache;
- CORE_ADDR plg_end;
-
- memset (&cache, 0, sizeof cache);
-
- plg_end = moxie_analyze_prologue (func_addr,
- func_end, &cache, gdbarch);
- /* Found a function. */
- sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL);
- /* Don't use line number debug info for assembly source
- files. */
- if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
+ sal = find_pc_line (func_addr, 0);
+ if (sal.end && sal.end < func_end)
{
- sal = find_pc_line (func_addr, 0);
- if (sal.end && sal.end < func_end)
- {
- /* Found a line number, use it as end of
- prologue. */
- return sal.end;
- }
+ /* Found a line number, use it as end of prologue. */
+ return sal.end;
}
- /* No useable line symbol. Use result of prologue parsing
- method. */
- return plg_end;
}
+ /* No useable line symbol. Use result of prologue parsing method. */
+ return plg_end;
}
/* No function symbol -- just return the PC. */
@@ -945,20 +945,15 @@ nios2_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
CORE_ADDR limit_pc;
CORE_ADDR func_addr;
-
+ CORE_ADDR post_prologue_pc;
struct nios2_unwind_cache cache;
/* 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 (start_pc, NULL, &func_addr, NULL))
- {
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
-
- if (post_prologue_pc != 0)
- return max (start_pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, start_pc);
+ if (post_prologue_pc != 0)
+ return max (start_pc, post_prologue_pc);
/* Prologue analysis does the rest.... */
nios2_init_cache (&cache, start_pc);
@@ -2108,33 +2108,29 @@ static CORE_ADDR
rs6000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
struct rs6000_framedata frame;
- CORE_ADDR limit_pc, func_addr, func_end_addr = 0;
+ CORE_ADDR limit_pc, func_addr, func_end_addr;
+ CORE_ADDR post_prologue_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, &func_end_addr))
- {
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
- if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
/* Can't determine prologue from the symbol table, need to examine
instructions. */
- /* Find an upper limit on the function prologue using the debug
- information. If the debug information could not be used to provide
- that bound, then use an arbitrary large number as the upper bound. */
- limit_pc = skip_prologue_using_sal (gdbarch, pc);
- if (limit_pc == 0)
- limit_pc = pc + 100; /* Magic. */
+ /* Use an arbitrary large number as the upper bound. */
+ limit_pc = pc + 100; /* Magic. */
/* Do not allow limit_pc to be past the function end, if we know
where that end is... */
- if (func_end_addr && limit_pc > func_end_addr)
- limit_pc = func_end_addr;
+ if (find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr))
+ {
+ if (func_end_addr && limit_pc > func_end_addr)
+ limit_pc = func_end_addr;
+ }
pc = skip_prologue (gdbarch, pc, limit_pc, &frame);
return pc;
@@ -724,12 +724,9 @@ sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR 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, &func_end_addr))
- {
- post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
- if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, pc);
+ if (post_prologue_pc != 0)
+ return max (pc, post_prologue_pc);
/* Can't determine prologue from the symbol table, need to examine
instructions. */
@@ -737,15 +734,16 @@ sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Find an upper limit on the function prologue using the debug
information. If the debug information could not be used to provide
that bound, then use an arbitrary large number as the upper bound. */
- limit_pc = skip_prologue_using_sal (gdbarch, pc);
- if (limit_pc == 0)
- /* Don't go any further than 28 instructions. */
- limit_pc = pc + (2 * 28);
+ /* Don't go any further than 28 instructions. */
+ limit_pc = pc + (2 * 28);
/* Do not allow limit_pc to be past the function end, if we know
where that end is... */
- if (func_end_addr != 0)
- limit_pc = min (limit_pc, func_end_addr);
+ if (find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr))
+ {
+ if (func_end_addr && limit_pc > func_end_addr)
+ limit_pc = func_end_addr;
+ }
cache.sp_offset = -4;
post_prologue_pc = sh_analyze_prologue (gdbarch, pc, limit_pc, &cache, 0);
@@ -3107,7 +3107,7 @@ in_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR func_start)
return func_addr <= pc && pc < sal.end;
}
-/* Given PC at the function's start address, attempt to find the
+/* Given FUNC_ADDR, the function's start address, attempt to find the
prologue end using SAL information. Return zero if the skip fails.
A non-optimized prologue traditionally has one SAL for the function
@@ -3133,7 +3133,8 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
const struct block *bl;
/* Get an initial range for the function. */
- find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc);
+ if (!find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc))
+ return 0;
start_pc += gdbarch_deprecated_function_start_offset (gdbarch);
prologue_sal = find_pc_line (start_pc, 0);
@@ -300,19 +300,15 @@ tic6x_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc,
static CORE_ADDR
tic6x_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
- CORE_ADDR func_addr;
+ CORE_ADDR post_prologue_pc;
struct tic6x_unwind_cache cache;
/* 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 (start_pc, NULL, &func_addr, NULL))
- {
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_addr);
- if (post_prologue_pc != 0)
- return max (start_pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, start_pc);
+ if (post_prologue_pc != 0)
+ return max (start_pc, post_prologue_pc);
/* Can't determine prologue from the symbol table, need to examine
instructions. */
@@ -744,19 +744,14 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
static CORE_ADDR
tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
- CORE_ADDR func_start, end_pc;
+ CORE_ADDR post_prologue_pc, end_pc;
struct obj_section *s;
/* This is the preferred method, find the end of the prologue by
using the debugging information. */
- if (find_pc_partial_function (start_pc, NULL, &func_start, NULL))
- {
- CORE_ADDR post_prologue_pc
- = skip_prologue_using_sal (gdbarch, func_start);
-
- if (post_prologue_pc != 0)
- return max (start_pc, post_prologue_pc);
- }
+ post_prologue_pc = skip_prologue_using_sal (gdbarch, start_pc);
+ if (post_prologue_pc != 0)
+ return max (start_pc, post_prologue_pc);
/* Don't straddle a section boundary. */
s = find_pc_section (start_pc);