Factor out compunit_epilogue_unwind_valid from both
amd64_stack_frame_destroyed_p and i386_stack_frame_destroyed_p. No functional
changes.
Also add a comment in the new function about the assumption that in absence of
producer information, epilogue unwind info is invalid.
Approved-By: Tom Tromey <tom@tromey.com>
amd64_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{
gdb_byte insn;
- struct compunit_symtab *cust;
- cust = find_pc_compunit_symtab (pc);
- if (cust != NULL && cust->epilogue_unwind_valid ())
+ if (compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc)))
return 0;
if (target_read_memory (pc, &insn, 1))
i386_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{
gdb_byte insn;
- struct compunit_symtab *cust;
- cust = find_pc_compunit_symtab (pc);
- if (cust != NULL && cust->epilogue_unwind_valid ())
+ if (compunit_epilogue_unwind_valid (find_pc_compunit_symtab (pc)))
return 0;
if (target_read_memory (pc, &insn, 1))
{
return symtab == symtab->compunit ()->primary_filetab ();
}
+
+/* Return true if epilogue unwind info of CUST is valid. */
+
+static inline bool
+compunit_epilogue_unwind_valid (struct compunit_symtab *cust)
+{
+ /* In absence of producer information, assume epilogue unwind info is
+ invalid. */
+ if (cust == nullptr)
+ return false;
+
+ return cust->epilogue_unwind_valid ();
+}
\f
/* The virtual function table is now an array of structures which have the