Rename base_breakpoint -> code_breakpoint

Even after the previous patches reworking the inheritance of several
breakpoint types, the present breakpoint hierarchy looks a bit
surprising, as we have "breakpoint" as the superclass, and then
"base_breakpoint" inherits from "breakpoint".  Like so, simplified:

   breakpoint
       base_breakpoint
          ordinary_breakpoint
	  internal_breakpoint
	  momentary_breakpoint
	  ada_catchpoint
	  exception_catchpoint
       tracepoint
       watchpoint
       catchpoint
	  exec_catchpoint
	  ...

The surprising part to me is having "base_breakpoint" being a subclass
of "breakpoint".  I'm just refering to naming here -- I mean, you'd
expect that it would be the top level baseclass that would be called
"base".

Just flipping the names of breakpoint and base_breakpoint around
wouldn't be super great for us, IMO, given we think of every type of
*point as a breakpoint at the user visible level.  E.g., "info
breakpoints" shows watchpoints, tracepoints, etc.  So it makes to call
the top level class breakpoint.

Instead, I propose renaming base_breakpoint to code_breakpoint.  The
previous patches made sure that all code breakpoints inherit from
base_breakpoint, so it's fitting.  Also, "code breakpoint" contrasts
nicely with a watchpoint also being typically known as a "data
breakpoint".

After this commit, the resulting hierarchy looks like:

   breakpoint
       code_breakpoint
          ordinary_breakpoint
	  internal_breakpoint
	  momentary_breakpoint
	  ada_catchpoint
	  exception_catchpoint
       tracepoint
       watchpoint
       catchpoint
	  exec_catchpoint
	  ...

... which makes a lot more sense to me.

I've left this patch as last in the series in case people want to
bikeshed on the naming.

"code" has a nice property that it's exactly as many letters as
"base", so this patch didn't require any reindentation.  :-)

Change-Id: Id8dc06683a69fad80d88e674f65e826d6a4e3f66
This commit is contained in:
Pedro Alves 2022-05-16 17:30:06 +01:00
parent 46f0aab143
commit 74421c0bc8
9 changed files with 57 additions and 57 deletions

View File

