mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-28 22:21:26 +08:00
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.
This commit is contained in:
@ -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. */
|
||||
|
Reference in New Issue
Block a user