From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id F0182383088B; Fri, 20 May 2022 19:44:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F0182383088B Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Rename base_breakpoint -> code_breakpoint X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 46f0aab14350e9e380c6bbe7bf0539932241fb5b X-Git-Newrev: 74421c0bc857fdeadd033b44bb3cd372df8d62b8 Message-Id: <20220520194419.F0182383088B@sourceware.org> Date: Fri, 20 May 2022 19:44:19 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2022 19:44:20 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D74421c0bc857= fdeadd033b44bb3cd372df8d62b8 commit 74421c0bc857fdeadd033b44bb3cd372df8d62b8 Author: Pedro Alves Date: Mon May 16 17:30:06 2022 +0100 Rename base_breakpoint -> code_breakpoint =20 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: =20 breakpoint base_breakpoint ordinary_breakpoint internal_breakpoint momentary_breakpoint ada_catchpoint exception_catchpoint tracepoint watchpoint catchpoint exec_catchpoint ... =20 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". =20 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. =20 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". =20 After this commit, the resulting hierarchy looks like: =20 breakpoint code_breakpoint ordinary_breakpoint internal_breakpoint momentary_breakpoint ada_catchpoint exception_catchpoint tracepoint watchpoint catchpoint exec_catchpoint ... =20 ... which makes a lot more sense to me. =20 I've left this patch as last in the series in case people want to bikeshed on the naming. =20 "code" has a nice property that it's exactly as many letters as "base", so this patch didn't require any reindentation. :-) =20 Change-Id: Id8dc06683a69fad80d88e674f65e826d6a4e3f66 Diff: --- gdb/ada-lang.c | 8 +++--- gdb/break-catch-throw.c | 6 ++-- gdb/breakpoint.c | 62 ++++++++++++++++++++----------------= ---- gdb/breakpoint.h | 16 +++++------ gdb/elfread.c | 6 ++-- gdb/mi/mi-cmd-break.c | 4 +-- gdb/minsyms.c | 4 +-- gdb/python/py-finishbreakpoint.c | 2 +- gdb/symtab.h | 6 ++-- 9 files changed, 57 insertions(+), 57 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 5ddca104dc3..7e4988be5d0 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -12104,7 +12104,7 @@ static std::string ada_exception_catchpoint_cond_st= ring =20 /* An instance of this type is used to represent an Ada catchpoint. */ =20 -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); =20 - /* Unlike most base_breakpoint types, Ada catchpoints are + /* Unlike most code_breakpoint types, Ada catchpoints are pspace-specific. */ gdb_assert (sal.pspace !=3D nullptr); this->pspace =3D 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 (); =20 /* Reparse the exception conditional expressions. One for each location. */ diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c index a6f477b712a..66cf80be1c5 100644 --- a/gdb/break-catch-throw.c +++ b/gdb/break-catch-throw.c @@ -65,15 +65,15 @@ static const struct exception_names exception_functions= [] =3D =20 /* 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. */ =20 -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 () diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 89ff9cfb8c7..eac6410a578 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -87,7 +87,7 @@ static void map_breakpoint_numbers (const char *, gdb::function_view); =20 -static void breakpoint_re_set_default (base_breakpoint *); +static void breakpoint_re_set_default (code_breakpoint *); =20 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); =20 -const struct breakpoint_ops base_breakpoint_ops =3D +const struct breakpoint_ops code_breakpoint_ops =3D { create_sals_from_location_default, create_breakpoints_sal, @@ -252,7 +252,7 @@ breakpoint::~breakpoint () { } =20 -base_breakpoint::~base_breakpoint () +code_breakpoint::~code_breakpoint () { } =20 @@ -261,9 +261,9 @@ catchpoint::~catchpoint () } =20 /* 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; =20 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 =3D 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. */ =20 template -static std::unique_ptr +static std::unique_ptr new_breakpoint_from_type (struct gdbarch *gdbarch, bptype type, Arg&&... args) { - base_breakpoint *b; + code_breakpoint *b; =20 switch (type) { @@ -1325,7 +1325,7 @@ new_breakpoint_from_type (struct gdbarch *gdbarch, bp= type type, gdb_assert_not_reached ("invalid type"); } =20 - return std::unique_ptr (b); + return std::unique_ptr (b); } =20 /* 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 *b= l) } =20 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_t= ty, update_dprintf_command_list (b); } =20 -base_breakpoint::base_breakpoint (struct gdbarch *gdbarch_, +code_breakpoint::code_breakpoint (struct gdbarch *gdbarch_, enum bptype type_, gdb::array_view 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 b + std::unique_ptr b =3D 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 =3D=3D PROBE_LOCATION) return &tracepoint_probe_breakpoint_ops; else - return &base_breakpoint_ops; + return &code_breakpoint_ops; } else { if (location_type =3D=3D PROBE_LOCATION) return &bkpt_probe_breakpoint_ops; else - return &base_breakpoint_ops; + return &code_breakpoint_ops; } } =20 @@ -8752,7 +8752,7 @@ breakpoint_ops_for_event_location (const struct event= _location *location, if (location !=3D nullptr) return breakpoint_ops_for_event_location_type (event_location_type (location), is_tracepoint); - return &base_breakpoint_ops; + return &code_breakpoint_ops; } =20 /* 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. */ =20 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 () } =20 int -base_breakpoint::insert_location (struct bp_location *bl) +code_breakpoint::insert_location (struct bp_location *bl) { CORE_ADDR addr =3D bl->target_info.reqstd_address; =20 @@ -11499,7 +11499,7 @@ base_breakpoint::insert_location (struct bp_locatio= n *bl) } =20 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 !=3D nullptr) @@ -11515,7 +11515,7 @@ base_breakpoint::remove_location (struct bp_locatio= n *bl, } =20 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 } =20 std::vector -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) =3D=3D PROBE_LOCATION) @@ -12476,7 +12476,7 @@ hoist_existing_locations (struct breakpoint *b, str= uct program_space *pspace) untouched. */ =20 void -update_breakpoint_locations (base_breakpoint *b, +update_breakpoint_locations (code_breakpoint *b, struct program_space *filter_pspace, gdb::array_view sals, gdb::array_view sals_end) @@ -12684,7 +12684,7 @@ location_to_sals (struct breakpoint *b, struct even= t_location *location, locations. */ =20 static void -breakpoint_re_set_default (base_breakpoint *b) +breakpoint_re_set_default (code_breakpoint *b) { struct program_space *filter_pspace =3D current_program_space; std::vector 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 =3D &base_breakpoint_ops; + ops =3D &code_breakpoint_ops; location =3D string_to_event_location (&arg, current_language); type =3D 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 */, diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 8735396e8d4..566f1285e46 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -849,7 +849,7 @@ protected: /* 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; =20 @@ -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 sals, event_location_up &&location, gdb::unique_xmalloc_ptr filter, @@ -869,7 +869,7 @@ struct base_breakpoint : public breakpoint int enabled, unsigned flags, int display_canonical); =20 - ~base_breakpoint () override =3D 0; + ~code_breakpoint () override =3D 0; =20 /* 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. */ =20 -struct tracepoint : public base_breakpoint +struct tracepoint : public code_breakpoint { - using base_breakpoint::base_breakpoint; + using code_breakpoint::code_breakpoint; =20 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, i= nt); /* Initialize a struct bp_location. */ =20 extern void update_breakpoint_locations - (base_breakpoint *b, + (code_breakpoint *b, struct program_space *filter_pspace, gdb::array_view sals, gdb::array_view 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); =20 -extern const struct breakpoint_ops base_breakpoint_ops; +extern const struct breakpoint_ops code_breakpoint_ops; =20 /* 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::un= ique_ptr &&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. */ =20 extern const struct breakpoint_ops *breakpoint_ops_for_event_location (const struct event_location *location, bool is_tracepoint); diff --git a/gdb/elfread.c b/gdb/elfread.c index 27203722802..32cb27c8967 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -927,7 +927,7 @@ elf_gnu_ifunc_resolve_addr (struct gdbarch *gdbarch, CO= RE_ADDR pc) /* Handle inferior hit of bp_gnu_ifunc_resolver, see its definition. */ =20 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 =3D 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= . */ =20 static void -elf_gnu_ifunc_resolver_return_stop (base_breakpoint *b) +elf_gnu_ifunc_resolver_return_stop (code_breakpoint *b) { thread_info *thread =3D inferior_thread (); struct gdbarch *gdbarch =3D 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 =3D (base_breakpoint *) b_next; + b =3D (code_breakpoint *) b_next; } gdb_assert (b->type =3D=3D bp_gnu_ifunc_resolver); gdb_assert (b->loc->next =3D=3D NULL); diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 1d9fc0de436..d4a7562b281 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -327,12 +327,12 @@ mi_cmd_break_insert_1 (int dprintf, const char *comma= nd, char **argv, int argc) else if (dprintf) { type_wanted =3D bp_dprintf; - ops =3D &base_breakpoint_ops; + ops =3D &code_breakpoint_ops; } else { type_wanted =3D hardware ? bp_hardware_breakpoint : bp_breakpoint; - ops =3D &base_breakpoint_ops; + ops =3D &code_breakpoint_ops; } =20 if (is_explicit) diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 217ee047446..4ec62558b69 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1019,7 +1019,7 @@ stub_gnu_ifunc_resolve_name (const char *function_nam= e, /* See elf_gnu_ifunc_resolver_stop for its real implementation. */ =20 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. */ =20 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.")); diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpo= int.c index abd5b48a949..df54d3643ab 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -305,7 +305,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObje= ct *kwargs) bp_breakpoint, 0, AUTO_BOOLEAN_TRUE, - &base_breakpoint_ops, + &code_breakpoint_ops, 0, 1, internal_bp, 0); } catch (const gdb_exception &except) diff --git a/gdb/symtab.h b/gdb/symtab.h index 5218be587de..ac902a4cbbe 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -55,7 +55,7 @@ struct obj_section; struct cmd_list_element; class probe; struct lookup_name_info; -struct base_breakpoint; +struct code_breakpoint; =20 /* 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); =20 /* 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); =20 /* 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); }; =20 #define gnu_ifunc_resolve_addr gnu_ifunc_fns_p->gnu_ifunc_resolve_addr