@ -12104,7 +12104,7 @@ static std::string ada_exception_catchpoint_cond_string
/* An instance of this type is used to represent an Ada catchpoint. */
struct ada_catchpoint : public base_breakpoint
struct ada_catchpoint : public code_breakpoint
{
ada_catchpoint (struct gdbarch *gdbarch_,
enum ada_exception_catchpoint_kind kind,
@ -12113,12 +12113,12 @@ struct ada_catchpoint : public base_breakpoint
bool tempflag,
bool enabled,
bool from_tty)
: base_breakpoint (gdbarch_, bp_catchpoint),
: code_breakpoint (gdbarch_, bp_catchpoint),
m_kind (kind)
{
add_location (sal);
/* Unlike most base_breakpoint types, Ada catchpoints are
/* Unlike most code_breakpoint types, Ada catchpoints are
pspace-specific. */
gdb_assert (sal.pspace != nullptr);
this->pspace = sal.pspace;
@ -12247,7 +12247,7 @@ ada_catchpoint::re_set ()
{
/* Call the base class's method. This updates the catchpoint's
locations. */
this->base_breakpoint::re_set ();
this->code_breakpoint::re_set ();
/* Reparse the exception conditional expressions. One for each
location. */

View File

@ -65,15 +65,15 @@ static const struct exception_names exception_functions[] =
/* The type of an exception catchpoint. Unlike most catchpoints, this
one is implemented with code breakpoints, so it inherits struct
base_breakpoint, not struct catchpoint. */
code_breakpoint, not struct catchpoint. */
struct exception_catchpoint : public base_breakpoint
struct exception_catchpoint : public code_breakpoint
{
exception_catchpoint (struct gdbarch *gdbarch,
bool temp, const char *cond_string_,
enum exception_event_kind kind_,
std::string &&except_rx)
: base_breakpoint (gdbarch, bp_catchpoint, temp, cond_string_),
: code_breakpoint (gdbarch, bp_catchpoint, temp, cond_string_),
kind (kind_),
exception_rx (std::move (except_rx)),
pattern (exception_rx.empty ()

View File

@ -87,7 +87,7 @@
static void map_breakpoint_numbers (const char *,
gdb::function_view<void (breakpoint *)>);
static void breakpoint_re_set_default (base_breakpoint *);
static void breakpoint_re_set_default (code_breakpoint *);
static void
create_sals_from_location_default (struct event_location *location,
@ -225,7 +225,7 @@ static void tracepoint_probe_create_sals_from_location
(struct event_location *location,
struct linespec_result *canonical);
const struct breakpoint_ops base_breakpoint_ops =
const struct breakpoint_ops code_breakpoint_ops =
{
create_sals_from_location_default,
create_breakpoints_sal,
@ -252,7 +252,7 @@ breakpoint::~breakpoint ()
{
}
base_breakpoint::~base_breakpoint ()
code_breakpoint::~code_breakpoint ()
{
}
@ -261,9 +261,9 @@ catchpoint::~catchpoint ()
}
/* The structure to be used in regular breakpoints. */
struct ordinary_breakpoint : public base_breakpoint
struct ordinary_breakpoint : public code_breakpoint
{
using base_breakpoint::base_breakpoint;
using code_breakpoint::code_breakpoint;
int resources_needed (const struct bp_location *) override;
enum print_stop_action print_it (const bpstat *bs) const override;
@ -275,11 +275,11 @@ struct ordinary_breakpoint : public base_breakpoint
the program, and they end up installed on the breakpoint chain with
a negative breakpoint number. They're visible in "maint info
breakpoints", but not "info breakpoints". */
struct internal_breakpoint : public base_breakpoint
struct internal_breakpoint : public code_breakpoint
{
internal_breakpoint (struct gdbarch *gdbarch,
enum bptype type, CORE_ADDR address)
: base_breakpoint (gdbarch, type)
: code_breakpoint (gdbarch, type)
{
symtab_and_line sal;
sal.pc = address;
@ -303,13 +303,13 @@ struct internal_breakpoint : public base_breakpoint
on the breakpoint chain and they all same the same number (zero).
They're visible in "maint info breakpoints", but not "info
breakpoints". */
struct momentary_breakpoint : public base_breakpoint
struct momentary_breakpoint : public code_breakpoint
{
momentary_breakpoint (struct gdbarch *gdbarch_, enum bptype bptype,
program_space *pspace_,
const struct frame_id &frame_id_,
int thread_)
: base_breakpoint (gdbarch_, bptype)
: code_breakpoint (gdbarch_, bptype)
{
/* If FRAME_ID is valid, it should be a real frame, not an inlined
or tail-called one. */
@ -1290,11 +1290,11 @@ is_tracepoint (const struct breakpoint *b)
TYPE. */
template<typename... Arg>
static std::unique_ptr<base_breakpoint>
static std::unique_ptr<code_breakpoint>
new_breakpoint_from_type (struct gdbarch *gdbarch, bptype type,
Arg&&... args)
{
base_breakpoint *b;
code_breakpoint *b;
switch (type)
{
@ -1325,7 +1325,7 @@ new_breakpoint_from_type (struct gdbarch *gdbarch, bptype type,
gdb_assert_not_reached ("invalid type");
}
return std::unique_ptr<base_breakpoint> (b);
return std::unique_ptr<code_breakpoint> (b);
}
/* A helper function that validates that COMMANDS are valid for a
@ -5886,10 +5886,10 @@ bpstat_run_callbacks (bpstat *bs_head)
handle_jit_event (bs->bp_location_at->address);
break;
case bp_gnu_ifunc_resolver:
gnu_ifunc_resolver_stop ((base_breakpoint *) b);
gnu_ifunc_resolver_stop ((code_breakpoint *) b);
break;
case bp_gnu_ifunc_resolver_return:
gnu_ifunc_resolver_return_stop ((base_breakpoint *) b);
gnu_ifunc_resolver_return_stop ((code_breakpoint *) b);
break;
}
}
@ -8057,7 +8057,7 @@ handle_automatic_hardware_breakpoints (bp_location *bl)
}
bp_location *
base_breakpoint::add_location (const symtab_and_line &sal)
code_breakpoint::add_location (const symtab_and_line &sal)
{
struct bp_location *new_loc, **tmp;
CORE_ADDR adjusted_address;
@ -8215,7 +8215,7 @@ update_dprintf_commands (const char *args, int from_tty,
update_dprintf_command_list (b);
}
base_breakpoint::base_breakpoint (struct gdbarch *gdbarch_,
code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_,
enum bptype type_,
gdb::array_view<const symtab_and_line> sals,
event_location_up &&location_,
@ -8355,7 +8355,7 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
int enabled, int internal, unsigned flags,
int display_canonical)
{
std::unique_ptr<base_breakpoint> b
std::unique_ptr<code_breakpoint> b
= new_breakpoint_from_type (gdbarch,
type,
sals,
@ -8732,14 +8732,14 @@ breakpoint_ops_for_event_location_type (enum event_location_type location_type,
if (location_type == PROBE_LOCATION)
return &tracepoint_probe_breakpoint_ops;
else
return &base_breakpoint_ops;
return &code_breakpoint_ops;
}
else
{
if (location_type == PROBE_LOCATION)
return &bkpt_probe_breakpoint_ops;
else
return &base_breakpoint_ops;
return &code_breakpoint_ops;
}
}
@ -8752,7 +8752,7 @@ breakpoint_ops_for_event_location (const struct event_location *location,
if (location != nullptr)
return breakpoint_ops_for_event_location_type
(event_location_type (location), is_tracepoint);
return &base_breakpoint_ops;
return &code_breakpoint_ops;
}
/* See breakpoint.h. */
@ -9087,7 +9087,7 @@ dprintf_command (const char *arg, int from_tty)
0, bp_dprintf,
0 /* Ignore count */,
pending_break_support,
&base_breakpoint_ops,
&code_breakpoint_ops,
from_tty,
1 /* enabled */,
0 /* internal */,
@ -11461,7 +11461,7 @@ breakpoint::decode_location (struct event_location *location,
/* Default breakpoint_ops methods. */
void
base_breakpoint::re_set ()
code_breakpoint::re_set ()
{
/* FIXME: is this still reachable? */
if (breakpoint_event_location_empty_p (this))
@ -11475,7 +11475,7 @@ base_breakpoint::re_set ()
}
int
base_breakpoint::insert_location (struct bp_location *bl)
code_breakpoint::insert_location (struct bp_location *bl)
{
CORE_ADDR addr = bl->target_info.reqstd_address;
@ -11499,7 +11499,7 @@ base_breakpoint::insert_location (struct bp_location *bl)
}
int
base_breakpoint::remove_location (struct bp_location *bl,
code_breakpoint::remove_location (struct bp_location *bl,
enum remove_bp_reason reason)
{
if (bl->probe.prob != nullptr)
@ -11515,7 +11515,7 @@ base_breakpoint::remove_location (struct bp_location *bl,
}
int
base_breakpoint::breakpoint_hit (const struct bp_location *bl,
code_breakpoint::breakpoint_hit (const struct bp_location *bl,
const address_space *aspace,
CORE_ADDR bp_addr,
const target_waitstatus &ws)
@ -11651,7 +11651,7 @@ ordinary_breakpoint::print_recreate (struct ui_file *fp) const
}
std::vector<symtab_and_line>
base_breakpoint::decode_location (struct event_location *location,
code_breakpoint::decode_location (struct event_location *location,
struct program_space *search_pspace)
{
if (event_location_type (location) == PROBE_LOCATION)
@ -12476,7 +12476,7 @@ hoist_existing_locations (struct breakpoint *b, struct program_space *pspace)
untouched. */
void
update_breakpoint_locations (base_breakpoint *b,
update_breakpoint_locations (code_breakpoint *b,
struct program_space *filter_pspace,
gdb::array_view<const symtab_and_line> sals,
gdb::array_view<const symtab_and_line> sals_end)
@ -12684,7 +12684,7 @@ location_to_sals (struct breakpoint *b, struct event_location *location,
locations. */
static void
breakpoint_re_set_default (base_breakpoint *b)
breakpoint_re_set_default (code_breakpoint *b)
{
struct program_space *filter_pspace = current_program_space;
std::vector<symtab_and_line> expanded, expanded_end;
@ -13515,7 +13515,7 @@ ftrace_command (const char *arg, int from_tty)
bp_fast_tracepoint /* type_wanted */,
0 /* Ignore count */,
pending_break_support,
&base_breakpoint_ops,
&code_breakpoint_ops,
from_tty,
1 /* enabled */,
0 /* internal */, 0);
@ -13540,7 +13540,7 @@ strace_command (const char *arg, int from_tty)
}
else
{
ops = &base_breakpoint_ops;
ops = &code_breakpoint_ops;
location = string_to_event_location (&arg, current_language);
type = bp_static_tracepoint;
}
@ -13623,7 +13623,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
utp->type /* type_wanted */,
0 /* Ignore count */,
pending_break_support,
&base_breakpoint_ops,
&code_breakpoint_ops,
0 /* from_tty */,
utp->enabled /* enabled */,
0 /* internal */,

View File

@ -849,7 +849,7 @@ struct breakpoint
/* Abstract base class representing code breakpoints. User "break"
breakpoints, internal and momentary breakpoints, etc. IOW, any
kind of breakpoint whose locations are created from SALs. */
struct base_breakpoint : public breakpoint
struct code_breakpoint : public breakpoint
{
using breakpoint::breakpoint;
@ -857,7 +857,7 @@ struct base_breakpoint : public breakpoint
description of the location, and COND_STRING as condition
expression. If LOCATION is NULL then create an "address
location" from the address in the SAL. */
base_breakpoint (struct gdbarch *gdbarch, bptype type,
code_breakpoint (struct gdbarch *gdbarch, bptype type,
gdb::array_view<const symtab_and_line> sals,
event_location_up &&location,
gdb::unique_xmalloc_ptr<char> filter,
@ -869,7 +869,7 @@ struct base_breakpoint : public breakpoint
int enabled, unsigned flags,
int display_canonical);
~base_breakpoint () override = 0;
~code_breakpoint () override = 0;
/* Add a location for SAL to this breakpoint. */
bp_location *add_location (const symtab_and_line &sal);
@ -985,9 +985,9 @@ extern bool is_exception_catchpoint (breakpoint *bp);
/* An instance of this type is used to represent all kinds of
tracepoints. */
struct tracepoint : public base_breakpoint
struct tracepoint : public code_breakpoint
{
using base_breakpoint::base_breakpoint;
using code_breakpoint::code_breakpoint;
int breakpoint_hit (const struct bp_location *bl,
const address_space *aspace, CORE_ADDR bp_addr,
@ -1384,7 +1384,7 @@ extern void until_break_command (const char *, int, int);
/* Initialize a struct bp_location. */
extern void update_breakpoint_locations
(base_breakpoint *b,
(code_breakpoint *b,
struct program_space *filter_pspace,
gdb::array_view<const symtab_and_line> sals,
gdb::array_view<const symtab_and_line> sals_end);
@ -1434,7 +1434,7 @@ extern void awatch_command_wrapper (const char *, int, bool);
extern void rwatch_command_wrapper (const char *, int, bool);
extern void tbreak_command (const char *, int);
extern const struct breakpoint_ops base_breakpoint_ops;
extern const struct breakpoint_ops code_breakpoint_ops;
/* Arguments to pass as context to some catch command handlers. */
#define CATCH_PERMANENT ((void *) (uintptr_t) 0)
@ -1463,7 +1463,7 @@ extern void install_breakpoint (int internal, std::unique_ptr<breakpoint> &&b,
/* Returns the breakpoint ops appropriate for use with with LOCATION and
according to IS_TRACEPOINT. Use this to ensure, for example, that you pass
the correct ops to create_breakpoint for probe locations. If LOCATION is
NULL, returns base_breakpoint_ops. */
NULL, returns code_breakpoint_ops. */
extern const struct breakpoint_ops *breakpoint_ops_for_event_location
(const struct event_location *location, bool is_tracepoint);

View File

@ -927,7 +927,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Handle inferior hit of bp_gnu_ifunc_resolver, see its definition. */
static void
elf_gnu_ifunc_resolver_stop (base_breakpoint *b)
elf_gnu_ifunc_resolver_stop (code_breakpoint *b)
{
struct breakpoint *b_return;
struct frame_info *prev_frame = get_prev_frame (get_current_frame ());
@ -978,7 +978,7 @@ elf_gnu_ifunc_resolver_stop (base_breakpoint *b)
/* Handle inferior hit of bp_gnu_ifunc_resolver_return, see its definition. */
static void
elf_gnu_ifunc_resolver_return_stop (base_breakpoint *b)
elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
{
thread_info *thread = inferior_thread ();
struct gdbarch *gdbarch = get_frame_arch (get_current_frame ());
@ -1008,7 +1008,7 @@ elf_gnu_ifunc_resolver_return_stop (base_breakpoint *b)
"gnu-indirect-function breakpoint type %d"),
(int) b->type);
}
b = (base_breakpoint *) b_next;
b = (code_breakpoint *) b_next;
}
gdb_assert (b->type == bp_gnu_ifunc_resolver);
gdb_assert (b->loc->next == NULL);

View File

@ -327,12 +327,12 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
else if (dprintf)
{
type_wanted = bp_dprintf;
ops = &base_breakpoint_ops;
ops = &code_breakpoint_ops;
}
else
{
type_wanted = hardware ? bp_hardware_breakpoint : bp_breakpoint;
ops = &base_breakpoint_ops;
ops = &code_breakpoint_ops;
}
if (is_explicit)

View File

@ -1019,7 +1019,7 @@ stub_gnu_ifunc_resolve_name (const char *function_name,
/* See elf_gnu_ifunc_resolver_stop for its real implementation. */
static void
stub_gnu_ifunc_resolver_stop (base_breakpoint *b)
stub_gnu_ifunc_resolver_stop (code_breakpoint *b)
{
internal_error (__FILE__, __LINE__,
_("elf_gnu_ifunc_resolver_stop cannot be reached."));
@ -1028,7 +1028,7 @@ stub_gnu_ifunc_resolver_stop (base_breakpoint *b)
/* See elf_gnu_ifunc_resolver_return_stop for its real implementation. */
static void
stub_gnu_ifunc_resolver_return_stop (base_breakpoint *b)
stub_gnu_ifunc_resolver_return_stop (code_breakpoint *b)
{
internal_error (__FILE__, __LINE__,
_("elf_gnu_ifunc_resolver_return_stop cannot be reached."));

View File

@ -305,7 +305,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
bp_breakpoint,
0,
AUTO_BOOLEAN_TRUE,
&base_breakpoint_ops,
&code_breakpoint_ops,
0, 1, internal_bp, 0);
}
catch (const gdb_exception &except)

View File

@ -55,7 +55,7 @@ struct obj_section;
struct cmd_list_element;
class probe;
struct lookup_name_info;
struct base_breakpoint;
struct code_breakpoint;
/* How to match a lookup name against a symbol search name. */
enum class symbol_name_match_type
@ -2228,10 +2228,10 @@ struct gnu_ifunc_fns
CORE_ADDR *function_address_p);
/* See elf_gnu_ifunc_resolver_stop for its real implementation. */
void (*gnu_ifunc_resolver_stop) (base_breakpoint *b);
void (*gnu_ifunc_resolver_stop) (code_breakpoint *b);
/* See elf_gnu_ifunc_resolver_return_stop for its real implementation. */
void (*gnu_ifunc_resolver_return_stop) (base_breakpoint *b);
void (*gnu_ifunc_resolver_return_stop) (code_breakpoint *b);
};
#define gnu_ifunc_resolve_addr gnu_ifunc_fns_p->gnu_ifunc_resolve_addr