aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-12 18:11:53 -0700
committerTom Tromey <tom@tromey.com>2022-01-18 10:34:05 -0700
commitd66beefaf6334d69b638b3300e264f7996c572dc (patch)
treea67e8d17b06eaff6ade678a7049d0f869fd7a5ce
parentde8e4cb3af98396ecad849588c9c05a45a9e823c (diff)
downloadgdb-d66beefaf6334d69b638b3300e264f7996c572dc.zip
gdb-d66beefaf6334d69b638b3300e264f7996c572dc.tar.gz
gdb-d66beefaf6334d69b638b3300e264f7996c572dc.tar.bz2
Simplify Ada catchpoints
All the Ada catchpoints use the same breakpoint_ops contents, because the catchpoint itself records its kind. This patch simplifies the code by removing the redundant ops structures.
-rw-r--r--gdb/ada-lang.c68
1 files changed, 3 insertions, 65 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a39c1fd..642527e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12042,21 +12042,15 @@ print_recreate_exception (struct breakpoint *b, struct ui_file *fp)
print_recreate_thread (b, fp);
}
-/* Virtual tables for various breakpoint types. */
+/* Virtual table for breakpoint type. */
static struct breakpoint_ops catch_exception_breakpoint_ops;
-static struct breakpoint_ops catch_exception_unhandled_breakpoint_ops;
-static struct breakpoint_ops catch_assert_breakpoint_ops;
-static struct breakpoint_ops catch_handlers_breakpoint_ops;
/* See ada-lang.h. */
bool
is_ada_exception_catchpoint (breakpoint *bp)
{
- return (bp->ops == &catch_exception_breakpoint_ops
- || bp->ops == &catch_exception_unhandled_breakpoint_ops
- || bp->ops == &catch_assert_breakpoint_ops
- || bp->ops == &catch_handlers_breakpoint_ops);
+ return bp->ops == &catch_exception_breakpoint_ops;
}
/* Split the arguments specified in a "catch exception" command.
@@ -12166,32 +12160,6 @@ ada_exception_sym_name (enum ada_exception_catchpoint_kind ex)
}
}
-/* Return the breakpoint ops "virtual table" used for catchpoints
- of the EX kind. */
-
-static const struct breakpoint_ops *
-ada_exception_breakpoint_ops (enum ada_exception_catchpoint_kind ex)
-{
- switch (ex)
- {
- case ada_catch_exception:
- return (&catch_exception_breakpoint_ops);
- break;
- case ada_catch_exception_unhandled:
- return (&catch_exception_unhandled_breakpoint_ops);
- break;
- case ada_catch_assert:
- return (&catch_assert_breakpoint_ops);
- break;
- case ada_catch_handlers:
- return (&catch_handlers_breakpoint_ops);
- break;
- default:
- internal_error (__FILE__, __LINE__,
- _("unexpected catchpoint kind (%d)"), ex);
- }
-}
-
/* Return the condition that will be used to match the current exception
being raised with the exception that the user wants to catch. This
assumes that this condition is used when the inferior just triggered
@@ -12285,7 +12253,7 @@ ada_exception_sal (enum ada_exception_catchpoint_kind ex,
*addr_string = sym_name;
/* Set OPS. */
- *ops = ada_exception_breakpoint_ops (ex);
+ *ops = &catch_exception_breakpoint_ops;
return find_function_start_sal (sym, 1);
}
@@ -13445,36 +13413,6 @@ initialize_ada_catchpoint_ops (void)
ops->print_one = print_one_exception;
ops->print_mention = print_mention_exception;
ops->print_recreate = print_recreate_exception;
-
- ops = &catch_exception_unhandled_breakpoint_ops;
- *ops = bkpt_breakpoint_ops;
- ops->allocate_location = allocate_location_exception;
- ops->re_set = re_set_exception;
- ops->check_status = check_status_exception;
- ops->print_it = print_it_exception;
- ops->print_one = print_one_exception;
- ops->print_mention = print_mention_exception;
- ops->print_recreate = print_recreate_exception;
-
- ops = &catch_assert_breakpoint_ops;
- *ops = bkpt_breakpoint_ops;
- ops->allocate_location = allocate_location_exception;
- ops->re_set = re_set_exception;
- ops->check_status = check_status_exception;
- ops->print_it = print_it_exception;
- ops->print_one = print_one_exception;
- ops->print_mention = print_mention_exception;
- ops->print_recreate = print_recreate_exception;
-
- ops = &catch_handlers_breakpoint_ops;
- *ops = bkpt_breakpoint_ops;
- ops->allocate_location = allocate_location_exception;
- ops->re_set = re_set_exception;
- ops->check_status = check_status_exception;
- ops->print_it = print_it_exception;
- ops->print_one = print_one_exception;
- ops->print_mention = print_mention_exception;
- ops->print_recreate = print_recreate_exception;
}
/* This module's 'new_objfile' observer. */