From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id D31FA3858405; Fri, 29 Apr 2022 22:24:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D31FA3858405 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove breakpoint ops initialization X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: a0cd5f080b0e2a51bc3122456d2101dafae04dca X-Git-Newrev: 8613a476b198e67ecd645cf74befe9a0dad255b3 Message-Id: <20220429222436.D31FA3858405@sourceware.org> Date: Fri, 29 Apr 2022 22:24:36 +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, 29 Apr 2022 22:24:36 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D8613a476b198= e67ecd645cf74befe9a0dad255b3 commit 8613a476b198e67ecd645cf74befe9a0dad255b3 Author: Tom Tromey Date: Sun Jan 16 19:23:48 2022 -0700 Remove breakpoint ops initialization =20 initialize_breakpoint_ops does not do much any more, so remove it in favor of statically-initialize objects. Diff: --- gdb/breakpoint.c | 70 +++++++++++++++++++++++++---------------------------= ---- gdb/breakpoint.h | 2 -- 2 files changed, 31 insertions(+), 41 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 0e59a1ab3aa..b6541b5bdb7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -234,11 +234,34 @@ static bool is_masked_watchpoint (const struct breakp= oint *b); =20 static int strace_marker_p (struct breakpoint *b); =20 +static void bkpt_probe_create_sals_from_location + (struct event_location *location, + struct linespec_result *canonical, + enum bptype type_wanted); +static void tracepoint_probe_create_sals_from_location + (struct event_location *location, + struct linespec_result *canonical, + enum bptype type_wanted); + +struct breakpoint_ops base_breakpoint_ops =3D +{ + create_sals_from_location_default, + create_breakpoints_sal_default, +}; + /* Breakpoints set on probes. */ -static struct breakpoint_ops bkpt_probe_breakpoint_ops; +static struct breakpoint_ops bkpt_probe_breakpoint_ops =3D +{ + bkpt_probe_create_sals_from_location, + create_breakpoints_sal_default, +}; =20 /* Tracepoints set on probes. */ -static struct breakpoint_ops tracepoint_probe_breakpoint_ops; +static struct breakpoint_ops tracepoint_probe_breakpoint_ops =3D +{ + tracepoint_probe_create_sals_from_location, + create_breakpoints_sal_default, +}; =20 /* The structure to be used in regular breakpoints. */ struct ordinary_breakpoint : public base_breakpoint @@ -11608,12 +11631,6 @@ breakpoint::decode_location (struct event_location= *location, internal_error_pure_virtual_called (); } =20 -struct breakpoint_ops base_breakpoint_ops =3D -{ - create_sals_from_location_default, - create_breakpoints_sal_default, -}; - /* Default breakpoint_ops methods. */ =20 void @@ -12227,7 +12244,12 @@ static_marker_tracepoint::decode_location (struct = event_location *location, error (_("marker %s not found"), static_trace_marker_id.c_str ()); } =20 -static struct breakpoint_ops strace_marker_breakpoint_ops; +/* Static tracepoints with marker (`-m'). */ +static struct breakpoint_ops strace_marker_breakpoint_ops =3D +{ + strace_marker_create_sals_from_location, + strace_marker_create_breakpoints_sal, +}; =20 static int strace_marker_p (struct breakpoint *b) @@ -14344,34 +14366,6 @@ breakpoint_free_objfile (struct objfile *objfile) loc->symtab =3D NULL; } =20 -void -initialize_breakpoint_ops (void) -{ - static int initialized =3D 0; - - struct breakpoint_ops *ops; - - if (initialized) - return; - initialized =3D 1; - - /* Probe breakpoints. */ - ops =3D &bkpt_probe_breakpoint_ops; - *ops =3D base_breakpoint_ops; - ops->create_sals_from_location =3D bkpt_probe_create_sals_from_location; - - /* Probe tracepoints. */ - ops =3D &tracepoint_probe_breakpoint_ops; - *ops =3D base_breakpoint_ops; - ops->create_sals_from_location =3D tracepoint_probe_create_sals_from_loc= ation; - - /* Static tracepoints with marker (`-m'). */ - ops =3D &strace_marker_breakpoint_ops; - *ops =3D base_breakpoint_ops; - ops->create_sals_from_location =3D strace_marker_create_sals_from_locati= on; - ops->create_breakpoints_sal =3D strace_marker_create_breakpoints_sal; -} - /* Chain containing all defined "enable breakpoint" subcommands. */ =20 static struct cmd_list_element *enablebreaklist =3D NULL; @@ -14386,8 +14380,6 @@ _initialize_breakpoint () { struct cmd_list_element *c; =20 - initialize_breakpoint_ops (); - gdb::observers::solib_unloaded.attach (disable_breakpoints_in_unloaded_s= hlib, "breakpoint"); gdb::observers::free_objfile.attach (disable_breakpoints_in_freed_objfil= e, diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 64f06a98b37..2d4a89fb3e6 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1400,8 +1400,6 @@ extern void tbreak_command (const char *, int); =20 extern struct breakpoint_ops base_breakpoint_ops; =20 -extern void initialize_breakpoint_ops (void); - /* Arguments to pass as context to some catch command handlers. */ #define CATCH_PERMANENT ((void *) (uintptr_t) 0) #define CATCH_TEMPORARY ((void *) (uintptr_t) 1)