gdb: Migrate frame unwinders to use C++ classes

Frame unwinders have historically been a structure populated with
callback pointers, so that architectures (or other specific unwinders)
could install their own way to handle the inferior. However, since
moving to C++, we could use polymorphism to get the same functionality
in a more readable way. Polymorphism also makes it simpler to add new
functionality to all frame unwinders, since all that's required is
adding it to the base class.

As part of the changes to add support to disabling frame unwinders,
this commit makes the first baby step in  using polymorphism for the
frame unwinders, by making frame_unwind a virtual class, and adds a
couple of new classes. The main class added is frame_unwind_legacy,
which works the same as the previous structs, using function pointers
as callbacks. This class was added to allow the transition to happen
piecemeal. New unwinders should instead follow the lead of the other
classes implemented.

2 of the others, frame_unwind_python and frame_unwind_trampoline, were added
because it seemed simpler at the moment to do that instead of reworking
the dynamic allocation to work with the legacy class, and can be used as
an example to future implementations.

Finally, the cygwin unwinder was converted to a class since it was most
of the way there already.

Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
Guinevere Larsen
2024-03-14 16:14:27 +01:00
parent ce36ef63aa
commit 1239e7cf37
87 changed files with 553 additions and 402 deletions

View File

@@ -1205,8 +1205,7 @@ aarch64_prologue_prev_register (const frame_info_ptr &this_frame,
} }
/* AArch64 prologue unwinder. */ /* AArch64 prologue unwinder. */
static frame_unwind aarch64_prologue_unwind = static const frame_unwind_legacy aarch64_prologue_unwind (
{
"aarch64 prologue", "aarch64 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1215,7 +1214,7 @@ static frame_unwind aarch64_prologue_unwind =
aarch64_prologue_prev_register, aarch64_prologue_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Allocate and fill in *THIS_CACHE with information about the prologue of /* 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. *THIS_FRAME. Do not do this is if *THIS_CACHE was already allocated.
@@ -1301,8 +1300,7 @@ aarch64_stub_unwind_sniffer (const struct frame_unwind *self,
} }
/* AArch64 stub unwinder. */ /* AArch64 stub unwinder. */
static frame_unwind aarch64_stub_unwind = static const frame_unwind_legacy aarch64_stub_unwind (
{
"aarch64 stub", "aarch64 stub",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1311,7 +1309,7 @@ static frame_unwind aarch64_stub_unwind =
aarch64_prologue_prev_register, aarch64_prologue_prev_register,
NULL, NULL,
aarch64_stub_unwind_sniffer aarch64_stub_unwind_sniffer
}; );
/* Return the frame base address of *THIS_FRAME. */ /* Return the frame base address of *THIS_FRAME. */

View File

@@ -330,8 +330,7 @@ alpha_mdebug_frame_sniffer (const struct frame_unwind *self,
return 1; return 1;
} }
static const struct frame_unwind alpha_mdebug_frame_unwind = static const struct frame_unwind_legacy alpha_mdebug_frame_unwind (
{
"alpha mdebug", "alpha mdebug",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -340,7 +339,7 @@ static const struct frame_unwind alpha_mdebug_frame_unwind =
alpha_mdebug_frame_prev_register, alpha_mdebug_frame_prev_register,
NULL, NULL,
alpha_mdebug_frame_sniffer alpha_mdebug_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
alpha_mdebug_frame_base_address (const frame_info_ptr &this_frame, alpha_mdebug_frame_base_address (const frame_info_ptr &this_frame,

View File

@@ -1007,8 +1007,7 @@ alpha_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind alpha_sigtramp_frame_unwind = static const struct frame_unwind_legacy alpha_sigtramp_frame_unwind (
{
"alpha sigtramp", "alpha sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1017,7 +1016,7 @@ static const struct frame_unwind alpha_sigtramp_frame_unwind =
alpha_sigtramp_frame_prev_register, alpha_sigtramp_frame_prev_register,
NULL, NULL,
alpha_sigtramp_frame_sniffer alpha_sigtramp_frame_sniffer
}; );
@@ -1427,8 +1426,7 @@ alpha_heuristic_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); 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", "alpha prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1437,7 +1435,7 @@ static const struct frame_unwind alpha_heuristic_frame_unwind =
alpha_heuristic_frame_prev_register, alpha_heuristic_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
alpha_heuristic_frame_base_address (const frame_info_ptr &this_frame, alpha_heuristic_frame_base_address (const frame_info_ptr &this_frame,

View File

@@ -402,8 +402,7 @@ amd64obsd_trapframe_sniffer (const struct frame_unwind *self,
|| (startswith (name, "Xintr")))); || (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 /* FIXME: kettenis/20051219: This really is more like an interrupt
frame, but SIGTRAMP_FRAME would print <signal handler called>, frame, but SIGTRAMP_FRAME would print <signal handler called>,
which really is not what we want here. */ which really is not what we want here. */
@@ -415,7 +414,7 @@ static const struct frame_unwind amd64obsd_trapframe_unwind =
amd64obsd_trapframe_prev_register, amd64obsd_trapframe_prev_register,
NULL, NULL,
amd64obsd_trapframe_sniffer amd64obsd_trapframe_sniffer
}; );
static void static void

View File

@@ -2666,8 +2666,7 @@ amd64_frame_prev_register (const frame_info_ptr &this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "amd64 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2676,7 +2675,7 @@ static const struct frame_unwind amd64_frame_unwind =
amd64_frame_prev_register, amd64_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Generate a bytecode expression to get the value of the saved PC. */ /* Generate a bytecode expression to get the value of the saved PC. */
@@ -2813,8 +2812,7 @@ amd64_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind amd64_sigtramp_frame_unwind = static const struct frame_unwind_legacy amd64_sigtramp_frame_unwind (
{
"amd64 sigtramp", "amd64 sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2823,7 +2821,7 @@ static const struct frame_unwind amd64_sigtramp_frame_unwind =
amd64_sigtramp_frame_prev_register, amd64_sigtramp_frame_prev_register,
NULL, NULL,
amd64_sigtramp_frame_sniffer amd64_sigtramp_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
@@ -3006,8 +3004,7 @@ amd64_epilogue_frame_this_id (const frame_info_ptr &this_frame,
(*this_id) = frame_id_build (cache->base + 16, cache->pc); (*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", "amd64 epilogue override",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3016,10 +3013,9 @@ static const struct frame_unwind amd64_epilogue_override_frame_unwind =
amd64_frame_prev_register, amd64_frame_prev_register,
NULL, NULL,
amd64_epilogue_override_frame_sniffer 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", "amd64 epilogue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3028,7 +3024,7 @@ static const struct frame_unwind amd64_epilogue_frame_unwind =
amd64_frame_prev_register, amd64_frame_prev_register,
NULL, NULL,
amd64_epilogue_frame_sniffer amd64_epilogue_frame_sniffer
}; );
static struct frame_id static struct frame_id
amd64_dummy_id (struct gdbarch *gdbarch, const frame_info_ptr &this_frame) amd64_dummy_id (struct gdbarch *gdbarch, const frame_info_ptr &this_frame)

View File

@@ -1184,8 +1184,7 @@ amd64_windows_frame_this_id (const frame_info_ptr &this_frame, void **this_cache
/* Windows x64 SEH unwinder. */ /* 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", "amd64 windows",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1194,7 +1193,7 @@ static const struct frame_unwind amd64_windows_frame_unwind =
&amd64_windows_frame_prev_register, &amd64_windows_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Implement the "skip_prologue" gdbarch method. */ /* Implement the "skip_prologue" gdbarch method. */

View File

@@ -889,7 +889,7 @@ amdgpu_frame_prev_register (const frame_info_ptr &this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "amdgpu",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -899,8 +899,8 @@ static const frame_unwind amdgpu_frame_unwind = {
nullptr, nullptr,
default_frame_sniffer, default_frame_sniffer,
nullptr, nullptr,
nullptr, nullptr
}; );
static int static int
print_insn_amdgpu (bfd_vma memaddr, struct disassemble_info *info) print_insn_amdgpu (bfd_vma memaddr, struct disassemble_info *info)

View File

@@ -1910,7 +1910,7 @@ arc_sigtramp_frame_sniffer (const struct frame_unwind *self,
the fallback unwinder, we use the default frame sniffer, which always the fallback unwinder, we use the default frame sniffer, which always
accepts the frame. */ accepts the frame. */
static const struct frame_unwind arc_frame_unwind = { static const struct frame_unwind_legacy arc_frame_unwind (
"arc prologue", "arc prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1921,13 +1921,13 @@ static const struct frame_unwind arc_frame_unwind = {
default_frame_sniffer, default_frame_sniffer,
NULL, NULL,
NULL NULL
}; );
/* Structure defining the ARC signal frame unwind functions. Custom /* Structure defining the ARC signal frame unwind functions. Custom
sniffer is used, because this frame must be accepted only in the right sniffer is used, because this frame must be accepted only in the right
context. */ context. */
static const struct frame_unwind arc_sigtramp_frame_unwind = { static const struct frame_unwind_legacy arc_sigtramp_frame_unwind (
"arc sigtramp", "arc sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1938,7 +1938,7 @@ static const struct frame_unwind arc_sigtramp_frame_unwind = {
arc_sigtramp_frame_sniffer, arc_sigtramp_frame_sniffer,
NULL, NULL,
NULL NULL
}; );
static const struct frame_base arc_normal_base = { static const struct frame_base arc_normal_base = {

View File

@@ -2466,7 +2466,7 @@ arm_prologue_prev_register (const frame_info_ptr &this_frame,
prev_regnum); prev_regnum);
} }
static frame_unwind arm_prologue_unwind = { static const frame_unwind_legacy arm_prologue_unwind (
"arm prologue", "arm prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2475,7 +2475,7 @@ static frame_unwind arm_prologue_unwind = {
arm_prologue_prev_register, arm_prologue_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Maintain a list of ARM exception table entries per objfile, similar to the /* 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 list of mapping symbols. We only cache entries for standard ARM-defined
@@ -3186,7 +3186,7 @@ arm_exidx_unwind_sniffer (const struct frame_unwind *self,
return 1; return 1;
} }
struct frame_unwind arm_exidx_unwind = { struct frame_unwind_legacy arm_exidx_unwind (
"arm exidx", "arm exidx",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3195,7 +3195,7 @@ struct frame_unwind arm_exidx_unwind = {
arm_prologue_prev_register, arm_prologue_prev_register,
NULL, NULL,
arm_exidx_unwind_sniffer arm_exidx_unwind_sniffer
}; );
static struct arm_prologue_cache * static struct arm_prologue_cache *
arm_make_epilogue_frame_cache (const frame_info_ptr &this_frame) arm_make_epilogue_frame_cache (const frame_info_ptr &this_frame)
@@ -3296,8 +3296,7 @@ arm_epilogue_frame_sniffer (const struct frame_unwind *self,
/* Frame unwinder from epilogue. */ /* 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", "arm epilogue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3305,8 +3304,8 @@ static const struct frame_unwind arm_epilogue_frame_unwind =
arm_epilogue_frame_this_id, arm_epilogue_frame_this_id,
arm_epilogue_frame_prev_register, arm_epilogue_frame_prev_register,
NULL, NULL,
arm_epilogue_frame_sniffer, arm_epilogue_frame_sniffer
}; );
/* Recognize GCC's trampoline for thumb call-indirect. If we are in a /* Recognize GCC's trampoline for thumb call-indirect. If we are in a
trampoline, return the target PC. Otherwise return 0. trampoline, return the target PC. Otherwise return 0.
@@ -3427,7 +3426,7 @@ arm_stub_unwind_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
struct frame_unwind arm_stub_unwind = { struct frame_unwind_legacy arm_stub_unwind (
"arm stub", "arm stub",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3436,7 +3435,7 @@ struct frame_unwind arm_stub_unwind = {
arm_prologue_prev_register, arm_prologue_prev_register,
NULL, NULL,
arm_stub_unwind_sniffer arm_stub_unwind_sniffer
}; );
/* Put here the code to store, into CACHE->saved_regs, the addresses /* Put here the code to store, into CACHE->saved_regs, the addresses
of the saved registers of frame described by THIS_FRAME. CACHE is of the saved registers of frame described by THIS_FRAME. CACHE is
@@ -3953,8 +3952,7 @@ arm_m_exception_unwind_sniffer (const struct frame_unwind *self,
/* Frame unwinder for M-profile exceptions (EXC_RETURN on stack), /* Frame unwinder for M-profile exceptions (EXC_RETURN on stack),
lockup and secure/nonsecure interstate function calls (FNC_RETURN). */ 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", "arm m exception lockup sec_fnc",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3963,7 +3961,7 @@ struct frame_unwind arm_m_exception_unwind =
arm_m_exception_prev_register, arm_m_exception_prev_register,
NULL, NULL,
arm_m_exception_unwind_sniffer arm_m_exception_unwind_sniffer
}; );
static CORE_ADDR static CORE_ADDR
arm_normal_frame_base (const frame_info_ptr &this_frame, void **this_cache) arm_normal_frame_base (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -1155,7 +1155,7 @@ avr_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); 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", "avr prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1164,7 +1164,7 @@ static const struct frame_unwind avr_frame_unwind = {
avr_frame_prev_register, avr_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
avr_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) avr_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -372,8 +372,7 @@ bfin_frame_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "bfin prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -382,7 +381,7 @@ static const struct frame_unwind bfin_frame_unwind =
bfin_frame_prev_register, bfin_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Check for "[--SP] = <reg>;" insns. These are appear in function /* Check for "[--SP] = <reg>;" insns. These are appear in function
prologues to save misc registers onto the stack. */ prologues to save misc registers onto the stack. */

View File

@@ -181,8 +181,7 @@ bpf_frame_prev_register (const frame_info_ptr &this_frame,
/* Frame unwinder machinery for BPF. */ /* Frame unwinder machinery for BPF. */
static const struct frame_unwind bpf_frame_unwind = static const struct frame_unwind_legacy bpf_frame_unwind (
{
"bpf prologue", "bpf prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -191,7 +190,7 @@ static const struct frame_unwind bpf_frame_unwind =
bpf_frame_prev_register, bpf_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Breakpoints. */ /* Breakpoints. */

View File

@@ -435,8 +435,7 @@ cris_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind cris_sigtramp_frame_unwind = static const struct frame_unwind_legacy cris_sigtramp_frame_unwind (
{
"cris sigtramp", "cris sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -445,7 +444,7 @@ static const struct frame_unwind cris_sigtramp_frame_unwind =
cris_sigtramp_frame_prev_register, cris_sigtramp_frame_prev_register,
NULL, NULL,
cris_sigtramp_frame_sniffer cris_sigtramp_frame_sniffer
}; );
static int static int
crisv32_single_step_through_delay (struct gdbarch *gdbarch, crisv32_single_step_through_delay (struct gdbarch *gdbarch,
@@ -901,8 +900,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp; return sp;
} }
static const struct frame_unwind cris_frame_unwind = static const struct frame_unwind_legacy cris_frame_unwind (
{
"cris prologue", "cris prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -911,7 +909,7 @@ static const struct frame_unwind cris_frame_unwind =
cris_frame_prev_register, cris_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
cris_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) cris_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -2159,7 +2159,7 @@ csky_frame_prev_register (const frame_info_ptr &this_frame,
/* Data structures for the normal prologue-analysis-based /* Data structures for the normal prologue-analysis-based
unwinder. */ unwinder. */
static const struct frame_unwind csky_unwind_cache = { static const struct frame_unwind_legacy csky_unwind_cache (
"cski prologue", "cski prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2170,7 +2170,7 @@ static const struct frame_unwind csky_unwind_cache = {
default_frame_sniffer, default_frame_sniffer,
NULL, NULL,
NULL NULL
}; );
static CORE_ADDR static CORE_ADDR
csky_check_long_branch (const frame_info_ptr &frame, CORE_ADDR pc) csky_check_long_branch (const frame_info_ptr &frame, CORE_ADDR pc)
@@ -2294,7 +2294,7 @@ csky_stub_prev_register (const frame_info_ptr &this_frame,
prev_regnum); prev_regnum);
} }
static frame_unwind csky_stub_unwind = { static const frame_unwind_legacy csky_stub_unwind (
"csky stub", "csky stub",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2303,7 +2303,7 @@ static frame_unwind csky_stub_unwind = {
csky_stub_prev_register, csky_stub_prev_register,
NULL, NULL,
csky_stub_unwind_sniffer csky_stub_unwind_sniffer
}; );
/* Implement the this_base, this_locals, and this_args hooks /* Implement the this_base, this_locals, and this_args hooks
for the normal unwinder. */ for the normal unwinder. */

View File

@@ -375,8 +375,7 @@ dummy_frame_this_id (const frame_info_ptr &this_frame,
(*this_id) = cache->this_id; (*this_id) = cache->this_id;
} }
const struct frame_unwind dummy_frame_unwind = const struct frame_unwind_legacy dummy_frame_unwind (
{
"dummy", "dummy",
DUMMY_FRAME, DUMMY_FRAME,
FRAME_UNWIND_GDB, FRAME_UNWIND_GDB,
@@ -384,8 +383,8 @@ const struct frame_unwind dummy_frame_unwind =
dummy_frame_this_id, dummy_frame_this_id,
dummy_frame_prev_register, dummy_frame_prev_register,
NULL, NULL,
dummy_frame_sniffer, dummy_frame_sniffer
}; );
/* See dummy-frame.h. */ /* See dummy-frame.h. */

View File

@@ -54,7 +54,7 @@ extern void dummy_frame_discard (frame_id dummy_id, thread_info *thread);
/* If the PC falls in a dummy frame, return a dummy frame /* If the PC falls in a dummy frame, return a dummy frame
unwinder. */ 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. /* Destructor for dummy_frame. DATA is supplied by registrant.
REGISTERS_VALID is 1 for dummy_frame_pop, 0 for dummy_frame_discard. */ REGISTERS_VALID is 1 for dummy_frame_pop, 0 for dummy_frame_discard. */

View File

@@ -468,8 +468,7 @@ tailcall_frame_prev_arch (const frame_info_ptr &this_frame,
/* Virtual tail call frame unwinder if dwarf2_tailcall_sniffer_first finds /* Virtual tail call frame unwinder if dwarf2_tailcall_sniffer_first finds
a chain to create. */ a chain to create. */
const struct frame_unwind dwarf2_tailcall_frame_unwind = const struct frame_unwind_legacy dwarf2_tailcall_frame_unwind (
{
"dwarf2 tailcall", "dwarf2 tailcall",
TAILCALL_FRAME, TAILCALL_FRAME,
FRAME_UNWIND_DEBUGINFO, FRAME_UNWIND_DEBUGINFO,
@@ -480,7 +479,7 @@ const struct frame_unwind dwarf2_tailcall_frame_unwind =
tailcall_frame_sniffer, tailcall_frame_sniffer,
tailcall_frame_dealloc_cache, tailcall_frame_dealloc_cache,
tailcall_frame_prev_arch tailcall_frame_prev_arch
}; );
void _initialize_tailcall_frame (); void _initialize_tailcall_frame ();
void void

View File

@@ -34,6 +34,6 @@ extern struct value *
dwarf2_tailcall_prev_register_first (const frame_info_ptr &this_frame, dwarf2_tailcall_prev_register_first (const frame_info_ptr &this_frame,
void **tailcall_cachep, int regnum); 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 */ #endif /* GDB_DWARF2_FRAME_TAILCALL_H */

View File

@@ -1329,16 +1329,15 @@ dwarf2_frame_sniffer (const struct frame_unwind *self,
if (fde->cie->signal_frame if (fde->cie->signal_frame
|| dwarf2_frame_signal_frame_p (get_frame_arch (this_frame), || dwarf2_frame_signal_frame_p (get_frame_arch (this_frame),
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 0;
return 1; return 1;
} }
static const struct frame_unwind dwarf2_frame_unwind = static const struct frame_unwind_legacy dwarf2_frame_unwind (
{
"dwarf2", "dwarf2",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_DEBUGINFO, FRAME_UNWIND_DEBUGINFO,
@@ -1348,10 +1347,9 @@ static const struct frame_unwind dwarf2_frame_unwind =
NULL, NULL,
dwarf2_frame_sniffer, dwarf2_frame_sniffer,
dwarf2_frame_dealloc_cache 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", "dwarf2 signal",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_DEBUGINFO, FRAME_UNWIND_DEBUGINFO,
@@ -1363,7 +1361,7 @@ static const struct frame_unwind dwarf2_signal_frame_unwind =
/* TAILCALL_CACHE can never be in such frame to need dealloc_cache. */ /* TAILCALL_CACHE can never be in such frame to need dealloc_cache. */
NULL NULL
}; );
/* Append the DWARF-2 frame unwinders to GDBARCH's list. */ /* Append the DWARF-2 frame unwinders to GDBARCH's list. */

View File

@@ -122,8 +122,8 @@ frame_unwind_try_unwinder (const frame_info_ptr &this_frame, void **this_cache,
try try
{ {
frame_debug_printf ("trying unwinder \"%s\"", unwinder->name); frame_debug_printf ("trying unwinder \"%s\"", unwinder->name ());
res = unwinder->sniffer (unwinder, this_frame, this_cache); res = unwinder->sniff (this_frame, this_cache);
} }
catch (const gdb_exception &ex) catch (const gdb_exception &ex)
{ {
@@ -340,6 +340,64 @@ frame_unwind_got_address (const frame_info_ptr &frame, int regnum,
return reg_val; 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. */ /* Implement "maintenance info frame-unwinders" command. */
static void static void
@@ -358,10 +416,10 @@ maintenance_info_frame_unwinders (const char *args, int from_tty)
for (const auto &unwinder : table) for (const auto &unwinder : table)
{ {
ui_out_emit_list tuple_emitter (uiout, nullptr); ui_out_emit_list tuple_emitter (uiout, nullptr);
uiout->field_string ("name", unwinder->name); uiout->field_string ("name", unwinder->name ());
uiout->field_string ("type", frame_type_str (unwinder->type)); uiout->field_string ("type", frame_type_str (unwinder->type ()));
uiout->field_string ("class", frame_unwinder_class_str ( uiout->field_string ("class", frame_unwinder_class_str (
unwinder->unwinder_class)); unwinder->unwinder_class ()));
uiout->text ("\n"); uiout->text ("\n");
} }
} }

View File

@@ -171,25 +171,147 @@ enum frame_unwind_class
UNWIND_CLASS_NUMBER, 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 /* The frame's type. Should this instead be a collection of
predicates that test the frame for various attributes? */ 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 /* What kind of unwinder is this. It generally follows from where
the unwinder was added or where it looks for information to do the the unwinder was added or where it looks for information to do the
unwinding. */ unwinding. */
enum frame_unwind_class unwinder_class; frame_unwind_class m_unwinder_class;
/* Should an attribute indicating the frame's address-in-block go
here? */ /* Additional data used by the trampoline and python frame unwinders. */
frame_unwind_stop_reason_ftype *stop_reason; const frame_data *m_unwind_data;
frame_this_id_ftype *this_id; };
frame_prev_register_ftype *prev_register;
const struct frame_data *unwind_data; /* This is a legacy version of the frame unwinder. The original struct
frame_sniffer_ftype *sniffer; used function pointers for callbacks, this updated version has a
frame_dealloc_cache_ftype *dealloc_cache; method that just passes the parameters along to the callback
frame_prev_arch_ftype *prev_arch; 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 /* Register a frame unwinder, _prepending_ it to the front of the

View File

@@ -269,12 +269,10 @@ frame_addr_hash_eq (const void *a, const void *b)
static void static void
frame_info_del (frame_info *frame) frame_info_del (frame_info *frame)
{ {
if (frame->prologue_cache != nullptr if (frame->prologue_cache != nullptr)
&& frame->unwind->dealloc_cache != nullptr)
frame->unwind->dealloc_cache (frame, frame->prologue_cache); frame->unwind->dealloc_cache (frame, frame->prologue_cache);
if (frame->base_cache != nullptr if (frame->base_cache != nullptr)
&& frame->base->unwind->dealloc_cache != nullptr)
frame->base->unwind->dealloc_cache (frame, frame->base_cache); frame->base->unwind->dealloc_cache (frame, frame->base_cache);
} }
@@ -487,12 +485,12 @@ frame_info::to_string () const
res += string_printf ("{level=%d,", fi->level); res += string_printf ("{level=%d,", fi->level);
if (fi->unwind != NULL) 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 else
res += "type=<unknown>,"; res += "type=<unknown>,";
if (fi->unwind != NULL) if (fi->unwind != NULL)
res += string_printf ("unwinder=\"%s\",", fi->unwind->name); res += string_printf ("unwinder=\"%s\",", fi->unwind->name ());
else else
res += "unwinder=<unknown>,"; res += "unwinder=<unknown>,";
@@ -2366,7 +2364,7 @@ get_prev_frame_always_1 (const frame_info_ptr &this_frame)
This check is valid only if this frame and the next frame are NORMAL. This check is valid only if this frame and the next frame are NORMAL.
See the comment at frame_id_inner for details. */ See the comment at frame_id_inner for details. */
if (get_frame_type (this_frame) == NORMAL_FRAME 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)), && frame_id_inner (get_frame_arch (frame_info_ptr (this_frame->next)),
get_frame_id (this_frame), get_frame_id (this_frame),
get_frame_id (frame_info_ptr (this_frame->next)))) get_frame_id (frame_info_ptr (this_frame->next))))
@@ -2994,7 +2992,7 @@ get_frame_type (const frame_info_ptr &frame)
/* Initialize the frame's unwinder because that's what /* Initialize the frame's unwinder because that's what
provides the frame's type. */ provides the frame's type. */
frame_unwind_find_by_frame (frame, &frame->prologue_cache); frame_unwind_find_by_frame (frame, &frame->prologue_cache);
return frame->unwind->type; return frame->unwind->type ();
} }
struct program_space * struct program_space *
@@ -3075,11 +3073,8 @@ frame_unwind_arch (const frame_info_ptr &next_frame)
if (next_frame->unwind == NULL) if (next_frame->unwind == NULL)
frame_unwind_find_by_frame (next_frame, &next_frame->prologue_cache); 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, arch = next_frame->unwind->prev_arch (next_frame,
&next_frame->prologue_cache); &next_frame->prologue_cache);
else
arch = get_frame_arch (next_frame);
next_frame->prev_arch.arch = arch; next_frame->prev_arch.arch = arch;
next_frame->prev_arch.p = true; next_frame->prev_arch.p = true;

View File

@@ -332,8 +332,7 @@ frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; 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", "frv linux sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -342,7 +341,7 @@ static const struct frame_unwind frv_linux_sigtramp_frame_unwind =
frv_linux_sigtramp_frame_prev_register, frv_linux_sigtramp_frame_prev_register,
NULL, NULL,
frv_linux_sigtramp_frame_sniffer frv_linux_sigtramp_frame_sniffer
}; );
/* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include /* 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.) */ the loadmap addresses in the register set. (See below for more info.) */

View File

@@ -1404,7 +1404,7 @@ frv_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); 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", "frv prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1413,7 +1413,7 @@ static const struct frame_unwind frv_frame_unwind = {
frv_frame_prev_register, frv_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
frv_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) frv_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -525,8 +525,7 @@ ft32_frame_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "ft32 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -535,7 +534,7 @@ static const struct frame_unwind ft32_frame_unwind =
ft32_frame_prev_register, ft32_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Return the base address of this_frame. */ /* Return the base address of this_frame. */

View File

@@ -500,7 +500,7 @@ h8300_frame_prev_register (const frame_info_ptr &this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "h8300 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -509,7 +509,7 @@ static const struct frame_unwind h8300_frame_unwind = {
h8300_frame_prev_register, h8300_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
h8300_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) h8300_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -308,7 +308,7 @@ hppa_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; 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", "hppa linux sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -317,7 +317,7 @@ static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = {
hppa_linux_sigtramp_frame_prev_register, hppa_linux_sigtramp_frame_prev_register,
NULL, NULL,
hppa_linux_sigtramp_frame_sniffer hppa_linux_sigtramp_frame_sniffer
}; );
/* Attempt to find (and return) the global pointer for the given /* Attempt to find (and return) the global pointer for the given
function. function.

View File

@@ -2282,8 +2282,7 @@ hppa_frame_unwind_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind hppa_frame_unwind = static const struct frame_unwind_legacy hppa_frame_unwind (
{
"hppa unwind table", "hppa unwind table",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2292,7 +2291,7 @@ static const struct frame_unwind hppa_frame_unwind =
hppa_frame_prev_register, hppa_frame_prev_register,
NULL, NULL,
hppa_frame_unwind_sniffer hppa_frame_unwind_sniffer
}; );
/* This is a generic fallback frame unwinder that kicks in if we fail all /* 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 the other ones. Normally we would expect the stub and regular unwinder
@@ -2396,8 +2395,7 @@ hppa_fallback_frame_prev_register (const frame_info_ptr &this_frame,
info->saved_regs, regnum); 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", "hppa prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2406,7 +2404,7 @@ static const struct frame_unwind hppa_fallback_frame_unwind =
hppa_fallback_frame_prev_register, hppa_fallback_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Stub frames, used for all kinds of call stubs. */ /* Stub frames, used for all kinds of call stubs. */
struct hppa_stub_unwind_cache struct hppa_stub_unwind_cache
@@ -2479,7 +2477,7 @@ hppa_stub_unwind_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind hppa_stub_frame_unwind = { static const struct frame_unwind_legacy hppa_stub_frame_unwind (
"hppa stub", "hppa stub",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2488,7 +2486,7 @@ static const struct frame_unwind hppa_stub_frame_unwind = {
hppa_stub_frame_prev_register, hppa_stub_frame_prev_register,
NULL, NULL,
hppa_stub_unwind_sniffer hppa_stub_unwind_sniffer
}; );
CORE_ADDR CORE_ADDR
hppa_unwind_pc (struct gdbarch *gdbarch, const frame_info_ptr &next_frame) hppa_unwind_pc (struct gdbarch *gdbarch, const frame_info_ptr &next_frame)

View File

@@ -390,7 +390,7 @@ i386obsd_trapframe_sniffer (const struct frame_unwind *self,
|| startswith (name, "Xsoft"))); || startswith (name, "Xsoft")));
} }
static const struct frame_unwind i386obsd_trapframe_unwind = { static const struct frame_unwind_legacy i386obsd_trapframe_unwind (
"i386 openbsd trap", "i386 openbsd trap",
/* FIXME: kettenis/20051219: This really is more like an interrupt /* FIXME: kettenis/20051219: This really is more like an interrupt
frame, but SIGTRAMP_FRAME would print <signal handler called>, frame, but SIGTRAMP_FRAME would print <signal handler called>,
@@ -402,7 +402,7 @@ static const struct frame_unwind i386obsd_trapframe_unwind = {
i386obsd_trapframe_prev_register, i386obsd_trapframe_prev_register,
NULL, NULL,
i386obsd_trapframe_sniffer i386obsd_trapframe_sniffer
}; );
static void static void

View File

@@ -2139,8 +2139,7 @@ i386_frame_prev_register (const frame_info_ptr &this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "i386 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2149,7 +2148,7 @@ static const struct frame_unwind i386_frame_unwind =
i386_frame_prev_register, i386_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Normal frames, but in a function epilogue. */ /* Normal frames, but in a function epilogue. */
@@ -2295,8 +2294,7 @@ i386_epilogue_frame_prev_register (const frame_info_ptr &this_frame,
return i386_frame_prev_register (this_frame, this_cache, regnum); 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", "i386 epilogue override",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2305,10 +2303,9 @@ static const struct frame_unwind i386_epilogue_override_frame_unwind =
i386_epilogue_frame_prev_register, i386_epilogue_frame_prev_register,
NULL, NULL,
i386_epilogue_override_frame_sniffer 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", "i386 epilogue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2317,7 +2314,7 @@ static const struct frame_unwind i386_epilogue_frame_unwind =
i386_epilogue_frame_prev_register, i386_epilogue_frame_prev_register,
NULL, NULL,
i386_epilogue_frame_sniffer i386_epilogue_frame_sniffer
}; );
/* Stack-based trampolines. */ /* Stack-based trampolines. */
@@ -2390,8 +2387,7 @@ i386_stack_tramp_frame_sniffer (const struct frame_unwind *self,
return 0; 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", "i386 stack tramp",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2400,7 +2396,7 @@ static const struct frame_unwind i386_stack_tramp_frame_unwind =
i386_epilogue_frame_prev_register, i386_epilogue_frame_prev_register,
NULL, NULL,
i386_stack_tramp_frame_sniffer i386_stack_tramp_frame_sniffer
}; );
/* Generate a bytecode expression to get the value of the saved PC. */ /* Generate a bytecode expression to get the value of the saved PC. */
@@ -2540,8 +2536,7 @@ i386_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind i386_sigtramp_frame_unwind = static const struct frame_unwind_legacy i386_sigtramp_frame_unwind (
{
"i386 sigtramp", "i386 sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2550,7 +2545,7 @@ static const struct frame_unwind i386_sigtramp_frame_unwind =
i386_sigtramp_frame_prev_register, i386_sigtramp_frame_prev_register,
NULL, NULL,
i386_sigtramp_frame_sniffer i386_sigtramp_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR

View File

@@ -2162,8 +2162,7 @@ ia64_frame_prev_register (const frame_info_ptr &this_frame, void **this_cache,
} }
} }
static const struct frame_unwind ia64_frame_unwind = static const struct frame_unwind_legacy ia64_frame_unwind (
{
"ia64 prologue", "ia64 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2172,7 +2171,7 @@ static const struct frame_unwind ia64_frame_unwind =
&ia64_frame_prev_register, &ia64_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Signal trampolines. */ /* Signal trampolines. */
@@ -2352,8 +2351,7 @@ ia64_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind ia64_sigtramp_frame_unwind = static const struct frame_unwind_legacy ia64_sigtramp_frame_unwind (
{
"ia64 sigtramp", "ia64 sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2362,7 +2360,7 @@ static const struct frame_unwind ia64_sigtramp_frame_unwind =
ia64_sigtramp_frame_prev_register, ia64_sigtramp_frame_prev_register,
NULL, NULL,
ia64_sigtramp_frame_sniffer ia64_sigtramp_frame_sniffer
}; );
@@ -3013,8 +3011,7 @@ ia64_libunwind_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind ia64_libunwind_frame_unwind = static const struct frame_unwind_legacy ia64_libunwind_frame_unwind (
{
"ia64 libunwind", "ia64 libunwind",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3024,7 +3021,7 @@ static const struct frame_unwind ia64_libunwind_frame_unwind =
NULL, NULL,
ia64_libunwind_frame_sniffer, ia64_libunwind_frame_sniffer,
libunwind_frame_dealloc_cache libunwind_frame_dealloc_cache
}; );
static void static void
ia64_libunwind_sigtramp_frame_this_id (const frame_info_ptr &this_frame, ia64_libunwind_sigtramp_frame_this_id (const frame_info_ptr &this_frame,
@@ -3103,8 +3100,7 @@ ia64_libunwind_sigtramp_frame_sniffer (const struct frame_unwind *self,
return ia64_sigtramp_frame_sniffer (self, this_frame, this_cache); 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", "ia64 libunwind sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3113,7 +3109,7 @@ static const struct frame_unwind ia64_libunwind_sigtramp_frame_unwind =
ia64_libunwind_sigtramp_frame_prev_register, ia64_libunwind_sigtramp_frame_prev_register,
NULL, NULL,
ia64_libunwind_sigtramp_frame_sniffer ia64_libunwind_sigtramp_frame_sniffer
}; );
/* Set of libunwind callback acccessor functions. */ /* Set of libunwind callback acccessor functions. */
unw_accessors_t ia64_unw_accessors = unw_accessors_t ia64_unw_accessors =

View File

@@ -270,7 +270,7 @@ inline_frame_sniffer (const struct frame_unwind *self,
return 1; return 1;
} }
const struct frame_unwind inline_frame_unwind = { const struct frame_unwind_legacy inline_frame_unwind (
"inline", "inline",
INLINE_FRAME, INLINE_FRAME,
FRAME_UNWIND_GDB, FRAME_UNWIND_GDB,
@@ -279,7 +279,7 @@ const struct frame_unwind inline_frame_unwind = {
inline_frame_prev_register, inline_frame_prev_register,
NULL, NULL,
inline_frame_sniffer inline_frame_sniffer
}; );
/* Return non-zero if BLOCK, an inlined function block containing PC, /* Return non-zero if BLOCK, an inlined function block containing PC,
has a group of contiguous instructions starting at PC (but not has a group of contiguous instructions starting at PC (but not

View File

@@ -27,7 +27,7 @@ struct process_stratum_target;
/* The inline frame unwinder. */ /* 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. /* Skip all inlined functions whose call sites are at the current PC.

View File

@@ -424,7 +424,7 @@ iq2000_frame_this_id (const frame_info_ptr &this_frame, void **this_cache,
*this_id = frame_id_build (cache->saved_sp, cache->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", "iq2000 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -433,7 +433,7 @@ static const struct frame_unwind iq2000_frame_unwind = {
iq2000_frame_prev_register, iq2000_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
iq2000_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) iq2000_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -1112,8 +1112,7 @@ jit_frame_prev_register (const frame_info_ptr &this_frame, void **cache, int reg
/* Relay everything back to the unwinder registered by the JIT debug /* Relay everything back to the unwinder registered by the JIT debug
info reader.*/ info reader.*/
static const struct frame_unwind jit_frame_unwind = static const struct frame_unwind_legacy jit_frame_unwind (
{
"jit", "jit",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_EXTENSION, FRAME_UNWIND_EXTENSION,
@@ -1123,7 +1122,7 @@ static const struct frame_unwind jit_frame_unwind =
NULL, NULL,
jit_frame_sniffer, jit_frame_sniffer,
jit_dealloc_cache jit_dealloc_cache
}; );
/* This is the information that is stored at jit_gdbarch_data for each /* This is the information that is stored at jit_gdbarch_data for each

View File

@@ -447,7 +447,7 @@ lm32_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); 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", "lm32 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -456,7 +456,7 @@ static const struct frame_unwind lm32_frame_unwind = {
lm32_frame_prev_register, lm32_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
lm32_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) lm32_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -454,7 +454,7 @@ loongarch_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_register (info, this_frame, regnum); 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", "loongarch prologue",
/*.type =*/NORMAL_FRAME, /*.type =*/NORMAL_FRAME,
/*.unwinder_class=*/FRAME_UNWIND_ARCH, /*.unwinder_class=*/FRAME_UNWIND_ARCH,
@@ -464,8 +464,8 @@ static const struct frame_unwind loongarch_frame_unwind = {
/*.unwind_data =*/nullptr, /*.unwind_data =*/nullptr,
/*.sniffer =*/default_frame_sniffer, /*.sniffer =*/default_frame_sniffer,
/*.dealloc_cache =*/nullptr, /*.dealloc_cache =*/nullptr,
/*.prev_arch =*/nullptr, /*.prev_arch =*/nullptr
}; );
/* Write the contents of buffer VAL into the general-purpose argument /* Write the contents of buffer VAL into the general-purpose argument
register defined by GAR in REGCACHE. GAR indicates the available register defined by GAR in REGCACHE. GAR indicates the available

View File

@@ -1955,7 +1955,7 @@ m32c_prev_register (const frame_info_ptr &this_frame,
} }
static const struct frame_unwind m32c_unwind = { static const struct frame_unwind_legacy m32c_unwind (
"m32c prologue", "m32c prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1964,7 +1964,7 @@ static const struct frame_unwind m32c_unwind = {
m32c_prev_register, m32c_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Inferior calls. */ /* Inferior calls. */

View File

@@ -301,7 +301,7 @@ m32r_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; 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", "m32r linux sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -310,7 +310,7 @@ static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = {
m32r_linux_sigtramp_frame_prev_register, m32r_linux_sigtramp_frame_prev_register,
NULL, NULL,
m32r_linux_sigtramp_frame_sniffer m32r_linux_sigtramp_frame_sniffer
}; );
/* Mapping between the registers in `struct pt_regs' /* Mapping between the registers in `struct pt_regs'
format and GDB's register array layout. */ format and GDB's register array layout. */

View File

@@ -831,7 +831,7 @@ m32r_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); 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", "m32r prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -840,7 +840,7 @@ static const struct frame_unwind m32r_frame_unwind = {
m32r_frame_prev_register, m32r_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
m32r_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) m32r_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -933,7 +933,7 @@ m68hc11_frame_prev_register (const frame_info_ptr &this_frame,
return value; return value;
} }
static const struct frame_unwind m68hc11_frame_unwind = { static const struct frame_unwind_legacy m68hc11_frame_unwind (
"m68hc11 prologue", "m68hc11 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -942,7 +942,7 @@ static const struct frame_unwind m68hc11_frame_unwind = {
m68hc11_frame_prev_register, m68hc11_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
m68hc11_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) m68hc11_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -314,8 +314,7 @@ m68k_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
return m68k_linux_pc_in_sigtramp (this_frame); 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", "m68k linux sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -324,7 +323,7 @@ static const struct frame_unwind m68k_linux_sigtramp_frame_unwind =
m68k_linux_sigtramp_frame_prev_register, m68k_linux_sigtramp_frame_prev_register,
NULL, NULL,
m68k_linux_sigtramp_frame_sniffer m68k_linux_sigtramp_frame_sniffer
}; );
/* Register maps for supply/collect regset functions. */ /* Register maps for supply/collect regset functions. */

