From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 488C3385842B; Fri, 29 Apr 2022 22:23:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 488C3385842B 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] Convert static marker tracepoints to vtable ops X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 7b572efb48e6193149b803eac6256f3e423b7060 X-Git-Newrev: 6d7a8c568bfa0e4b84b3d0ffccaf073d58e3cc4b Message-Id: <20220429222356.488C3385842B@sourceware.org> Date: Fri, 29 Apr 2022 22:23:56 +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:23:56 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6d7a8c568bfa= 0e4b84b3d0ffccaf073d58e3cc4b commit 6d7a8c568bfa0e4b84b3d0ffccaf073d58e3cc4b Author: Tom Tromey Date: Sat Jan 15 20:03:54 2022 -0700 Convert static marker tracepoints to vtable ops =20 This converts static marker tracepoints to use vtable_breakpoint_ops. Diff: --- gdb/breakpoint.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index fc8892501c0..2c0a2aac191 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -294,6 +294,14 @@ struct ranged_breakpoint : public ordinary_breakpoint void print_recreate (struct ui_file *fp) override; }; =20 +/* Static tracepoints with marker (`-m'). */ +struct static_marker_tracepoint : public tracepoint +{ + std::vector decode_location + (struct event_location *location, + struct program_space *search_pspace) override; +}; + /* The style in which to perform a dynamic printf. This is a user option because different output options have different tradeoffs; if GDB does the printing, there is better error handling if there @@ -1209,11 +1217,14 @@ new_breakpoint_from_type (bptype type) =20 case bp_fast_tracepoint: case bp_static_tracepoint: - case bp_static_marker_tracepoint: case bp_tracepoint: b =3D new tracepoint (); break; =20 + case bp_static_marker_tracepoint: + b =3D new static_marker_tracepoint (); + break; + case bp_dprintf: b =3D new dprintf_breakpoint (); break; @@ -12425,23 +12436,21 @@ strace_marker_create_breakpoints_sal (struct gdba= rch *gdbarch, } } =20 -static std::vector -strace_marker_decode_location (struct breakpoint *b, - struct event_location *location, - struct program_space *search_pspace) +std::vector +static_marker_tracepoint::decode_location (struct event_location *location, + struct program_space *search_pspace) { - struct tracepoint *tp =3D (struct tracepoint *) b; const char *s =3D get_linespec_location (location)->spec_string; =20 std::vector sals =3D decode_static_tracepoint_spec (&s); - if (sals.size () > tp->static_trace_marker_id_idx) + if (sals.size () > static_trace_marker_id_idx) { - sals[0] =3D sals[tp->static_trace_marker_id_idx]; + sals[0] =3D sals[static_trace_marker_id_idx]; sals.resize (1); return sals; } else - error (_("marker %s not found"), tp->static_trace_marker_id.c_str ()); + error (_("marker %s not found"), static_trace_marker_id.c_str ()); } =20 static struct breakpoint_ops strace_marker_breakpoint_ops; @@ -14597,7 +14606,6 @@ initialize_breakpoint_ops (void) *ops =3D vtable_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; - ops->decode_location =3D strace_marker_decode_location; } =20 /* Chain containing all defined "enable breakpoint" subcommands. */