aboutsummaryrefslogtreecommitdiff
path: root/gdb/m32r-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/m32r-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/m32r-tdep.c')
-rw-r--r--gdb/m32r-tdep.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index aadb8c0..8300528 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -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);
}
-static const struct frame_unwind m32r_frame_unwind = {
+static const struct frame_unwind_legacy m32r_frame_unwind (
"m32r prologue",
NORMAL_FRAME,
FRAME_UNWIND_ARCH,
@@ -840,7 +840,7 @@ static const struct frame_unwind m32r_frame_unwind = {
m32r_frame_prev_register,
NULL,
default_frame_sniffer
-};
+);
static CORE_ADDR
m32r_frame_base_address (const frame_info_ptr &this_frame, void **this_cache)