View File

@@ -1007,8 +1007,7 @@ m68k_frame_prev_register (const frame_info_ptr &this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "m68k prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1017,7 +1016,7 @@ static const struct frame_unwind m68k_frame_unwind =
m68k_frame_prev_register, m68k_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
m68k_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) m68k_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -2061,7 +2061,7 @@ mep_frame_prev_register (const frame_info_ptr &this_frame,
} }
static const struct frame_unwind mep_frame_unwind = { static const struct frame_unwind_legacy mep_frame_unwind (
"mep prologue", "mep prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2070,7 +2070,7 @@ static const struct frame_unwind mep_frame_unwind = {
mep_frame_prev_register, mep_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Return values. */ /* Return values. */

View File

@@ -478,8 +478,7 @@ microblaze_frame_prev_register (const frame_info_ptr &this_frame,
} }
static const struct frame_unwind microblaze_frame_unwind = static const struct frame_unwind_legacy microblaze_frame_unwind (
{
"microblaze prologue", "microblaze prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -488,7 +487,7 @@ static const struct frame_unwind microblaze_frame_unwind =
microblaze_frame_prev_register, microblaze_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
microblaze_frame_base_address (const frame_info_ptr &next_frame, microblaze_frame_base_address (const frame_info_ptr &next_frame,

View File

@@ -160,8 +160,7 @@ mips_sde_frame_sniffer (const struct frame_unwind *self,
/* Data structure for the SDE frame unwinder. */ /* 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", "mips sde sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -170,7 +169,7 @@ static const struct frame_unwind mips_sde_frame_unwind =
mips_sde_frame_prev_register, mips_sde_frame_prev_register,
NULL, NULL,
mips_sde_frame_sniffer mips_sde_frame_sniffer
}; );
/* Implement the this_base, this_locals, and this_args hooks /* Implement the this_base, this_locals, and this_args hooks
for the normal unwinder. */ for the normal unwinder. */

View File

@@ -2928,8 +2928,7 @@ mips_insn16_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind mips_insn16_frame_unwind = static const struct frame_unwind_legacy mips_insn16_frame_unwind (
{
"mips insn16 prologue", "mips insn16 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2938,7 +2937,7 @@ static const struct frame_unwind mips_insn16_frame_unwind =
mips_insn16_frame_prev_register, mips_insn16_frame_prev_register,
NULL, NULL,
mips_insn16_frame_sniffer mips_insn16_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
mips_insn16_frame_base_address (const frame_info_ptr &this_frame, mips_insn16_frame_base_address (const frame_info_ptr &this_frame,
@@ -3365,8 +3364,7 @@ mips_micro_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind mips_micro_frame_unwind = static const struct frame_unwind_legacy mips_micro_frame_unwind (
{
"mips micro prologue", "mips micro prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3375,7 +3373,7 @@ static const struct frame_unwind mips_micro_frame_unwind =
mips_micro_frame_prev_register, mips_micro_frame_prev_register,
NULL, NULL,
mips_micro_frame_sniffer mips_micro_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
mips_micro_frame_base_address (const frame_info_ptr &this_frame, mips_micro_frame_base_address (const frame_info_ptr &this_frame,
@@ -3745,8 +3743,7 @@ mips_insn32_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind mips_insn32_frame_unwind = static const struct frame_unwind_legacy mips_insn32_frame_unwind (
{
"mips insn32 prologue", "mips insn32 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3755,7 +3752,7 @@ static const struct frame_unwind mips_insn32_frame_unwind =
mips_insn32_frame_prev_register, mips_insn32_frame_prev_register,
NULL, NULL,
mips_insn32_frame_sniffer mips_insn32_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
mips_insn32_frame_base_address (const frame_info_ptr &this_frame, mips_insn32_frame_base_address (const frame_info_ptr &this_frame,
@@ -3862,8 +3859,7 @@ mips_stub_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind mips_stub_frame_unwind = static const struct frame_unwind_legacy mips_stub_frame_unwind (
{
"mips stub", "mips stub",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3872,7 +3868,7 @@ static const struct frame_unwind mips_stub_frame_unwind =
mips_stub_frame_prev_register, mips_stub_frame_prev_register,
NULL, NULL,
mips_stub_frame_sniffer mips_stub_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
mips_stub_frame_base_address (const frame_info_ptr &this_frame, mips_stub_frame_base_address (const frame_info_ptr &this_frame,

View File

@@ -1127,7 +1127,7 @@ mn10300_frame_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "mn10300 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1136,7 +1136,7 @@ static const struct frame_unwind mn10300_frame_unwind = {
mn10300_frame_prev_register, mn10300_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static void static void
mn10300_frame_unwind_init (struct gdbarch *gdbarch) mn10300_frame_unwind_init (struct gdbarch *gdbarch)

View File

@@ -585,7 +585,7 @@ moxie_frame_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "moxie prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -594,7 +594,7 @@ static const struct frame_unwind moxie_frame_unwind = {
moxie_frame_prev_register, moxie_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Return the base address of this_frame. */ /* Return the base address of this_frame. */

View File

@@ -542,7 +542,7 @@ msp430_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "msp430 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -551,7 +551,7 @@ static const struct frame_unwind msp430_unwind = {
msp430_prev_register, msp430_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Implement the "dwarf2_reg_to_regnum" gdbarch method. */ /* Implement the "dwarf2_reg_to_regnum" gdbarch method. */

View File

@@ -988,8 +988,7 @@ nds32_frame_prev_register (const frame_info_ptr &this_frame, void **this_cache,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "nds32 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -997,8 +996,8 @@ static const struct frame_unwind nds32_frame_unwind =
nds32_frame_this_id, nds32_frame_this_id,
nds32_frame_prev_register, nds32_frame_prev_register,
NULL, NULL,
default_frame_sniffer, default_frame_sniffer
}; );
/* Return the frame base address of *THIS_FRAME. */ /* Return the frame base address of *THIS_FRAME. */
@@ -1373,8 +1372,7 @@ nds32_epilogue_frame_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "nds32 epilogue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1383,7 +1381,7 @@ static const struct frame_unwind nds32_epilogue_frame_unwind =
nds32_epilogue_frame_prev_register, nds32_epilogue_frame_prev_register,
NULL, NULL,
nds32_epilogue_frame_sniffer nds32_epilogue_frame_sniffer
}; );
/* Floating type and struct type that has only one floating type member /* Floating type and struct type that has only one floating type member

View File

@@ -1125,7 +1125,7 @@ or1k_frame_prev_register (const frame_info_ptr &this_frame,
/* Data structures for the normal prologue-analysis-based unwinder. */ /* 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", "or1k prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1134,8 +1134,8 @@ static const struct frame_unwind or1k_frame_unwind = {
or1k_frame_prev_register, or1k_frame_prev_register,
NULL, NULL,
default_frame_sniffer, default_frame_sniffer,
NULL, NULL
}; );
/* Architecture initialization for OpenRISC 1000. */ /* Architecture initialization for OpenRISC 1000. */

View File

@@ -262,7 +262,7 @@ ppcfbsd_sigtramp_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_register (cache, this_frame, regnum); 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", "ppc freebsd sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -271,7 +271,7 @@ static const struct frame_unwind ppcfbsd_sigtramp_frame_unwind = {
ppcfbsd_sigtramp_frame_prev_register, ppcfbsd_sigtramp_frame_prev_register,
NULL, NULL,
ppcfbsd_sigtramp_frame_sniffer ppcfbsd_sigtramp_frame_sniffer
}; );
static enum return_value_convention static enum return_value_convention
ppcfbsd_return_value (struct gdbarch *gdbarch, struct value *function, ppcfbsd_return_value (struct gdbarch *gdbarch, struct value *function,

View File

@@ -231,7 +231,7 @@ ppcobsd_sigtramp_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_register (cache, this_frame, regnum); 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", "ppc openbsd sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -240,7 +240,7 @@ static const struct frame_unwind ppcobsd_sigtramp_frame_unwind = {
ppcobsd_sigtramp_frame_prev_register, ppcobsd_sigtramp_frame_prev_register,
NULL, NULL,
ppcobsd_sigtramp_frame_sniffer ppcobsd_sigtramp_frame_sniffer
}; );
static void static void

View File

@@ -785,11 +785,35 @@ pending_framepy_level (PyObject *self, PyObject *args)
return gdb_py_object_from_longest (level).release (); 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. */ /* frame_unwind.this_id method. */
static void void
pyuw_this_id (const frame_info_ptr &this_frame, void **cache_ptr, frame_unwind_python::this_id (const frame_info_ptr &this_frame,
struct frame_id *this_id) void **cache_ptr,
struct frame_id *this_id) const
{ {
*this_id = ((cached_frame_info *) *cache_ptr)->frame_id; *this_id = ((cached_frame_info *) *cache_ptr)->frame_id;
pyuw_debug_printf ("frame_id: %s", this_id->to_string ().c_str ()); pyuw_debug_printf ("frame_id: %s", this_id->to_string ().c_str ());
@@ -797,9 +821,9 @@ pyuw_this_id (const frame_info_ptr &this_frame, void **cache_ptr,
/* frame_unwind.prev_register. */ /* frame_unwind.prev_register. */
static struct value * struct value *
pyuw_prev_register (const frame_info_ptr &this_frame, void **cache_ptr, frame_unwind_python::prev_register (const frame_info_ptr &this_frame,
int regnum) void **cache_ptr, int regnum) const
{ {
PYUW_SCOPED_DEBUG_ENTER_EXIT; PYUW_SCOPED_DEBUG_ENTER_EXIT;
@@ -820,13 +844,13 @@ pyuw_prev_register (const frame_info_ptr &this_frame, void **cache_ptr,
/* Frame sniffer dispatch. */ /* Frame sniffer dispatch. */
static int int
pyuw_sniffer (const struct frame_unwind *self, const frame_info_ptr &this_frame, frame_unwind_python::sniff (const frame_info_ptr &this_frame,
void **cache_ptr) void **cache_ptr) const
{ {
PYUW_SCOPED_DEBUG_ENTER_EXIT; 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; cached_frame_info *cached_frame;
gdbpy_enter enter_py (gdbarch); gdbpy_enter enter_py (gdbarch);
@@ -948,8 +972,8 @@ pyuw_sniffer (const struct frame_unwind *self, const frame_info_ptr &this_frame,
/* Frame cache release shim. */ /* Frame cache release shim. */
static void void
pyuw_dealloc_cache (frame_info *this_frame, void *cache) frame_unwind_python::dealloc_cache (frame_info *this_frame, void *cache) const
{ {
PYUW_SCOPED_DEBUG_ENTER_EXIT; PYUW_SCOPED_DEBUG_ENTER_EXIT;
cached_frame_info *cached_frame = (cached_frame_info *) cache; cached_frame_info *cached_frame = (cached_frame_info *) cache;
@@ -981,17 +1005,9 @@ pyuw_on_new_gdbarch (gdbarch *newarch)
if (!data->unwinder_registered) if (!data->unwinder_registered)
{ {
struct frame_unwind *unwinder struct frame_unwind *unwinder
= GDBARCH_OBSTACK_ZALLOC (newarch, struct frame_unwind); = obstack_new<frame_unwind_python>
(gdbarch_obstack (newarch), (const struct frame_data *) newarch);
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;
frame_unwind_prepend_unwinder (newarch, unwinder); frame_unwind_prepend_unwinder (newarch, unwinder);
data->unwinder_registered = 1; data->unwinder_registered = 1;
} }

View File

@@ -1941,8 +1941,7 @@ record_btrace_frame_dealloc_cache (frame_info *self, void *this_cache)
Therefore this unwinder reports any possibly unwound registers as Therefore this unwinder reports any possibly unwound registers as
<unavailable>. */ <unavailable>. */
const struct frame_unwind record_btrace_frame_unwind = const struct frame_unwind_legacy record_btrace_frame_unwind (
{
"record-btrace", "record-btrace",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_GDB, FRAME_UNWIND_GDB,
@@ -1952,10 +1951,9 @@ const struct frame_unwind record_btrace_frame_unwind =
NULL, NULL,
record_btrace_frame_sniffer, record_btrace_frame_sniffer,
record_btrace_frame_dealloc_cache 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", "record-btrace tailcall",
TAILCALL_FRAME, TAILCALL_FRAME,
FRAME_UNWIND_GDB, FRAME_UNWIND_GDB,
@@ -1965,7 +1963,7 @@ const struct frame_unwind record_btrace_tailcall_frame_unwind =
NULL, NULL,
record_btrace_tailcall_frame_sniffer, record_btrace_tailcall_frame_sniffer,
record_btrace_frame_dealloc_cache record_btrace_frame_dealloc_cache
}; );
/* Implement the get_unwinder method. */ /* Implement the get_unwinder method. */

View File

@@ -36,8 +36,8 @@ extern struct cmd_list_element *show_record_cmdlist;
extern struct cmd_list_element *info_record_cmdlist; extern struct cmd_list_element *info_record_cmdlist;
/* Unwinders for some record targets. */ /* Unwinders for some record targets. */
extern const struct frame_unwind record_btrace_frame_unwind; extern const struct frame_unwind_legacy record_btrace_frame_unwind;
extern const struct frame_unwind record_btrace_tailcall_frame_unwind; extern const struct frame_unwind_legacy record_btrace_tailcall_frame_unwind;
/* A list of different recording methods. */ /* A list of different recording methods. */
enum record_method enum record_method

View File

@@ -3904,8 +3904,7 @@ riscv_frame_prev_register (const frame_info_ptr &this_frame,
are the fallback unwinder (DWARF unwinder is used first), we use the are the fallback unwinder (DWARF unwinder is used first), we use the
default frame sniffer, which always accepts the frame. */ 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", /*.name =*/ "riscv prologue",
/*.type =*/ NORMAL_FRAME, /*.type =*/ NORMAL_FRAME,
/*.unwinder_class=*/FRAME_UNWIND_ARCH, /*.unwinder_class=*/FRAME_UNWIND_ARCH,
@@ -3915,8 +3914,8 @@ static const struct frame_unwind riscv_frame_unwind =
/*.unwind_data =*/ NULL, /*.unwind_data =*/ NULL,
/*.sniffer =*/ default_frame_sniffer, /*.sniffer =*/ default_frame_sniffer,
/*.dealloc_cache =*/ NULL, /*.dealloc_cache =*/ NULL,
/*.prev_arch =*/ NULL, /*.prev_arch =*/ NULL
}; );
/* Extract a set of required target features out of ABFD. If ABFD is /* 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. */ nullptr then a RISCV_GDBARCH_FEATURES is returned in its default state. */

View File

@@ -1183,8 +1183,7 @@ rl78_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "rl78 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1193,7 +1192,7 @@ static const struct frame_unwind rl78_unwind =
rl78_prev_register, rl78_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Implement the "dwarf_reg_to_regnum" gdbarch method. */ /* Implement the "dwarf_reg_to_regnum" gdbarch method. */

View File

@@ -328,7 +328,7 @@ aix_sighandle_frame_sniffer (const struct frame_unwind *self,
/* AIX signal handler frame unwinder */ /* 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", "rs6000 aix sighandle",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -337,7 +337,7 @@ static const struct frame_unwind aix_sighandle_frame_unwind = {
aix_sighandle_frame_prev_register, aix_sighandle_frame_prev_register,
NULL, NULL,
aix_sighandle_frame_sniffer aix_sighandle_frame_sniffer
}; );
/* Core file support. */ /* Core file support. */

View File

@@ -3837,8 +3837,7 @@ rs6000_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum); 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", "rs6000 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3847,7 +3846,7 @@ static const struct frame_unwind rs6000_frame_unwind =
rs6000_frame_prev_register, rs6000_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Allocate and initialize a frame cache for an epilogue frame. /* Allocate and initialize a frame cache for an epilogue frame.
SP is restored and prev-PC is stored in LR. */ SP is restored and prev-PC is stored in LR. */
@@ -3979,8 +3978,7 @@ rs6000_epilogue_frame_sniffer (const struct frame_unwind *self,
/* Frame unwinder for epilogue frame. This is required for reverse step-over /* Frame unwinder for epilogue frame. This is required for reverse step-over
a function without debug information. */ 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", "rs6000 epilogue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -3988,7 +3986,7 @@ static const struct frame_unwind rs6000_epilogue_frame_unwind =
rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register, rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
NULL, NULL,
rs6000_epilogue_frame_sniffer rs6000_epilogue_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR

View File

@@ -631,7 +631,7 @@ rx_exception_sniffer (const struct frame_unwind *self,
/* Data structure for normal code using instruction-based prologue /* Data structure for normal code using instruction-based prologue
analyzer. */ analyzer. */
static const struct frame_unwind rx_frame_unwind = { static const struct frame_unwind_legacy rx_frame_unwind (
"rx prologue", "rx prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -640,12 +640,12 @@ static const struct frame_unwind rx_frame_unwind = {
rx_frame_prev_register, rx_frame_prev_register,
NULL, NULL,
rx_frame_sniffer rx_frame_sniffer
}; );
/* Data structure for exception code using instruction-based prologue /* Data structure for exception code using instruction-based prologue
analyzer. */ analyzer. */
static const struct frame_unwind rx_exception_unwind = { static const struct frame_unwind_legacy rx_exception_unwind (
"rx exception", "rx exception",
/* SIGTRAMP_FRAME could be used here, but backtraces are less informative. */ /* SIGTRAMP_FRAME could be used here, but backtraces are less informative. */
NORMAL_FRAME, NORMAL_FRAME,
@@ -655,7 +655,7 @@ static const struct frame_unwind rx_exception_unwind = {
rx_frame_prev_register, rx_frame_prev_register,
NULL, NULL,
rx_exception_sniffer rx_exception_sniffer
}; );
/* Implement the "push_dummy_call" gdbarch method. */ /* Implement the "push_dummy_call" gdbarch method. */
static CORE_ADDR static CORE_ADDR

View File

@@ -441,7 +441,7 @@ s12z_frame_prev_register (const frame_info_ptr &this_frame,
} }
/* Data structures for the normal prologue-analysis-based unwinder. */ /* 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", "s12z prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -450,8 +450,8 @@ static const struct frame_unwind s12z_frame_unwind = {
s12z_frame_prev_register, s12z_frame_prev_register,
NULL, NULL,
default_frame_sniffer, default_frame_sniffer,
NULL, NULL
}; );
constexpr gdb_byte s12z_break_insn[] = {0x00}; constexpr gdb_byte s12z_break_insn[] = {0x00};

View File

@@ -541,7 +541,7 @@ s390_sigtramp_frame_sniffer (const struct frame_unwind *self,
/* S390 sigtramp frame unwinder. */ /* 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", "s390 linux sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -550,7 +550,7 @@ static const struct frame_unwind s390_sigtramp_frame_unwind = {
s390_sigtramp_frame_prev_register, s390_sigtramp_frame_prev_register,
NULL, NULL,
s390_sigtramp_frame_sniffer s390_sigtramp_frame_sniffer
}; );
/* Syscall handling. */ /* Syscall handling. */

View File

@@ -2764,7 +2764,7 @@ s390_frame_prev_register (const frame_info_ptr &this_frame,
/* Default S390 frame unwinder. */ /* Default S390 frame unwinder. */
static const struct frame_unwind s390_frame_unwind = { static const struct frame_unwind_legacy s390_frame_unwind (
"s390 prologue", "s390 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2773,7 +2773,7 @@ static const struct frame_unwind s390_frame_unwind = {
s390_frame_prev_register, s390_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
/* Code stubs and their stack frames. For things like PLTs and NULL /* Code stubs and their stack frames. For things like PLTs and NULL
function calls (where there is no true frame and the return address function calls (where there is no true frame and the return address
@@ -2859,7 +2859,7 @@ s390_stub_frame_sniffer (const struct frame_unwind *self,
/* S390 stub frame unwinder. */ /* 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", "s390 stub",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2868,7 +2868,7 @@ static const struct frame_unwind s390_stub_frame_unwind = {
s390_stub_frame_prev_register, s390_stub_frame_prev_register,
NULL, NULL,
s390_stub_frame_sniffer s390_stub_frame_sniffer
}; );
/* Frame base handling. */ /* Frame base handling. */

View File

@@ -78,8 +78,7 @@ sentinel_frame_prev_arch (const frame_info_ptr &this_frame,
return cache->regcache->arch (); return cache->regcache->arch ();
} }
const struct frame_unwind sentinel_frame_unwind = const struct frame_unwind_legacy sentinel_frame_unwind (
{
"sentinel", "sentinel",
SENTINEL_FRAME, SENTINEL_FRAME,
FRAME_UNWIND_GDB, FRAME_UNWIND_GDB,
@@ -89,5 +88,5 @@ const struct frame_unwind sentinel_frame_unwind =
NULL, NULL,
NULL, NULL,
NULL, NULL,
sentinel_frame_prev_arch, sentinel_frame_prev_arch
}; );

View File

@@ -34,6 +34,6 @@ extern void *sentinel_frame_cache (struct regcache *regcache);
/* At present there is only one type of sentinel frame. */ /* 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 */ #endif /* GDB_SENTINEL_FRAME_H */

View File

@@ -1950,7 +1950,7 @@ sh_frame_this_id (const frame_info_ptr &this_frame, void **this_cache,
*this_id = frame_id_build (cache->saved_sp, cache->pc); *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", "sh prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1959,7 +1959,7 @@ static const struct frame_unwind sh_frame_unwind = {
sh_frame_prev_register, sh_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
sh_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) sh_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
@@ -2017,8 +2017,7 @@ sh_stub_unwind_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind sh_stub_unwind = static const struct frame_unwind_legacy sh_stub_unwind (
{
"sh stub", "sh stub",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -2027,7 +2026,7 @@ static const struct frame_unwind sh_stub_unwind =
sh_frame_prev_register, sh_frame_prev_register,
NULL, NULL,
sh_stub_unwind_sniffer sh_stub_unwind_sniffer
}; );
/* Implement the stack_frame_destroyed_p gdbarch method. /* Implement the stack_frame_destroyed_p gdbarch method.

View File

@@ -248,8 +248,7 @@ sparc32nbsd_sigcontext_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind sparc32nbsd_sigcontext_frame_unwind = static const struct frame_unwind_legacy sparc32nbsd_sigcontext_frame_unwind (
{
"sparc32 netbsd sigcontext", "sparc32 netbsd sigcontext",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -258,7 +257,7 @@ static const struct frame_unwind sparc32nbsd_sigcontext_frame_unwind =
sparc32nbsd_sigcontext_frame_prev_register, sparc32nbsd_sigcontext_frame_prev_register,
NULL, NULL,
sparc32nbsd_sigcontext_frame_sniffer sparc32nbsd_sigcontext_frame_sniffer
}; );
/* Return the address of a system call's alternative return /* Return the address of a system call's alternative return
address. */ address. */

View File

@@ -134,8 +134,7 @@ sparc32obsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind sparc32obsd_sigtramp_frame_unwind = static const struct frame_unwind_legacy sparc32obsd_sigtramp_frame_unwind (
{
"sparc32 openbsd sigtramp", "sparc32 openbsd sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -144,7 +143,7 @@ static const struct frame_unwind sparc32obsd_sigtramp_frame_unwind =
sparc32obsd_sigtramp_frame_prev_register, sparc32obsd_sigtramp_frame_prev_register,
NULL, NULL,
sparc32obsd_sigtramp_frame_sniffer sparc32obsd_sigtramp_frame_sniffer
}; );

View File

@@ -179,8 +179,7 @@ sparc32_sol2_sigtramp_frame_sniffer (const struct frame_unwind *self,
return sol2_sigtramp_p (this_frame); 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", "sparc32 solaris sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -189,7 +188,7 @@ static const struct frame_unwind sparc32_sol2_sigtramp_frame_unwind =
sparc32_sol2_sigtramp_frame_prev_register, sparc32_sol2_sigtramp_frame_prev_register,
NULL, NULL,
sparc32_sol2_sigtramp_frame_sniffer sparc32_sol2_sigtramp_frame_sniffer
}; );

View File

@@ -1346,8 +1346,7 @@ sparc32_frame_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "sparc32 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1356,7 +1355,7 @@ static const struct frame_unwind sparc32_frame_unwind =
sparc32_frame_prev_register, sparc32_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR

View File

@@ -196,8 +196,7 @@ sparc64fbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind = static const struct frame_unwind_legacy sparc64fbsd_sigtramp_frame_unwind (
{
"sparc64 freebsd sigtramp", "sparc64 freebsd sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -206,7 +205,7 @@ static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind =
sparc64fbsd_sigtramp_frame_prev_register, sparc64fbsd_sigtramp_frame_prev_register,
NULL, NULL,
sparc64fbsd_sigtramp_frame_sniffer sparc64fbsd_sigtramp_frame_sniffer
}; );
static const struct regset sparc64fbsd_gregset = static const struct regset sparc64fbsd_gregset =

View File

@@ -222,8 +222,7 @@ sparc64nbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind = static const struct frame_unwind_legacy sparc64nbsd_sigcontext_frame_unwind (
{
"sparc64 netbsd sigcontext", "sparc64 netbsd sigcontext",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -232,7 +231,7 @@ static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
sparc64nbsd_sigcontext_frame_prev_register, sparc64nbsd_sigcontext_frame_prev_register,
NULL, NULL,
sparc64nbsd_sigtramp_frame_sniffer sparc64nbsd_sigtramp_frame_sniffer
}; );
static const struct regset sparc64nbsd_gregset = static const struct regset sparc64nbsd_gregset =

View File

@@ -220,8 +220,7 @@ sparc64obsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind sparc64obsd_frame_unwind = static const struct frame_unwind_legacy sparc64obsd_frame_unwind (
{
"sparc64 openbsd sigtramp", "sparc64 openbsd sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -230,7 +229,7 @@ static const struct frame_unwind sparc64obsd_frame_unwind =
sparc64obsd_frame_prev_register, sparc64obsd_frame_prev_register,
NULL, NULL,
sparc64obsd_sigtramp_frame_sniffer sparc64obsd_sigtramp_frame_sniffer
}; );
/* Kernel debugging support. */ /* Kernel debugging support. */
@@ -305,8 +304,7 @@ sparc64obsd_trapframe_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind sparc64obsd_trapframe_unwind = static const struct frame_unwind_legacy sparc64obsd_trapframe_unwind (
{
"sparc64 openbsd trap", "sparc64 openbsd trap",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -315,7 +313,7 @@ static const struct frame_unwind sparc64obsd_trapframe_unwind =
sparc64obsd_trapframe_prev_register, sparc64obsd_trapframe_prev_register,
NULL, NULL,
sparc64obsd_trapframe_sniffer sparc64obsd_trapframe_sniffer
}; );
/* Threads support. */ /* Threads support. */

View File

@@ -182,8 +182,7 @@ sparc64_sol2_sigtramp_frame_sniffer (const struct frame_unwind *self,
return sol2_sigtramp_p (this_frame); 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", "sparc64 solaris sigtramp",
SIGTRAMP_FRAME, SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -192,7 +191,7 @@ static const struct frame_unwind sparc64_sol2_sigtramp_frame_unwind =
sparc64_sol2_sigtramp_frame_prev_register, sparc64_sol2_sigtramp_frame_prev_register,
NULL, NULL,
sparc64_sol2_sigtramp_frame_sniffer sparc64_sol2_sigtramp_frame_sniffer
}; );

View File

@@ -1135,8 +1135,7 @@ sparc64_frame_prev_register (const frame_info_ptr &this_frame, void **this_cache
return frame_unwind_got_register (this_frame, regnum, regnum); 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", "sparc64 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1145,7 +1144,7 @@ static const struct frame_unwind sparc64_frame_unwind =
sparc64_frame_prev_register, sparc64_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR

View File

@@ -452,8 +452,7 @@ tic6x_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return info->base; return info->base;
} }
static const struct frame_unwind tic6x_frame_unwind = static const struct frame_unwind_legacy tic6x_frame_unwind (
{
"tic6x prologue", "tic6x prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -462,7 +461,7 @@ static const struct frame_unwind tic6x_frame_unwind =
tic6x_frame_prev_register, tic6x_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static const struct frame_base tic6x_frame_base = static const struct frame_base tic6x_frame_base =
{ {
@@ -516,8 +515,7 @@ tic6x_stub_unwind_sniffer (const struct frame_unwind *self,
return 0; return 0;
} }
static const struct frame_unwind tic6x_stub_unwind = static const struct frame_unwind_legacy tic6x_stub_unwind (
{
"tic6x stub", "tic6x stub",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -526,7 +524,7 @@ static const struct frame_unwind tic6x_stub_unwind =
tic6x_frame_prev_register, tic6x_frame_prev_register,
NULL, NULL,
tic6x_stub_unwind_sniffer tic6x_stub_unwind_sniffer
}; );
/* Return the instruction on address PC. */ /* Return the instruction on address PC. */

View File

@@ -900,7 +900,7 @@ tilegx_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)
return cache->base; return cache->base;
} }
static const struct frame_unwind tilegx_frame_unwind = { static const struct frame_unwind_legacy tilegx_frame_unwind (
"tilegx prologue", "tilegx prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -910,7 +910,7 @@ static const struct frame_unwind tilegx_frame_unwind = {
NULL, /* const struct frame_data *unwind_data */ NULL, /* const struct frame_data *unwind_data */
default_frame_sniffer, /* frame_sniffer_ftype *sniffer */ default_frame_sniffer, /* frame_sniffer_ftype *sniffer */
NULL /* frame_prev_pc_ftype *prev_pc */ NULL /* frame_prev_pc_ftype *prev_pc */
}; );
static const struct frame_base tilegx_frame_base = { static const struct frame_base tilegx_frame_base = {
&tilegx_frame_unwind, &tilegx_frame_unwind,

View File

@@ -57,10 +57,41 @@ tramp_frame_cache (const frame_info_ptr &this_frame,
return tramp_cache->trad_cache; return tramp_cache->trad_cache;
} }
static void class frame_unwind_trampoline : public frame_unwind
tramp_frame_this_id (const frame_info_ptr &this_frame, {
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, void **this_cache,
struct frame_id *this_id) struct frame_id *this_id) const
{ {
struct trad_frame_cache *trad_cache struct trad_frame_cache *trad_cache
= tramp_frame_cache (this_frame, this_cache); = tramp_frame_cache (this_frame, this_cache);
@@ -68,10 +99,10 @@ tramp_frame_this_id (const frame_info_ptr &this_frame,
trad_frame_get_id (trad_cache, this_id); trad_frame_get_id (trad_cache, this_id);
} }
static struct value * struct value *
tramp_frame_prev_register (const frame_info_ptr &this_frame, frame_unwind_trampoline::prev_register (const frame_info_ptr &this_frame,
void **this_cache, void **this_cache,
int prev_regnum) int prev_regnum) const
{ {
struct trad_frame_cache *trad_cache struct trad_frame_cache *trad_cache
= tramp_frame_cache (this_frame, this_cache); = tramp_frame_cache (this_frame, this_cache);
@@ -119,12 +150,11 @@ tramp_frame_start (const struct tramp_frame *tramp,
return 0; return 0;
} }
static int int
tramp_frame_sniffer (const struct frame_unwind *self, frame_unwind_trampoline::sniff (const frame_info_ptr &this_frame,
const frame_info_ptr &this_frame, void **this_cache) const
void **this_cache)
{ {
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 pc = get_frame_pc (this_frame);
CORE_ADDR func; CORE_ADDR func;
struct tramp_frame_cache *tramp_cache; struct tramp_frame_cache *tramp_cache;
@@ -161,16 +191,11 @@ tramp_frame_prepend_unwinder (struct gdbarch *gdbarch,
gdb_assert (tramp_frame->insn_size <= sizeof (tramp_frame->insn[0].bytes)); gdb_assert (tramp_frame->insn_size <= sizeof (tramp_frame->insn[0].bytes));
data = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_data); data = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_data);
unwinder = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_unwind);
data->tramp_frame = tramp_frame; data->tramp_frame = tramp_frame;
unwinder->type = tramp_frame->frame_type;
unwinder->unwind_data = data; unwinder = obstack_new <frame_unwind_trampoline> (gdbarch_obstack (gdbarch),
unwinder->unwinder_class = FRAME_UNWIND_GDB; tramp_frame->frame_type,
unwinder->sniffer = tramp_frame_sniffer; data,
unwinder->stop_reason = default_frame_unwind_stop_reason; tramp_frame->prev_arch);
unwinder->this_id = tramp_frame_this_id;
unwinder->prev_register = tramp_frame_prev_register;
unwinder->prev_arch = tramp_frame->prev_arch;
frame_unwind_prepend_unwinder (gdbarch, unwinder); frame_unwind_prepend_unwinder (gdbarch, unwinder);
} }

View File

@@ -1320,7 +1320,7 @@ v850_frame_this_id (const frame_info_ptr &this_frame, void **this_cache,
*this_id = frame_id_build (cache->saved_regs[E_SP_REGNUM].addr (), cache->pc); *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", "v850 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1329,7 +1329,7 @@ static const struct frame_unwind v850_frame_unwind = {
v850_frame_prev_register, v850_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
v850_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) v850_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -386,8 +386,7 @@ vax_frame_prev_register (const frame_info_ptr &this_frame,
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum); 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", "vax prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -396,7 +395,7 @@ static const struct frame_unwind vax_frame_unwind =
vax_frame_prev_register, vax_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR

View File

@@ -1321,10 +1321,9 @@ cygwin_sigwrapper_frame_cache (frame_info_ptr this_frame, void **this_cache)
return cache; return cache;
} }
static struct value * struct value *
cygwin_sigwrapper_frame_prev_register (const frame_info_ptr &this_frame, cygwin_sigwrapper_frame_unwind::prev_register
void **this_cache, (const frame_info_ptr &this_frame, void **this_cache, int regnum) const
int regnum)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct cygwin_sigwrapper_frame_cache *cache struct cygwin_sigwrapper_frame_cache *cache
@@ -1340,20 +1339,18 @@ cygwin_sigwrapper_frame_prev_register (const frame_info_ptr &this_frame,
return frame_unwind_got_register (this_frame, regnum, regnum); return frame_unwind_got_register (this_frame, regnum, regnum);
} }
static void void
cygwin_sigwrapper_frame_this_id (const frame_info_ptr &this_frame, cygwin_sigwrapper_frame_unwind::this_id (const frame_info_ptr &this_frame,
void **this_cache, void **this_cache,
struct frame_id *this_id) struct frame_id *this_id) const
{ {
*this_id = frame_id_build_unavailable_stack (get_frame_func (this_frame)); *this_id = frame_id_build_unavailable_stack (get_frame_func (this_frame));
} }
static int int
cygwin_sigwrapper_frame_sniffer (const struct frame_unwind *self_, cygwin_sigwrapper_frame_unwind::sniff (const frame_info_ptr &this_frame,
const frame_info_ptr &this_frame, void **this_cache) const
void **this_cache)
{ {
const auto *self = (const struct cygwin_sigwrapper_frame_unwind *) self_;
struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR pc = get_frame_pc (this_frame);
@@ -1376,7 +1373,7 @@ cygwin_sigwrapper_frame_sniffer (const struct frame_unwind *self_,
paddress (gdbarch, end)); paddress (gdbarch, end));
int tlsoffset; int tlsoffset;
cygwin_sigwrapper_frame_analyze (gdbarch, start, end, self->patterns_list, cygwin_sigwrapper_frame_analyze (gdbarch, start, end, patterns_list,
&tlsoffset); &tlsoffset);
if (tlsoffset == 0) if (tlsoffset == 0)
return 0; return 0;
@@ -1396,13 +1393,7 @@ cygwin_sigwrapper_frame_sniffer (const struct frame_unwind *self_,
cygwin_sigwrapper_frame_unwind::cygwin_sigwrapper_frame_unwind cygwin_sigwrapper_frame_unwind::cygwin_sigwrapper_frame_unwind
(gdb::array_view<const gdb::array_view<const gdb_byte>> patterns_list) (gdb::array_view<const gdb::array_view<const gdb_byte>> patterns_list)
: frame_unwind (), : frame_unwind ("cygwin sigwrapper", NORMAL_FRAME, FRAME_UNWIND_GDB,
patterns_list (patterns_list) 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;
} }

View File

@@ -60,8 +60,9 @@ extern bool is_linked_with_cygwin_dll (bfd *abfd);
/* Cygwin sigwapper unwinder. Unwinds signal frames over /* Cygwin sigwapper unwinder. Unwinds signal frames over
sigbe/sigdelayed. */ sigbe/sigdelayed. */
struct cygwin_sigwrapper_frame_unwind : public frame_unwind class cygwin_sigwrapper_frame_unwind : public frame_unwind
{ {
public:
explicit cygwin_sigwrapper_frame_unwind explicit cygwin_sigwrapper_frame_unwind
(gdb::array_view<const gdb::array_view<const gdb_byte>> patterns_list); (gdb::array_view<const gdb::array_view<const gdb_byte>> patterns_list);
@@ -73,6 +74,19 @@ struct cygwin_sigwrapper_frame_unwind : public frame_unwind
If any pattern in the list matches, then the frame is assumed to If any pattern in the list matches, then the frame is assumed to
be a sigwrapper frame. */ be a sigwrapper frame. */
gdb::array_view<const gdb::array_view<const gdb_byte>> patterns_list; 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 */ #endif /* GDB_WINDOWS_TDEP_H */

View File

@@ -728,7 +728,7 @@ xstormy16_frame_base_address (const frame_info_ptr &this_frame, void **this_cach
return cache->base; return cache->base;
} }
static const struct frame_unwind xstormy16_frame_unwind = { static const struct frame_unwind_legacy xstormy16_frame_unwind (
"xstormy16 prologue", "xstormy16 prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -737,7 +737,7 @@ static const struct frame_unwind xstormy16_frame_unwind = {
xstormy16_frame_prev_register, xstormy16_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static const struct frame_base xstormy16_frame_base = { static const struct frame_base xstormy16_frame_base = {
&xstormy16_frame_unwind, &xstormy16_frame_unwind,

View File

@@ -1496,9 +1496,7 @@ xtensa_frame_prev_register (const frame_info_ptr &this_frame,
} }
static const struct frame_unwind static const struct frame_unwind_legacy xtensa_unwind (
xtensa_unwind =
{
"xtensa prologue", "xtensa prologue",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1507,7 +1505,7 @@ xtensa_unwind =
xtensa_frame_prev_register, xtensa_frame_prev_register,
NULL, NULL,
default_frame_sniffer default_frame_sniffer
}; );
static CORE_ADDR static CORE_ADDR
xtensa_frame_base_address (const frame_info_ptr &this_frame, void **this_cache) xtensa_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)

View File

@@ -1063,9 +1063,7 @@ z80_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
return 0; return 0;
} }
static const struct frame_unwind static const struct frame_unwind_legacy z80_frame_unwind (
z80_frame_unwind =
{
"z80", "z80",
NORMAL_FRAME, NORMAL_FRAME,
FRAME_UNWIND_ARCH, FRAME_UNWIND_ARCH,
@@ -1076,7 +1074,7 @@ z80_frame_unwind =
default_frame_sniffer default_frame_sniffer
/*dealloc_cache*/ /*dealloc_cache*/
/*prev_arch*/ /*prev_arch*/
}; );
/* Initialize the gdbarch struct for the Z80 arch */ /* Initialize the gdbarch struct for the Z80 arch */
static struct gdbarch * static struct gdbarch *