}
static int
-amd64_epilogue_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_prologue_cache)
+amd64_epilogue_frame_sniffer_1 (const struct frame_unwind *self,
+ frame_info_ptr this_frame,
+ void **this_prologue_cache, bool override_p)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
/* We're not in the inner frame, so assume we're not in an epilogue. */
return 0;
- if (compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc)))
- /* Don't override the symtab unwinders. */
- return 0;
+ bool unwind_valid_p
+ = compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc));
+ if (override_p)
+ {
+ if (unwind_valid_p)
+ /* Don't override the symtab unwinders, skip
+ "amd64 epilogue override". */
+ return 0;
+ }
+ else
+ {
+ if (!unwind_valid_p)
+ /* "amd64 epilogue override" unwinder already ran, skip
+ "amd64 epilogue". */
+ return 0;
+ }
/* Check whether we're in an epilogue. */
return amd64_stack_frame_destroyed_p (gdbarch, pc);
}
+static int
+amd64_epilogue_override_frame_sniffer (const struct frame_unwind *self,
+ frame_info_ptr this_frame,
+ void **this_prologue_cache)
+{
+ return amd64_epilogue_frame_sniffer_1 (self, this_frame, this_prologue_cache,
+ true);
+}
+
+static int
+amd64_epilogue_frame_sniffer (const struct frame_unwind *self,
+ frame_info_ptr this_frame,
+ void **this_prologue_cache)
+{
+ return amd64_epilogue_frame_sniffer_1 (self, this_frame, this_prologue_cache,
+ false);
+}
+
static struct amd64_frame_cache *
amd64_epilogue_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
(*this_id) = frame_id_build (cache->base + 16, cache->pc);
}
+static const struct frame_unwind amd64_epilogue_override_frame_unwind =
+{
+ "amd64 epilogue override",
+ NORMAL_FRAME,
+ amd64_epilogue_frame_unwind_stop_reason,
+ amd64_epilogue_frame_this_id,
+ amd64_frame_prev_register,
+ NULL,
+ amd64_epilogue_override_frame_sniffer
+};
+
static const struct frame_unwind amd64_epilogue_frame_unwind =
{
"amd64 epilogue",
/* Hook the function epilogue frame unwinder. This unwinder is
appended to the list first, so that it supercedes the other
unwinders in function epilogues. */
- frame_unwind_prepend_unwinder (gdbarch, &amd64_epilogue_frame_unwind);
+ frame_unwind_prepend_unwinder (gdbarch, &amd64_epilogue_override_frame_unwind);
+
+ frame_unwind_append_unwinder (gdbarch, &amd64_epilogue_frame_unwind);
/* Hook the prologue-based frame unwinders. */
frame_unwind_append_unwinder (gdbarch, &amd64_sigtramp_frame_unwind);
}
static int
-i386_epilogue_frame_sniffer (const struct frame_unwind *self,
- frame_info_ptr this_frame,
- void **this_prologue_cache)
+i386_epilogue_frame_sniffer_1 (const struct frame_unwind *self,
+ frame_info_ptr this_frame,
+ void **this_prologue_cache, bool override_p)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
/* We're not in the inner frame, so assume we're not in an epilogue. */
return 0;
- if (compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc)))
- /* Don't override the symtab unwinders. */
- return 0;
+ bool unwind_valid_p
+ = compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc));
+ if (override_p)
+ {
+ if (unwind_valid_p)
+ /* Don't override the symtab unwinders, skip
+ "i386 epilogue override". */
+ return 0;
+ }
+ else
+ {
+ if (!unwind_valid_p)
+ /* "i386 epilogue override" unwinder already ran, skip
+ "i386 epilogue". */
+ return 0;
+ }
/* Check whether we're in an epilogue. */
return i386_stack_frame_destroyed_p (gdbarch, pc);
}
+static int
+i386_epilogue_override_frame_sniffer (const struct frame_unwind *self,
+ frame_info_ptr this_frame,
+ void **this_prologue_cache)
+{
+ return i386_epilogue_frame_sniffer_1 (self, this_frame, this_prologue_cache,
+ true);
+}
+
+static int
+i386_epilogue_frame_sniffer (const struct frame_unwind *self,
+ frame_info_ptr this_frame,
+ void **this_prologue_cache)
+{
+ return i386_epilogue_frame_sniffer_1 (self, this_frame, this_prologue_cache,
+ false);
+}
+
static struct i386_frame_cache *
i386_epilogue_frame_cache (frame_info_ptr this_frame, void **this_cache)
{
return i386_frame_prev_register (this_frame, this_cache, regnum);
}
+static const struct frame_unwind i386_epilogue_override_frame_unwind =
+{
+ "i386 epilogue override",
+ NORMAL_FRAME,
+ i386_epilogue_frame_unwind_stop_reason,
+ i386_epilogue_frame_this_id,
+ i386_epilogue_frame_prev_register,
+ NULL,
+ i386_epilogue_override_frame_sniffer
+};
+
static const struct frame_unwind i386_epilogue_frame_unwind =
{
"i386 epilogue",
unwinder in function epilogues (where the DWARF unwinder
currently fails). */
if (info.bfd_arch_info->bits_per_word == 32)
- frame_unwind_append_unwinder (gdbarch, &i386_epilogue_frame_unwind);
+ frame_unwind_append_unwinder (gdbarch, &i386_epilogue_override_frame_unwind);
/* Hook in the DWARF CFI frame unwinder. This unwinder is appended
to the list before the prologue-based unwinders, so that DWARF
CFI info will be used if it is available. */
dwarf2_append_unwinders (gdbarch);
+ if (info.bfd_arch_info->bits_per_word == 32)
+ frame_unwind_append_unwinder (gdbarch, &i386_epilogue_frame_unwind);
+
frame_base_set_default (gdbarch, &i386_frame_base);
/* Pseudo registers may be changed by amd64_init_abi. */