aboutsummaryrefslogtreecommitdiff
path: root/gdb/cris-tdep.c
diff options
context:
space:
mode:
authorGuinevere Larsen <guinevere@redhat.com>2024-03-14 16:14:27 +0100
committerGuinevere Larsen <guinevere@redhat.com>2025-01-17 11:49:16 -0300
commit1239e7cf37336d69931a656290c25a5d5455b9cc (patch)
treeb2b7d26d4df99d17acd7e8cff1649347392e6f6f /gdb/cris-tdep.c
parentce36ef63aa74c30016334db0f6a4638d1ffe7256 (diff)
downloadgdb-1239e7cf37336d69931a656290c25a5d5455b9cc.zip
gdb-1239e7cf37336d69931a656290c25a5d5455b9cc.tar.gz
gdb-1239e7cf37336d69931a656290c25a5d5455b9cc.tar.bz2
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>
Diffstat (limited to 'gdb/cris-tdep.c')
-rw-r--r--gdb/cris-tdep.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 4db2a23..f531b4c 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -435,8 +435,7 @@ cris_sigtramp_frame_sniffer (const struct frame_unwind *self,
return 0;
}
-static const struct frame_unwind cris_sigtramp_frame_unwind =
-{
+static const struct frame_unwind_legacy cris_sigtramp_frame_unwind (
"cris sigtramp",
SIGTRAMP_FRAME,
FRAME_UNWIND_ARCH,
@@ -445,7 +444,7 @@ static const struct frame_unwind cris_sigtramp_frame_unwind =
cris_sigtramp_frame_prev_register,
NULL,
cris_sigtramp_frame_sniffer
-};
+);
static int
crisv32_single_step_through_delay (struct gdbarch *gdbarch,
@@ -901,8 +900,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
return sp;
}
-static const struct frame_unwind cris_frame_unwind =
-{
+static const struct frame_unwind_legacy cris_frame_unwind (
"cris prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
@@ -911,7 +909,7 @@ static const struct frame_unwind cris_frame_unwind =
cris_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
cris_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)