}
/* AArch64 prologue unwinder. */
-static frame_unwind aarch64_prologue_unwind =
-{
+static const frame_unwind_legacy aarch64_prologue_unwind (
"aarch64 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
aarch64_prologue_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Allocate and fill in *THIS_CACHE with information about the prologue of
*THIS_FRAME. Do not do this is if *THIS_CACHE was already allocated.
}
/* AArch64 stub unwinder. */
-static frame_unwind aarch64_stub_unwind =
-{
+static const frame_unwind_legacy aarch64_stub_unwind (
"aarch64 stub",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
aarch64_prologue_prev_register,
NULL,
aarch64_stub_unwind_sniffer
-};
+);
/* Return the frame base address of *THIS_FRAME. */
return 1;
}
-static const struct frame_unwind alpha_mdebug_frame_unwind =
-{
+static const struct frame_unwind_legacy alpha_mdebug_frame_unwind (
"alpha mdebug",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
alpha_mdebug_frame_prev_register,
NULL,
alpha_mdebug_frame_sniffer
-};
+);
static CORE_ADDR
alpha_mdebug_frame_base_address (const frame_info_ptr &this_frame,
return 0;
}
-static const struct frame_unwind alpha_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy alpha_sigtramp_frame_unwind (
"alpha sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
alpha_sigtramp_frame_prev_register,
NULL,
alpha_sigtramp_frame_sniffer
-};
+);
\f
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind alpha_heuristic_frame_unwind =
-{
+static const struct frame_unwind_legacy alpha_heuristic_frame_unwind (
"alpha prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
alpha_heuristic_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
alpha_heuristic_frame_base_address (const frame_info_ptr &this_frame,
|| (startswith (name, "Xintr"))));
}
-static const struct frame_unwind amd64obsd_trapframe_unwind =
-{
+static const struct frame_unwind_legacy amd64obsd_trapframe_unwind (
/* FIXME: kettenis/20051219: This really is more like an interrupt
frame, but SIGTRAMP_FRAME would print <signal handler called>,
which really is not what we want here. */
amd64obsd_trapframe_prev_register,
NULL,
amd64obsd_trapframe_sniffer
-};
+);
\f
static void
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind amd64_frame_unwind =
-{
+static const struct frame_unwind_legacy amd64_frame_unwind (
"amd64 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
amd64_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
/* Generate a bytecode expression to get the value of the saved PC. */
return 0;
}
-static const struct frame_unwind amd64_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy amd64_sigtramp_frame_unwind (
"amd64 sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
amd64_sigtramp_frame_prev_register,
NULL,
amd64_sigtramp_frame_sniffer
-};
+);
\f
static CORE_ADDR
(*this_id) = frame_id_build (cache->base + 16, cache->pc);
}
-static const struct frame_unwind amd64_epilogue_override_frame_unwind =
-{
+static const struct frame_unwind_legacy amd64_epilogue_override_frame_unwind (
"amd64 epilogue override",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
amd64_frame_prev_register,
NULL,
amd64_epilogue_override_frame_sniffer
-};
+);
-static const struct frame_unwind amd64_epilogue_frame_unwind =
-{
+static const struct frame_unwind_legacy amd64_epilogue_frame_unwind (
"amd64 epilogue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
amd64_frame_prev_register,
NULL,
amd64_epilogue_frame_sniffer
-};
+);
static struct frame_id
amd64_dummy_id (struct gdbarch *gdbarch, const frame_info_ptr &this_frame)
/* Windows x64 SEH unwinder. */
-static const struct frame_unwind amd64_windows_frame_unwind =
-{
+static const struct frame_unwind_legacy amd64_windows_frame_unwind (
"amd64 windows",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
&amd64_windows_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Implement the "skip_prologue" gdbarch method. */
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const frame_unwind amdgpu_frame_unwind = {
+static const frame_unwind_legacy amdgpu_frame_unwind (
"amdgpu",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
nullptr,
default_frame_sniffer,
nullptr,
- nullptr,
-};
+ nullptr
+);
static int
print_insn_amdgpu (bfd_vma memaddr, struct disassemble_info *info)
the fallback unwinder, we use the default frame sniffer, which always
accepts the frame. */
-static const struct frame_unwind arc_frame_unwind = {
+static const struct frame_unwind_legacy arc_frame_unwind (
"arc prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
default_frame_sniffer,
NULL,
NULL
-};
+);
/* Structure defining the ARC signal frame unwind functions. Custom
sniffer is used, because this frame must be accepted only in the right
context. */
-static const struct frame_unwind arc_sigtramp_frame_unwind = {
+static const struct frame_unwind_legacy arc_sigtramp_frame_unwind (
"arc sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
arc_sigtramp_frame_sniffer,
NULL,
NULL
-};
+);
static const struct frame_base arc_normal_base = {
prev_regnum);
}
-static frame_unwind arm_prologue_unwind = {
+static const frame_unwind_legacy arm_prologue_unwind (
"arm prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
arm_prologue_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Maintain a list of ARM exception table entries per objfile, similar to the
list of mapping symbols. We only cache entries for standard ARM-defined
return 1;
}
-struct frame_unwind arm_exidx_unwind = {
+struct frame_unwind_legacy arm_exidx_unwind (
"arm exidx",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
arm_prologue_prev_register,
NULL,
arm_exidx_unwind_sniffer
-};
+);
static struct arm_prologue_cache *
arm_make_epilogue_frame_cache (const frame_info_ptr &this_frame)
/* Frame unwinder from epilogue. */
-static const struct frame_unwind arm_epilogue_frame_unwind =
-{
+static const struct frame_unwind_legacy arm_epilogue_frame_unwind (
"arm epilogue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
arm_epilogue_frame_this_id,
arm_epilogue_frame_prev_register,
NULL,
- arm_epilogue_frame_sniffer,
-};
+ arm_epilogue_frame_sniffer
+);
/* Recognize GCC's trampoline for thumb call-indirect. If we are in a
trampoline, return the target PC. Otherwise return 0.
return 0;
}
-struct frame_unwind arm_stub_unwind = {
+struct frame_unwind_legacy arm_stub_unwind (
"arm stub",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
arm_prologue_prev_register,
NULL,
arm_stub_unwind_sniffer
-};
+);
/* Put here the code to store, into CACHE->saved_regs, the addresses
of the saved registers of frame described by THIS_FRAME. CACHE is
/* Frame unwinder for M-profile exceptions (EXC_RETURN on stack),
lockup and secure/nonsecure interstate function calls (FNC_RETURN). */
-struct frame_unwind arm_m_exception_unwind =
-{
+struct frame_unwind_legacy arm_m_exception_unwind (
"arm m exception lockup sec_fnc",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
arm_m_exception_prev_register,
NULL,
arm_m_exception_unwind_sniffer
-};
+);
static CORE_ADDR
arm_normal_frame_base (const frame_info_ptr &this_frame, void **this_cache)
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind avr_frame_unwind = {
+static const struct frame_unwind_legacy avr_frame_unwind (
"avr prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
avr_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
avr_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind bfin_frame_unwind =
-{
+static const struct frame_unwind_legacy bfin_frame_unwind (
"bfin prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
bfin_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Check for "[--SP] = <reg>;" insns. These are appear in function
prologues to save misc registers onto the stack. */
/* Frame unwinder machinery for BPF. */
-static const struct frame_unwind bpf_frame_unwind =
-{
+static const struct frame_unwind_legacy bpf_frame_unwind (
"bpf prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
bpf_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
/* Breakpoints. */
return 0;
}
-static const struct frame_unwind cris_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy cris_sigtramp_frame_unwind (
"cris sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
cris_sigtramp_frame_prev_register,
NULL,
cris_sigtramp_frame_sniffer
-};
+);
static int
crisv32_single_step_through_delay (struct gdbarch *gdbarch,
return sp;
}
-static const struct frame_unwind cris_frame_unwind =
-{
+static const struct frame_unwind_legacy cris_frame_unwind (
"cris prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
cris_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
cris_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
/* Data structures for the normal prologue-analysis-based
unwinder. */
-static const struct frame_unwind csky_unwind_cache = {
+static const struct frame_unwind_legacy csky_unwind_cache (
"cski prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
default_frame_sniffer,
NULL,
NULL
-};
+);
static CORE_ADDR
csky_check_long_branch (const frame_info_ptr &frame, CORE_ADDR pc)
prev_regnum);
}
-static frame_unwind csky_stub_unwind = {
+static const frame_unwind_legacy csky_stub_unwind (
"csky stub",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
csky_stub_prev_register,
NULL,
csky_stub_unwind_sniffer
-};
+);
/* Implement the this_base, this_locals, and this_args hooks
for the normal unwinder. */
(*this_id) = cache->this_id;
}
-const struct frame_unwind dummy_frame_unwind =
-{
+const struct frame_unwind_legacy dummy_frame_unwind (
"dummy",
DUMMY_FRAME,
FRAME_UNWIND_GDB,
dummy_frame_this_id,
dummy_frame_prev_register,
NULL,
- dummy_frame_sniffer,
-};
+ dummy_frame_sniffer
+);
/* See dummy-frame.h. */
/* If the PC falls in a dummy frame, return a dummy frame
unwinder. */
-extern const struct frame_unwind dummy_frame_unwind;
+extern const struct frame_unwind_legacy dummy_frame_unwind;
/* Destructor for dummy_frame. DATA is supplied by registrant.
REGISTERS_VALID is 1 for dummy_frame_pop, 0 for dummy_frame_discard. */
/* Virtual tail call frame unwinder if dwarf2_tailcall_sniffer_first finds
a chain to create. */
-const struct frame_unwind dwarf2_tailcall_frame_unwind =
-{
+const struct frame_unwind_legacy dwarf2_tailcall_frame_unwind (
"dwarf2 tailcall",
TAILCALL_FRAME,
FRAME_UNWIND_DEBUGINFO,
tailcall_frame_sniffer,
tailcall_frame_dealloc_cache,
tailcall_frame_prev_arch
-};
+);
void _initialize_tailcall_frame ();
void
dwarf2_tailcall_prev_register_first (const frame_info_ptr &this_frame,
void **tailcall_cachep, int regnum);
-extern const struct frame_unwind dwarf2_tailcall_frame_unwind;
+extern const struct frame_unwind_legacy dwarf2_tailcall_frame_unwind;
#endif /* GDB_DWARF2_FRAME_TAILCALL_H */
if (fde->cie->signal_frame
|| dwarf2_frame_signal_frame_p (get_frame_arch (this_frame),
this_frame))
- return self->type == SIGTRAMP_FRAME;
+ return self->type () == SIGTRAMP_FRAME;
- if (self->type != NORMAL_FRAME)
+ if (self->type () != NORMAL_FRAME)
return 0;
return 1;
}
-static const struct frame_unwind dwarf2_frame_unwind =
-{
+static const struct frame_unwind_legacy dwarf2_frame_unwind (
"dwarf2",
NORMAL_FRAME,
FRAME_UNWIND_DEBUGINFO,
NULL,
dwarf2_frame_sniffer,
dwarf2_frame_dealloc_cache
-};
+);
-static const struct frame_unwind dwarf2_signal_frame_unwind =
-{
+static const struct frame_unwind_legacy dwarf2_signal_frame_unwind (
"dwarf2 signal",
SIGTRAMP_FRAME,
FRAME_UNWIND_DEBUGINFO,
/* TAILCALL_CACHE can never be in such frame to need dealloc_cache. */
NULL
-};
+);
/* Append the DWARF-2 frame unwinders to GDBARCH's list. */
try
{
- frame_debug_printf ("trying unwinder \"%s\"", unwinder->name);
- res = unwinder->sniffer (unwinder, this_frame, this_cache);
+ frame_debug_printf ("trying unwinder \"%s\"", unwinder->name ());
+ res = unwinder->sniff (this_frame, this_cache);
}
catch (const gdb_exception &ex)
{
return reg_val;
}
+/* See frame-unwind.h. */
+
+enum unwind_stop_reason
+frame_unwind_legacy::stop_reason (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const
+{
+ return m_stop_reason (this_frame, this_prologue_cache);
+}
+
+/* See frame-unwind.h. */
+
+void
+frame_unwind_legacy::this_id (const frame_info_ptr &this_frame,
+ void **this_prologue_cache,
+ struct frame_id *id) const
+{
+ return m_this_id (this_frame, this_prologue_cache, id);
+}
+
+/* See frame-unwind.h. */
+
+struct value *
+frame_unwind_legacy::prev_register (const frame_info_ptr &this_frame,
+ void **this_prologue_cache,
+ int regnum) const
+{
+ return m_prev_register (this_frame, this_prologue_cache, regnum);
+}
+
+/* See frame-unwind.h. */
+
+int
+frame_unwind_legacy::sniff (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const
+{
+ return m_sniffer (this, this_frame, this_prologue_cache);
+}
+
+/* See frame-unwind.h. */
+
+void
+frame_unwind_legacy::dealloc_cache (frame_info *self, void *this_cache) const
+{
+ if (m_dealloc_cache != nullptr)
+ m_dealloc_cache (self, this_cache);
+}
+
+/* See frame-unwind.h. */
+
+struct gdbarch *
+frame_unwind_legacy::prev_arch (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const
+{
+ if (m_prev_arch == nullptr)
+ return frame_unwind::prev_arch (this_frame, this_prologue_cache);
+ return m_prev_arch (this_frame, this_prologue_cache);
+}
+
/* Implement "maintenance info frame-unwinders" command. */
static void
for (const auto &unwinder : table)
{
ui_out_emit_list tuple_emitter (uiout, nullptr);
- uiout->field_string ("name", unwinder->name);
- uiout->field_string ("type", frame_type_str (unwinder->type));
+ uiout->field_string ("name", unwinder->name ());
+ uiout->field_string ("type", frame_type_str (unwinder->type ()));
uiout->field_string ("class", frame_unwinder_class_str (
- unwinder->unwinder_class));
+ unwinder->unwinder_class ()));
uiout->text ("\n");
}
}
UNWIND_CLASS_NUMBER,
};
-struct frame_unwind
+class frame_unwind
{
- const char *name;
+public:
+ frame_unwind (const char *name, frame_type type, frame_unwind_class uclass,
+ const frame_data *data)
+ : m_name (name), m_type (type), m_unwinder_class (uclass),
+ m_unwind_data (data)
+ { }
+
+ const char *name () const
+ { return m_name; }
+
+ frame_type type () const
+ { return m_type; }
+
+ frame_unwind_class unwinder_class () const
+ { return m_unwinder_class; }
+
+ const frame_data *unwind_data () const
+ { return m_unwind_data; }
+
+ /* Default stop_reason implementation. It reports NO_REASON, unless the
+ frame is the outermost. */
+
+ virtual unwind_stop_reason stop_reason (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const
+ {
+ return default_frame_unwind_stop_reason (this_frame, this_prologue_cache);
+ }
+
+ /* Default frame sniffer. Will always return that the unwinder
+ is able to unwind the frame. */
+
+ virtual int sniff (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const
+ { return 1; }
+
+ /* Calculate the ID of the given frame using this unwinder. */
+
+ virtual void this_id (const frame_info_ptr &this_frame,
+ void **this_prologue_cache,
+ struct frame_id *id) const = 0;
+
+ /* Get the value of a register in a previous frame. */
+
+ virtual struct value *prev_register (const frame_info_ptr &this_frame,
+ void **this_prologue_cache,
+ int regnum) const = 0;
+
+ /* Properly deallocate the cache. */
+
+ virtual void dealloc_cache (frame_info *self, void *this_cache) const
+ { }
+
+ /* Get the previous architecture. */
+
+ virtual gdbarch *prev_arch (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const
+ { return get_frame_arch (this_frame); }
+
+private:
+
+ /* Name of the unwinder. Used to uniquely identify unwinders. */
+ const char *m_name;
+
/* The frame's type. Should this instead be a collection of
predicates that test the frame for various attributes? */
- enum frame_type type;
+ frame_type m_type;
+
/* What kind of unwinder is this. It generally follows from where
the unwinder was added or where it looks for information to do the
unwinding. */
- enum frame_unwind_class unwinder_class;
- /* Should an attribute indicating the frame's address-in-block go
- here? */
- frame_unwind_stop_reason_ftype *stop_reason;
- frame_this_id_ftype *this_id;
- frame_prev_register_ftype *prev_register;
- const struct frame_data *unwind_data;
- frame_sniffer_ftype *sniffer;
- frame_dealloc_cache_ftype *dealloc_cache;
- frame_prev_arch_ftype *prev_arch;
+ frame_unwind_class m_unwinder_class;
+
+ /* Additional data used by the trampoline and python frame unwinders. */
+ const frame_data *m_unwind_data;
+};
+
+/* This is a legacy version of the frame unwinder. The original struct
+ used function pointers for callbacks, this updated version has a
+ method that just passes the parameters along to the callback
+ pointer.
+ Do not use this class for new unwinders. Instead, see other classes
+ that inherit from frame_unwind, such as the python unwinder. */
+struct frame_unwind_legacy : public frame_unwind
+{
+ frame_unwind_legacy (const char *name, frame_type type,
+ frame_unwind_class uclass,
+ frame_unwind_stop_reason_ftype *stop_reason_func,
+ frame_this_id_ftype *this_id_func,
+ frame_prev_register_ftype *prev_register_func,
+ const struct frame_data *data,
+ frame_sniffer_ftype *sniffer_func,
+ frame_dealloc_cache_ftype *dealloc_cache_func = nullptr,
+ frame_prev_arch_ftype *prev_arch_func = nullptr)
+ : frame_unwind (name, type, uclass, data), m_stop_reason (stop_reason_func),
+ m_this_id (this_id_func), m_prev_register (prev_register_func),
+ m_sniffer (sniffer_func), m_dealloc_cache (dealloc_cache_func),
+ m_prev_arch (prev_arch_func)
+ { }
+
+ /* This method just passes the parameters to the callback pointer. */
+
+ enum unwind_stop_reason stop_reason (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const override;
+
+ /* This method just passes the parameters to the callback pointer. */
+
+ void this_id (const frame_info_ptr &this_frame, void **this_prologue_cache,
+ struct frame_id *id) const override;
+
+ /* This method just passes the parameters to the callback pointer. */
+
+ struct value *prev_register (const frame_info_ptr &this_frame,
+ void **this_prologue_cache,
+ int regnum) const override;
+
+ /* This method just passes the parameters to the callback pointer. */
+
+ int sniff (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const override;
+
+ /* This method just passes the parameters to the callback pointer.
+ It is safe to call this method if no callback is installed, it
+ just turns into a noop. */
+
+ void dealloc_cache (frame_info *self, void *this_cache) const override;
+
+ /* This method just passes the parameters to the callback pointer. */
+
+ struct gdbarch *prev_arch (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const override;
+
+private:
+
+ frame_unwind_stop_reason_ftype *m_stop_reason;
+ frame_this_id_ftype *m_this_id;
+ frame_prev_register_ftype *m_prev_register;
+ frame_sniffer_ftype *m_sniffer;
+ frame_dealloc_cache_ftype *m_dealloc_cache;
+ frame_prev_arch_ftype *m_prev_arch;
};
/* Register a frame unwinder, _prepending_ it to the front of the
static void
frame_info_del (frame_info *frame)
{
- if (frame->prologue_cache != nullptr
- && frame->unwind->dealloc_cache != nullptr)
+ if (frame->prologue_cache != nullptr)
frame->unwind->dealloc_cache (frame, frame->prologue_cache);
- if (frame->base_cache != nullptr
- && frame->base->unwind->dealloc_cache != nullptr)
+ if (frame->base_cache != nullptr)
frame->base->unwind->dealloc_cache (frame, frame->base_cache);
}
res += string_printf ("{level=%d,", fi->level);
if (fi->unwind != NULL)
- res += string_printf ("type=%s,", frame_type_str (fi->unwind->type));
+ res += string_printf ("type=%s,", frame_type_str (fi->unwind->type ()));
else
res += "type=<unknown>,";
if (fi->unwind != NULL)
- res += string_printf ("unwinder=\"%s\",", fi->unwind->name);
+ res += string_printf ("unwinder=\"%s\",", fi->unwind->name ());
else
res += "unwinder=<unknown>,";
This check is valid only if this frame and the next frame are NORMAL.
See the comment at frame_id_inner for details. */
if (get_frame_type (this_frame) == NORMAL_FRAME
- && this_frame->next->unwind->type == NORMAL_FRAME
+ && this_frame->next->unwind->type () == NORMAL_FRAME
&& frame_id_inner (get_frame_arch (frame_info_ptr (this_frame->next)),
get_frame_id (this_frame),
get_frame_id (frame_info_ptr (this_frame->next))))
/* Initialize the frame's unwinder because that's what
provides the frame's type. */
frame_unwind_find_by_frame (frame, &frame->prologue_cache);
- return frame->unwind->type;
+ return frame->unwind->type ();
}
struct program_space *
if (next_frame->unwind == NULL)
frame_unwind_find_by_frame (next_frame, &next_frame->prologue_cache);
- if (next_frame->unwind->prev_arch != NULL)
- arch = next_frame->unwind->prev_arch (next_frame,
- &next_frame->prologue_cache);
- else
- arch = get_frame_arch (next_frame);
+ arch = next_frame->unwind->prev_arch (next_frame,
+ &next_frame->prologue_cache);
next_frame->prev_arch.arch = arch;
next_frame->prev_arch.p = true;
return 0;
}
-static const struct frame_unwind frv_linux_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy frv_linux_sigtramp_frame_unwind (
"frv linux sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
frv_linux_sigtramp_frame_prev_register,
NULL,
frv_linux_sigtramp_frame_sniffer
-};
+);
\f
/* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include
the loadmap addresses in the register set. (See below for more info.) */
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind frv_frame_unwind = {
+static const struct frame_unwind_legacy frv_frame_unwind (
"frv prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
frv_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
frv_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind ft32_frame_unwind =
-{
+static const struct frame_unwind_legacy ft32_frame_unwind (
"ft32 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
ft32_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Return the base address of this_frame. */
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind h8300_frame_unwind = {
+static const struct frame_unwind_legacy h8300_frame_unwind (
"h8300 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
h8300_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
h8300_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return 0;
}
-static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = {
+static const struct frame_unwind_legacy hppa_linux_sigtramp_frame_unwind (
"hppa linux sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
hppa_linux_sigtramp_frame_prev_register,
NULL,
hppa_linux_sigtramp_frame_sniffer
-};
+);
/* Attempt to find (and return) the global pointer for the given
function.
return 0;
}
-static const struct frame_unwind hppa_frame_unwind =
-{
+static const struct frame_unwind_legacy hppa_frame_unwind (
"hppa unwind table",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
hppa_frame_prev_register,
NULL,
hppa_frame_unwind_sniffer
-};
+);
/* This is a generic fallback frame unwinder that kicks in if we fail all
the other ones. Normally we would expect the stub and regular unwinder
info->saved_regs, regnum);
}
-static const struct frame_unwind hppa_fallback_frame_unwind =
-{
+static const struct frame_unwind_legacy hppa_fallback_frame_unwind (
"hppa prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
hppa_fallback_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Stub frames, used for all kinds of call stubs. */
struct hppa_stub_unwind_cache
return 0;
}
-static const struct frame_unwind hppa_stub_frame_unwind = {
+static const struct frame_unwind_legacy hppa_stub_frame_unwind (
"hppa stub",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
hppa_stub_frame_prev_register,
NULL,
hppa_stub_unwind_sniffer
-};
+);
CORE_ADDR
hppa_unwind_pc (struct gdbarch *gdbarch, const frame_info_ptr &next_frame)
|| startswith (name, "Xsoft")));
}
-static const struct frame_unwind i386obsd_trapframe_unwind = {
+static const struct frame_unwind_legacy i386obsd_trapframe_unwind (
"i386 openbsd trap",
/* FIXME: kettenis/20051219: This really is more like an interrupt
frame, but SIGTRAMP_FRAME would print <signal handler called>,
i386obsd_trapframe_prev_register,
NULL,
i386obsd_trapframe_sniffer
-};
+);
\f
static void
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind i386_frame_unwind =
-{
+static const struct frame_unwind_legacy i386_frame_unwind (
"i386 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
i386_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Normal frames, but in a function epilogue. */
return i386_frame_prev_register (this_frame, this_cache, regnum);
}
-static const struct frame_unwind i386_epilogue_override_frame_unwind =
-{
+static const struct frame_unwind_legacy i386_epilogue_override_frame_unwind (
"i386 epilogue override",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
i386_epilogue_frame_prev_register,
NULL,
i386_epilogue_override_frame_sniffer
-};
+);
-static const struct frame_unwind i386_epilogue_frame_unwind =
-{
+static const struct frame_unwind_legacy i386_epilogue_frame_unwind (
"i386 epilogue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
i386_epilogue_frame_prev_register,
NULL,
i386_epilogue_frame_sniffer
-};
+);
\f
/* Stack-based trampolines. */
return 0;
}
-static const struct frame_unwind i386_stack_tramp_frame_unwind =
-{
+static const struct frame_unwind_legacy i386_stack_tramp_frame_unwind (
"i386 stack tramp",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
i386_epilogue_frame_prev_register,
NULL,
i386_stack_tramp_frame_sniffer
-};
+);
\f
/* Generate a bytecode expression to get the value of the saved PC. */
return 0;
}
-static const struct frame_unwind i386_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy i386_sigtramp_frame_unwind (
"i386 sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
i386_sigtramp_frame_prev_register,
NULL,
i386_sigtramp_frame_sniffer
-};
+);
\f
static CORE_ADDR
}
}
-static const struct frame_unwind ia64_frame_unwind =
-{
+static const struct frame_unwind_legacy ia64_frame_unwind (
"ia64 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
&ia64_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Signal trampolines. */
return 0;
}
-static const struct frame_unwind ia64_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy ia64_sigtramp_frame_unwind (
"ia64 sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
ia64_sigtramp_frame_prev_register,
NULL,
ia64_sigtramp_frame_sniffer
-};
+);
\f
return 0;
}
-static const struct frame_unwind ia64_libunwind_frame_unwind =
-{
+static const struct frame_unwind_legacy ia64_libunwind_frame_unwind (
"ia64 libunwind",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
NULL,
ia64_libunwind_frame_sniffer,
libunwind_frame_dealloc_cache
-};
+);
static void
ia64_libunwind_sigtramp_frame_this_id (const frame_info_ptr &this_frame,
return ia64_sigtramp_frame_sniffer (self, this_frame, this_cache);
}
-static const struct frame_unwind ia64_libunwind_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy ia64_libunwind_sigtramp_frame_unwind (
"ia64 libunwind sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
ia64_libunwind_sigtramp_frame_prev_register,
NULL,
ia64_libunwind_sigtramp_frame_sniffer
-};
+);
/* Set of libunwind callback acccessor functions. */
unw_accessors_t ia64_unw_accessors =
return 1;
}
-const struct frame_unwind inline_frame_unwind = {
+const struct frame_unwind_legacy inline_frame_unwind (
"inline",
INLINE_FRAME,
FRAME_UNWIND_GDB,
inline_frame_prev_register,
NULL,
inline_frame_sniffer
-};
+);
/* Return non-zero if BLOCK, an inlined function block containing PC,
has a group of contiguous instructions starting at PC (but not
/* The inline frame unwinder. */
-extern const struct frame_unwind inline_frame_unwind;
+extern const struct frame_unwind_legacy inline_frame_unwind;
/* Skip all inlined functions whose call sites are at the current PC.
*this_id = frame_id_build (cache->saved_sp, cache->pc);
}
-static const struct frame_unwind iq2000_frame_unwind = {
+static const struct frame_unwind_legacy iq2000_frame_unwind (
"iq2000 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
iq2000_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
iq2000_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
/* Relay everything back to the unwinder registered by the JIT debug
info reader.*/
-static const struct frame_unwind jit_frame_unwind =
-{
+static const struct frame_unwind_legacy jit_frame_unwind (
"jit",
NORMAL_FRAME,
FRAME_UNWIND_EXTENSION,
NULL,
jit_frame_sniffer,
jit_dealloc_cache
-};
+);
/* This is the information that is stored at jit_gdbarch_data for each
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind lm32_frame_unwind = {
+static const struct frame_unwind_legacy lm32_frame_unwind (
"lm32 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
lm32_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
lm32_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return trad_frame_get_register (info, this_frame, regnum);
}
-static const struct frame_unwind loongarch_frame_unwind = {
+static const struct frame_unwind_legacy loongarch_frame_unwind (
"loongarch prologue",
/*.type =*/NORMAL_FRAME,
/*.unwinder_class=*/FRAME_UNWIND_ARCH,
/*.unwind_data =*/nullptr,
/*.sniffer =*/default_frame_sniffer,
/*.dealloc_cache =*/nullptr,
- /*.prev_arch =*/nullptr,
-};
+ /*.prev_arch =*/nullptr
+);
/* Write the contents of buffer VAL into the general-purpose argument
register defined by GAR in REGCACHE. GAR indicates the available
}
-static const struct frame_unwind m32c_unwind = {
+static const struct frame_unwind_legacy m32c_unwind (
"m32c prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
m32c_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
/* Inferior calls. */
return 0;
}
-static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = {
+static const struct frame_unwind_legacy m32r_linux_sigtramp_frame_unwind (
"m32r linux sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
m32r_linux_sigtramp_frame_prev_register,
NULL,
m32r_linux_sigtramp_frame_sniffer
-};
+);
/* Mapping between the registers in `struct pt_regs'
format and GDB's register array layout. */
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind m32r_frame_unwind = {
+static const struct frame_unwind_legacy m32r_frame_unwind (
"m32r prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
m32r_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
m32r_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return value;
}
-static const struct frame_unwind m68hc11_frame_unwind = {
+static const struct frame_unwind_legacy m68hc11_frame_unwind (
"m68hc11 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
m68hc11_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
m68hc11_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return m68k_linux_pc_in_sigtramp (this_frame);
}
-static const struct frame_unwind m68k_linux_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy m68k_linux_sigtramp_frame_unwind (
"m68k linux sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
m68k_linux_sigtramp_frame_prev_register,
NULL,
m68k_linux_sigtramp_frame_sniffer
-};
+);
/* Register maps for supply/collect regset functions. */
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind m68k_frame_unwind =
-{
+static const struct frame_unwind_legacy m68k_frame_unwind (
"m68k prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
m68k_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
static CORE_ADDR
m68k_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
}
-static const struct frame_unwind mep_frame_unwind = {
+static const struct frame_unwind_legacy mep_frame_unwind (
"mep prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
mep_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
/* Return values. */
}
-static const struct frame_unwind microblaze_frame_unwind =
-{
+static const struct frame_unwind_legacy microblaze_frame_unwind (
"microblaze prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
microblaze_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
static CORE_ADDR
microblaze_frame_base_address (const frame_info_ptr &next_frame,
/* Data structure for the SDE frame unwinder. */
-static const struct frame_unwind mips_sde_frame_unwind =
-{
+static const struct frame_unwind_legacy mips_sde_frame_unwind (
"mips sde sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
mips_sde_frame_prev_register,
NULL,
mips_sde_frame_sniffer
-};
+);
/* Implement the this_base, this_locals, and this_args hooks
for the normal unwinder. */
return 0;
}
-static const struct frame_unwind mips_insn16_frame_unwind =
-{
+static const struct frame_unwind_legacy mips_insn16_frame_unwind (
"mips insn16 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
mips_insn16_frame_prev_register,
NULL,
mips_insn16_frame_sniffer
-};
+);
static CORE_ADDR
mips_insn16_frame_base_address (const frame_info_ptr &this_frame,
return 0;
}
-static const struct frame_unwind mips_micro_frame_unwind =
-{
+static const struct frame_unwind_legacy mips_micro_frame_unwind (
"mips micro prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
mips_micro_frame_prev_register,
NULL,
mips_micro_frame_sniffer
-};
+);
static CORE_ADDR
mips_micro_frame_base_address (const frame_info_ptr &this_frame,
return 0;
}
-static const struct frame_unwind mips_insn32_frame_unwind =
-{
+static const struct frame_unwind_legacy mips_insn32_frame_unwind (
"mips insn32 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
mips_insn32_frame_prev_register,
NULL,
mips_insn32_frame_sniffer
-};
+);
static CORE_ADDR
mips_insn32_frame_base_address (const frame_info_ptr &this_frame,
return 0;
}
-static const struct frame_unwind mips_stub_frame_unwind =
-{
+static const struct frame_unwind_legacy mips_stub_frame_unwind (
"mips stub",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
mips_stub_frame_prev_register,
NULL,
mips_stub_frame_sniffer
-};
+);
static CORE_ADDR
mips_stub_frame_base_address (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind mn10300_frame_unwind = {
+static const struct frame_unwind_legacy mn10300_frame_unwind (
"mn10300 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
mn10300_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static void
mn10300_frame_unwind_init (struct gdbarch *gdbarch)
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind moxie_frame_unwind = {
+static const struct frame_unwind_legacy moxie_frame_unwind (
"moxie prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
moxie_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Return the base address of this_frame. */
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind msp430_unwind = {
+static const struct frame_unwind_legacy msp430_unwind (
"msp430 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
msp430_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Implement the "dwarf2_reg_to_regnum" gdbarch method. */
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind nds32_frame_unwind =
-{
+static const struct frame_unwind_legacy nds32_frame_unwind (
"nds32 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
nds32_frame_this_id,
nds32_frame_prev_register,
NULL,
- default_frame_sniffer,
-};
+ default_frame_sniffer
+);
/* Return the frame base address of *THIS_FRAME. */
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind nds32_epilogue_frame_unwind =
-{
+static const struct frame_unwind_legacy nds32_epilogue_frame_unwind (
"nds32 epilogue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
nds32_epilogue_frame_prev_register,
NULL,
nds32_epilogue_frame_sniffer
-};
+);
\f
/* Floating type and struct type that has only one floating type member
/* Data structures for the normal prologue-analysis-based unwinder. */
-static const struct frame_unwind or1k_frame_unwind = {
+static const struct frame_unwind_legacy or1k_frame_unwind (
"or1k prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
or1k_frame_prev_register,
NULL,
default_frame_sniffer,
- NULL,
-};
+ NULL
+);
/* Architecture initialization for OpenRISC 1000. */
return trad_frame_get_register (cache, this_frame, regnum);
}
-static const struct frame_unwind ppcfbsd_sigtramp_frame_unwind = {
+static const struct frame_unwind_legacy ppcfbsd_sigtramp_frame_unwind (
"ppc freebsd sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
ppcfbsd_sigtramp_frame_prev_register,
NULL,
ppcfbsd_sigtramp_frame_sniffer
-};
+);
static enum return_value_convention
ppcfbsd_return_value (struct gdbarch *gdbarch, struct value *function,
return trad_frame_get_register (cache, this_frame, regnum);
}
-static const struct frame_unwind ppcobsd_sigtramp_frame_unwind = {
+static const struct frame_unwind_legacy ppcobsd_sigtramp_frame_unwind (
"ppc openbsd sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
ppcobsd_sigtramp_frame_prev_register,
NULL,
ppcobsd_sigtramp_frame_sniffer
-};
+);
\f
static void
return gdb_py_object_from_longest (level).release ();
}
+/* Class for frame unwinders registered by the Python architecture callback. */
+class frame_unwind_python : public frame_unwind
+{
+public:
+ frame_unwind_python (const struct frame_data *newarch)
+ : frame_unwind ("python", NORMAL_FRAME, FRAME_UNWIND_EXTENSION, newarch)
+ { }
+
+ /* No need to override stop_reason, we want the default. */
+
+ int sniff (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const override;
+
+ void this_id (const frame_info_ptr &this_frame, void **this_prologue_cache,
+ struct frame_id *id) const override;
+
+ struct value *prev_register (const frame_info_ptr &this_frame,
+ void **this_prologue_cache,
+ int regnum) const override;
+
+ void dealloc_cache (frame_info *self, void *this_cache) const override;
+};
+
/* frame_unwind.this_id method. */
-static void
-pyuw_this_id (const frame_info_ptr &this_frame, void **cache_ptr,
- struct frame_id *this_id)
+void
+frame_unwind_python::this_id (const frame_info_ptr &this_frame,
+ void **cache_ptr,
+ struct frame_id *this_id) const
{
*this_id = ((cached_frame_info *) *cache_ptr)->frame_id;
pyuw_debug_printf ("frame_id: %s", this_id->to_string ().c_str ());
/* frame_unwind.prev_register. */
-static struct value *
-pyuw_prev_register (const frame_info_ptr &this_frame, void **cache_ptr,
- int regnum)
+struct value *
+frame_unwind_python::prev_register (const frame_info_ptr &this_frame,
+ void **cache_ptr, int regnum) const
{
PYUW_SCOPED_DEBUG_ENTER_EXIT;
/* Frame sniffer dispatch. */
-static int
-pyuw_sniffer (const struct frame_unwind *self, const frame_info_ptr &this_frame,
- void **cache_ptr)
+int
+frame_unwind_python::sniff (const frame_info_ptr &this_frame,
+ void **cache_ptr) const
{
PYUW_SCOPED_DEBUG_ENTER_EXIT;
- struct gdbarch *gdbarch = (struct gdbarch *) (self->unwind_data);
+ struct gdbarch *gdbarch = (struct gdbarch *) (this->unwind_data ());
cached_frame_info *cached_frame;
gdbpy_enter enter_py (gdbarch);
/* Frame cache release shim. */
-static void
-pyuw_dealloc_cache (frame_info *this_frame, void *cache)
+void
+frame_unwind_python::dealloc_cache (frame_info *this_frame, void *cache) const
{
PYUW_SCOPED_DEBUG_ENTER_EXIT;
cached_frame_info *cached_frame = (cached_frame_info *) cache;
if (!data->unwinder_registered)
{
struct frame_unwind *unwinder
- = GDBARCH_OBSTACK_ZALLOC (newarch, struct frame_unwind);
-
- unwinder->name = "python";
- unwinder->type = NORMAL_FRAME;
- unwinder->unwinder_class = FRAME_UNWIND_EXTENSION;
- unwinder->stop_reason = default_frame_unwind_stop_reason;
- unwinder->this_id = pyuw_this_id;
- unwinder->prev_register = pyuw_prev_register;
- unwinder->unwind_data = (const struct frame_data *) newarch;
- unwinder->sniffer = pyuw_sniffer;
- unwinder->dealloc_cache = pyuw_dealloc_cache;
+ = obstack_new<frame_unwind_python>
+ (gdbarch_obstack (newarch), (const struct frame_data *) newarch);
+
frame_unwind_prepend_unwinder (newarch, unwinder);
data->unwinder_registered = 1;
}
Therefore this unwinder reports any possibly unwound registers as
<unavailable>. */
-const struct frame_unwind record_btrace_frame_unwind =
-{
+const struct frame_unwind_legacy record_btrace_frame_unwind (
"record-btrace",
NORMAL_FRAME,
FRAME_UNWIND_GDB,
NULL,
record_btrace_frame_sniffer,
record_btrace_frame_dealloc_cache
-};
+);
-const struct frame_unwind record_btrace_tailcall_frame_unwind =
-{
+const struct frame_unwind_legacy record_btrace_tailcall_frame_unwind (
"record-btrace tailcall",
TAILCALL_FRAME,
FRAME_UNWIND_GDB,
NULL,
record_btrace_tailcall_frame_sniffer,
record_btrace_frame_dealloc_cache
-};
+);
/* Implement the get_unwinder method. */
extern struct cmd_list_element *info_record_cmdlist;
/* Unwinders for some record targets. */
-extern const struct frame_unwind record_btrace_frame_unwind;
-extern const struct frame_unwind record_btrace_tailcall_frame_unwind;
+extern const struct frame_unwind_legacy record_btrace_frame_unwind;
+extern const struct frame_unwind_legacy record_btrace_tailcall_frame_unwind;
/* A list of different recording methods. */
enum record_method
are the fallback unwinder (DWARF unwinder is used first), we use the
default frame sniffer, which always accepts the frame. */
-static const struct frame_unwind riscv_frame_unwind =
-{
+static const struct frame_unwind_legacy riscv_frame_unwind (
/*.name =*/ "riscv prologue",
/*.type =*/ NORMAL_FRAME,
/*.unwinder_class=*/FRAME_UNWIND_ARCH,
/*.unwind_data =*/ NULL,
/*.sniffer =*/ default_frame_sniffer,
/*.dealloc_cache =*/ NULL,
- /*.prev_arch =*/ NULL,
-};
+ /*.prev_arch =*/ NULL
+);
/* Extract a set of required target features out of ABFD. If ABFD is
nullptr then a RISCV_GDBARCH_FEATURES is returned in its default state. */
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind rl78_unwind =
-{
+static const struct frame_unwind_legacy rl78_unwind (
"rl78 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
rl78_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Implement the "dwarf_reg_to_regnum" gdbarch method. */
/* AIX signal handler frame unwinder */
-static const struct frame_unwind aix_sighandle_frame_unwind = {
+static const struct frame_unwind_legacy aix_sighandle_frame_unwind (
"rs6000 aix sighandle",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
aix_sighandle_frame_prev_register,
NULL,
aix_sighandle_frame_sniffer
-};
+);
/* Core file support. */
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
}
-static const struct frame_unwind rs6000_frame_unwind =
-{
+static const struct frame_unwind_legacy rs6000_frame_unwind (
"rs6000 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
rs6000_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Allocate and initialize a frame cache for an epilogue frame.
SP is restored and prev-PC is stored in LR. */
/* Frame unwinder for epilogue frame. This is required for reverse step-over
a function without debug information. */
-static const struct frame_unwind rs6000_epilogue_frame_unwind =
-{
+static const struct frame_unwind_legacy rs6000_epilogue_frame_unwind (
"rs6000 epilogue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
NULL,
rs6000_epilogue_frame_sniffer
-};
+);
\f
static CORE_ADDR
/* Data structure for normal code using instruction-based prologue
analyzer. */
-static const struct frame_unwind rx_frame_unwind = {
+static const struct frame_unwind_legacy rx_frame_unwind (
"rx prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
rx_frame_prev_register,
NULL,
rx_frame_sniffer
-};
+);
/* Data structure for exception code using instruction-based prologue
analyzer. */
-static const struct frame_unwind rx_exception_unwind = {
+static const struct frame_unwind_legacy rx_exception_unwind (
"rx exception",
/* SIGTRAMP_FRAME could be used here, but backtraces are less informative. */
NORMAL_FRAME,
rx_frame_prev_register,
NULL,
rx_exception_sniffer
-};
+);
/* Implement the "push_dummy_call" gdbarch method. */
static CORE_ADDR
}
/* Data structures for the normal prologue-analysis-based unwinder. */
-static const struct frame_unwind s12z_frame_unwind = {
+static const struct frame_unwind_legacy s12z_frame_unwind (
"s12z prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
s12z_frame_prev_register,
NULL,
default_frame_sniffer,
- NULL,
-};
+ NULL
+);
constexpr gdb_byte s12z_break_insn[] = {0x00};
/* S390 sigtramp frame unwinder. */
-static const struct frame_unwind s390_sigtramp_frame_unwind = {
+static const struct frame_unwind_legacy s390_sigtramp_frame_unwind (
"s390 linux sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
s390_sigtramp_frame_prev_register,
NULL,
s390_sigtramp_frame_sniffer
-};
+);
/* Syscall handling. */
/* Default S390 frame unwinder. */
-static const struct frame_unwind s390_frame_unwind = {
+static const struct frame_unwind_legacy s390_frame_unwind (
"s390 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
s390_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
/* Code stubs and their stack frames. For things like PLTs and NULL
function calls (where there is no true frame and the return address
/* S390 stub frame unwinder. */
-static const struct frame_unwind s390_stub_frame_unwind = {
+static const struct frame_unwind_legacy s390_stub_frame_unwind (
"s390 stub",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
s390_stub_frame_prev_register,
NULL,
s390_stub_frame_sniffer
-};
+);
/* Frame base handling. */
return cache->regcache->arch ();
}
-const struct frame_unwind sentinel_frame_unwind =
-{
+const struct frame_unwind_legacy sentinel_frame_unwind (
"sentinel",
SENTINEL_FRAME,
FRAME_UNWIND_GDB,
NULL,
NULL,
NULL,
- sentinel_frame_prev_arch,
-};
+ sentinel_frame_prev_arch
+);
/* At present there is only one type of sentinel frame. */
-extern const struct frame_unwind sentinel_frame_unwind;
+extern const struct frame_unwind_legacy sentinel_frame_unwind;
#endif /* GDB_SENTINEL_FRAME_H */
*this_id = frame_id_build (cache->saved_sp, cache->pc);
}
-static const struct frame_unwind sh_frame_unwind = {
+static const struct frame_unwind_legacy sh_frame_unwind (
"sh prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
sh_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
sh_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return 0;
}
-static const struct frame_unwind sh_stub_unwind =
-{
+static const struct frame_unwind_legacy sh_stub_unwind (
"sh stub",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
sh_frame_prev_register,
NULL,
sh_stub_unwind_sniffer
-};
+);
/* Implement the stack_frame_destroyed_p gdbarch method.
return 0;
}
-static const struct frame_unwind sparc32nbsd_sigcontext_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc32nbsd_sigcontext_frame_unwind (
"sparc32 netbsd sigcontext",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
sparc32nbsd_sigcontext_frame_prev_register,
NULL,
sparc32nbsd_sigcontext_frame_sniffer
-};
+);
\f
/* Return the address of a system call's alternative return
address. */
return 0;
}
-static const struct frame_unwind sparc32obsd_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc32obsd_sigtramp_frame_unwind (
"sparc32 openbsd sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
sparc32obsd_sigtramp_frame_prev_register,
NULL,
sparc32obsd_sigtramp_frame_sniffer
-};
+);
\f
return sol2_sigtramp_p (this_frame);
}
-static const struct frame_unwind sparc32_sol2_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc32_sol2_sigtramp_frame_unwind (
"sparc32 solaris sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
sparc32_sol2_sigtramp_frame_prev_register,
NULL,
sparc32_sol2_sigtramp_frame_sniffer
-};
+);
\f
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind sparc32_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc32_frame_unwind (
"sparc32 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
sparc32_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
static CORE_ADDR
return 0;
}
-static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc64fbsd_sigtramp_frame_unwind (
"sparc64 freebsd sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
sparc64fbsd_sigtramp_frame_prev_register,
NULL,
sparc64fbsd_sigtramp_frame_sniffer
-};
+);
\f
static const struct regset sparc64fbsd_gregset =
return 0;
}
-static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc64nbsd_sigcontext_frame_unwind (
"sparc64 netbsd sigcontext",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
sparc64nbsd_sigcontext_frame_prev_register,
NULL,
sparc64nbsd_sigtramp_frame_sniffer
-};
+);
\f
static const struct regset sparc64nbsd_gregset =
return 0;
}
-static const struct frame_unwind sparc64obsd_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc64obsd_frame_unwind (
"sparc64 openbsd sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
sparc64obsd_frame_prev_register,
NULL,
sparc64obsd_sigtramp_frame_sniffer
-};
+);
\f
/* Kernel debugging support. */
return 0;
}
-static const struct frame_unwind sparc64obsd_trapframe_unwind =
-{
+static const struct frame_unwind_legacy sparc64obsd_trapframe_unwind (
"sparc64 openbsd trap",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
sparc64obsd_trapframe_prev_register,
NULL,
sparc64obsd_trapframe_sniffer
-};
+);
\f
/* Threads support. */
return sol2_sigtramp_p (this_frame);
}
-static const struct frame_unwind sparc64_sol2_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc64_sol2_sigtramp_frame_unwind (
"sparc64 solaris sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
sparc64_sol2_sigtramp_frame_prev_register,
NULL,
sparc64_sol2_sigtramp_frame_sniffer
-};
+);
\f
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static const struct frame_unwind sparc64_frame_unwind =
-{
+static const struct frame_unwind_legacy sparc64_frame_unwind (
"sparc64 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
sparc64_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
static CORE_ADDR
return info->base;
}
-static const struct frame_unwind tic6x_frame_unwind =
-{
+static const struct frame_unwind_legacy tic6x_frame_unwind (
"tic6x prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
tic6x_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static const struct frame_base tic6x_frame_base =
{
return 0;
}
-static const struct frame_unwind tic6x_stub_unwind =
-{
+static const struct frame_unwind_legacy tic6x_stub_unwind (
"tic6x stub",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
tic6x_frame_prev_register,
NULL,
tic6x_stub_unwind_sniffer
-};
+);
/* Return the instruction on address PC. */
return cache->base;
}
-static const struct frame_unwind tilegx_frame_unwind = {
+static const struct frame_unwind_legacy tilegx_frame_unwind (
"tilegx prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
NULL, /* const struct frame_data *unwind_data */
default_frame_sniffer, /* frame_sniffer_ftype *sniffer */
NULL /* frame_prev_pc_ftype *prev_pc */
-};
+);
static const struct frame_base tilegx_frame_base = {
&tilegx_frame_unwind,
return tramp_cache->trad_cache;
}
-static void
-tramp_frame_this_id (const frame_info_ptr &this_frame,
- void **this_cache,
- struct frame_id *this_id)
+class frame_unwind_trampoline : public frame_unwind
+{
+public:
+ frame_unwind_trampoline (enum frame_type type, const struct frame_data *data,
+ frame_prev_arch_ftype *prev_arch_func)
+ : frame_unwind ("trampoline", type, FRAME_UNWIND_GDB, data),
+ m_prev_arch (prev_arch_func)
+ { }
+
+ int sniff (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const override;
+
+ void this_id (const frame_info_ptr &this_frame, void **this_prologue_cache,
+ struct frame_id *id) const override;
+
+ value *prev_register (const frame_info_ptr &this_frame,
+ void **this_prologue_cache,
+ int regnum) const override;
+
+ struct gdbarch *prev_arch (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const override
+ {
+ if (m_prev_arch == nullptr)
+ return frame_unwind::prev_arch (this_frame, this_prologue_cache);
+ return m_prev_arch (this_frame, this_prologue_cache);
+ }
+
+private:
+ frame_prev_arch_ftype *m_prev_arch;
+};
+
+void
+frame_unwind_trampoline::this_id (const frame_info_ptr &this_frame,
+ void **this_cache,
+ struct frame_id *this_id) const
{
struct trad_frame_cache *trad_cache
= tramp_frame_cache (this_frame, this_cache);
trad_frame_get_id (trad_cache, this_id);
}
-static struct value *
-tramp_frame_prev_register (const frame_info_ptr &this_frame,
- void **this_cache,
- int prev_regnum)
+struct value *
+frame_unwind_trampoline::prev_register (const frame_info_ptr &this_frame,
+ void **this_cache,
+ int prev_regnum) const
{
struct trad_frame_cache *trad_cache
= tramp_frame_cache (this_frame, this_cache);
return 0;
}
-static int
-tramp_frame_sniffer (const struct frame_unwind *self,
- const frame_info_ptr &this_frame,
- void **this_cache)
+int
+frame_unwind_trampoline::sniff (const frame_info_ptr &this_frame,
+ void **this_cache) const
{
- const struct tramp_frame *tramp = self->unwind_data->tramp_frame;
+ const struct tramp_frame *tramp = unwind_data ()->tramp_frame;
CORE_ADDR pc = get_frame_pc (this_frame);
CORE_ADDR func;
struct tramp_frame_cache *tramp_cache;
gdb_assert (tramp_frame->insn_size <= sizeof (tramp_frame->insn[0].bytes));
data = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_data);
- unwinder = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_unwind);
-
data->tramp_frame = tramp_frame;
- unwinder->type = tramp_frame->frame_type;
- unwinder->unwind_data = data;
- unwinder->unwinder_class = FRAME_UNWIND_GDB;
- unwinder->sniffer = tramp_frame_sniffer;
- unwinder->stop_reason = default_frame_unwind_stop_reason;
- unwinder->this_id = tramp_frame_this_id;
- unwinder->prev_register = tramp_frame_prev_register;
- unwinder->prev_arch = tramp_frame->prev_arch;
+
+ unwinder = obstack_new <frame_unwind_trampoline> (gdbarch_obstack (gdbarch),
+ tramp_frame->frame_type,
+ data,
+ tramp_frame->prev_arch);
frame_unwind_prepend_unwinder (gdbarch, unwinder);
}
*this_id = frame_id_build (cache->saved_regs[E_SP_REGNUM].addr (), cache->pc);
}
-static const struct frame_unwind v850_frame_unwind = {
+static const struct frame_unwind_legacy v850_frame_unwind (
"v850 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
v850_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
v850_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
}
-static const struct frame_unwind vax_frame_unwind =
-{
+static const struct frame_unwind_legacy vax_frame_unwind (
"vax prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
vax_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
\f
static CORE_ADDR
return cache;
}
-static struct value *
-cygwin_sigwrapper_frame_prev_register (const frame_info_ptr &this_frame,
- void **this_cache,
- int regnum)
+struct value *
+cygwin_sigwrapper_frame_unwind::prev_register
+ (const frame_info_ptr &this_frame, void **this_cache, int regnum) const
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct cygwin_sigwrapper_frame_cache *cache
return frame_unwind_got_register (this_frame, regnum, regnum);
}
-static void
-cygwin_sigwrapper_frame_this_id (const frame_info_ptr &this_frame,
- void **this_cache,
- struct frame_id *this_id)
+void
+cygwin_sigwrapper_frame_unwind::this_id (const frame_info_ptr &this_frame,
+ void **this_cache,
+ struct frame_id *this_id) const
{
*this_id = frame_id_build_unavailable_stack (get_frame_func (this_frame));
}
-static int
-cygwin_sigwrapper_frame_sniffer (const struct frame_unwind *self_,
- const frame_info_ptr &this_frame,
- void **this_cache)
+int
+cygwin_sigwrapper_frame_unwind::sniff (const frame_info_ptr &this_frame,
+ void **this_cache) const
{
- const auto *self = (const struct cygwin_sigwrapper_frame_unwind *) self_;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
paddress (gdbarch, end));
int tlsoffset;
- cygwin_sigwrapper_frame_analyze (gdbarch, start, end, self->patterns_list,
+ cygwin_sigwrapper_frame_analyze (gdbarch, start, end, patterns_list,
&tlsoffset);
if (tlsoffset == 0)
return 0;
cygwin_sigwrapper_frame_unwind::cygwin_sigwrapper_frame_unwind
(gdb::array_view<const gdb::array_view<const gdb_byte>> patterns_list)
- : frame_unwind (),
- patterns_list (patterns_list)
+ : frame_unwind ("cygwin sigwrapper", NORMAL_FRAME, FRAME_UNWIND_GDB,
+ nullptr), patterns_list (patterns_list)
{
- name = "cygwin sigwrapper";
- type = NORMAL_FRAME;
- stop_reason = default_frame_unwind_stop_reason;
- this_id = cygwin_sigwrapper_frame_this_id;
- prev_register = cygwin_sigwrapper_frame_prev_register;
- sniffer = cygwin_sigwrapper_frame_sniffer;
}
/* Cygwin sigwapper unwinder. Unwinds signal frames over
sigbe/sigdelayed. */
-struct cygwin_sigwrapper_frame_unwind : public frame_unwind
+class cygwin_sigwrapper_frame_unwind : public frame_unwind
{
+public:
explicit cygwin_sigwrapper_frame_unwind
(gdb::array_view<const gdb::array_view<const gdb_byte>> patterns_list);
If any pattern in the list matches, then the frame is assumed to
be a sigwrapper frame. */
gdb::array_view<const gdb::array_view<const gdb_byte>> patterns_list;
+
+ /* Calculate the frame ID of a cygwin wrapper. */
+ void this_id (const frame_info_ptr &this_frame, void **this_prologue_cache,
+ struct frame_id *id) const override;
+
+ /* Sniff the frame to tell if this unwinder should be used. */
+ int sniff (const frame_info_ptr &this_frame,
+ void **this_prologue_cache) const override;
+
+ /* Calculate the value of a given register in the previous frame. */
+ struct value *prev_register (const frame_info_ptr &this_frame,
+ void **this_cache,
+ int regnum) const override;
};
#endif /* GDB_WINDOWS_TDEP_H */
return cache->base;
}
-static const struct frame_unwind xstormy16_frame_unwind = {
+static const struct frame_unwind_legacy xstormy16_frame_unwind (
"xstormy16 prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
xstormy16_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static const struct frame_base xstormy16_frame_base = {
&xstormy16_frame_unwind,
}
-static const struct frame_unwind
-xtensa_unwind =
-{
+static const struct frame_unwind_legacy xtensa_unwind (
"xtensa prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
xtensa_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
xtensa_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return 0;
}
-static const struct frame_unwind
-z80_frame_unwind =
-{
+static const struct frame_unwind_legacy z80_frame_unwind (
"z80",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
default_frame_sniffer
/*dealloc_cache*/
/*prev_arch*/
-};
+);
/* Initialize the gdbarch struct for the Z80 arch */
static struct gdbarch *