From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 366C3385781D; Fri, 29 Apr 2022 22:23:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 366C3385781D 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] Add bp_static_marker_tracepoint X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: ec45bb676c9c69c30783bcf35ffdac8280f3b8bc X-Git-Newrev: 7b572efb48e6193149b803eac6256f3e423b7060 Message-Id: <20220429222351.366C3385781D@sourceware.org> Date: Fri, 29 Apr 2022 22:23:51 +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:51 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7b572efb48e6= 193149b803eac6256f3e423b7060 commit 7b572efb48e6193149b803eac6256f3e423b7060 Author: Tom Tromey Date: Sat Jan 15 20:01:41 2022 -0700 Add bp_static_marker_tracepoint =20 Because the actual construction of a breakpoint is buried deep in create_breakpoint, at present it's necessary to have a new bp_ enumerator constant any time a new subclass is needed. Static marker tracepoints are one such case, so this patch introduces bp_static_marker_tracepoint and updates various spots to recognize it. Diff: --- gdb/breakpoint.c | 32 +++++++++++++++++++++++--------- gdb/breakpoint.h | 2 ++ gdb/remote.c | 3 ++- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index aea6b994ae8..fc8892501c0 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1180,7 +1180,8 @@ is_tracepoint_type (bptype type) { return (type =3D=3D bp_tracepoint || type =3D=3D bp_fast_tracepoint - || type =3D=3D bp_static_tracepoint); + || type =3D=3D bp_static_tracepoint + || type =3D=3D bp_static_marker_tracepoint); } =20 /* See breakpoint.h. */ @@ -1208,6 +1209,7 @@ 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; @@ -1288,7 +1290,8 @@ validate_commands_for_breakpoint (struct breakpoint *= b, if (b->type =3D=3D bp_fast_tracepoint) error (_("The 'while-stepping' command " "cannot be used for fast tracepoint")); - else if (b->type =3D=3D bp_static_tracepoint) + else if (b->type =3D=3D bp_static_tracepoint + || b->type =3D=3D bp_static_marker_tracepoint) error (_("The 'while-stepping' command " "cannot be used for static tracepoint")); =20 @@ -1329,7 +1332,8 @@ static_tracepoints_here (CORE_ADDR addr) std::vector found; =20 for (breakpoint *b : all_breakpoints ()) - if (b->type =3D=3D bp_static_tracepoint) + if (b->type =3D=3D bp_static_tracepoint + || b->type =3D=3D bp_static_marker_tracepoint) { for (bp_location *loc : b->locations ()) if (loc->address =3D=3D addr) @@ -5794,6 +5798,7 @@ bpstat_what (bpstat *bs_head) case bp_tracepoint: case bp_fast_tracepoint: case bp_static_tracepoint: + case bp_static_marker_tracepoint: /* Tracepoint hits should not be reported back to GDB, and if one got through somehow, it should have been filtered out already. */ @@ -6078,6 +6083,7 @@ bptype_string (enum bptype type) {bp_tracepoint, "tracepoint"}, {bp_fast_tracepoint, "fast tracepoint"}, {bp_static_tracepoint, "static tracepoint"}, + {bp_static_marker_tracepoint, "static marker tracepoint"}, {bp_dprintf, "dprintf"}, {bp_jit_event, "jit events"}, {bp_gnu_ifunc_resolver, "STT_GNU_IFUNC resolver"}, @@ -7139,6 +7145,7 @@ bp_location_from_bp_type (bptype type) case bp_tracepoint: case bp_fast_tracepoint: case bp_static_tracepoint: + case bp_static_marker_tracepoint: return bp_loc_other; default: internal_error (__FILE__, __LINE__, _("unknown breakpoint type")); @@ -8350,7 +8357,8 @@ init_breakpoint_sal (struct breakpoint *b, struct gdb= arch *gdbarch, if ((flags & CREATE_BREAKPOINT_FLAGS_INSERTED) !=3D 0) b->loc->inserted =3D 1; =20 - if (type =3D=3D bp_static_tracepoint) + if (type =3D=3D bp_static_tracepoint + || type =3D=3D bp_static_marker_tracepoint) { struct tracepoint *t =3D (struct tracepoint *) b; struct static_tracepoint_marker marker; @@ -12199,7 +12207,8 @@ tracepoint::print_one_detail (struct ui_out *uiout)= const { if (!static_trace_marker_id.empty ()) { - gdb_assert (type =3D=3D bp_static_tracepoint); + gdb_assert (type =3D=3D bp_static_tracepoint + || type =3D=3D bp_static_marker_tracepoint); =20 uiout->message ("\tmarker id is %pF\n", string_field ("static-tracepoint-marker-string-id", @@ -12224,6 +12233,7 @@ tracepoint::print_mention () gdb_printf (_(" %d"), number); break; case bp_static_tracepoint: + case bp_static_marker_tracepoint: gdb_printf (_("Static tracepoint")); gdb_printf (_(" %d"), number); break; @@ -12240,7 +12250,8 @@ tracepoint::print_recreate (struct ui_file *fp) { if (type =3D=3D bp_fast_tracepoint) gdb_printf (fp, "ftrace"); - else if (type =3D=3D bp_static_tracepoint) + else if (type =3D=3D bp_static_tracepoint + || type =3D=3D bp_static_marker_tracepoint) gdb_printf (fp, "strace"); else if (type =3D=3D bp_tracepoint) gdb_printf (fp, "trace"); @@ -12438,7 +12449,7 @@ static struct breakpoint_ops strace_marker_breakpoi= nt_ops; static int strace_marker_p (struct breakpoint *b) { - return b->ops =3D=3D &strace_marker_breakpoint_ops; + return b->type =3D=3D bp_static_marker_tracepoint; } =20 /* Delete a breakpoint and clean up all traces of it in the data @@ -13044,7 +13055,7 @@ location_to_sals (struct breakpoint *b, struct even= t_location *location, b->condition_not_parsed =3D 0; } =20 - if (b->type =3D=3D bp_static_tracepoint && !strace_marker_p (b)) + if (b->type =3D=3D bp_static_tracepoint) sals[0] =3D update_static_tracepoint (b, sals[0]); =20 *found =3D 1; @@ -13921,6 +13932,7 @@ strace_command (const char *arg, int from_tty) { struct breakpoint_ops *ops; event_location_up location; + enum bptype type; =20 /* Decide if we are dealing with a static tracepoint marker (`-m'), or with a normal static tracepoint. */ @@ -13928,18 +13940,20 @@ strace_command (const char *arg, int from_tty) { ops =3D &strace_marker_breakpoint_ops; location =3D new_linespec_location (&arg, symbol_name_match_type::FU= LL); + type =3D bp_static_marker_tracepoint; } else { ops =3D &vtable_breakpoint_ops; location =3D string_to_event_location (&arg, current_language); + type =3D bp_static_tracepoint; } =20 create_breakpoint (get_current_arch (), location.get (), NULL, 0, arg, false, 1 /* parse arg */, 0 /* tempflag */, - bp_static_tracepoint /* type_wanted */, + type /* type_wanted */, 0 /* Ignore count */, pending_break_support, ops, diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 7d8c4f3bc3a..4e52656dc7c 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -183,6 +183,8 @@ enum bptype bp_tracepoint, bp_fast_tracepoint, bp_static_tracepoint, + /* Like bp_static_tracepoint but for static markers. */ + bp_static_marker_tracepoint, =20 /* A dynamic printf stops at the given location, does a formatted print, then automatically continues. (Although this is sort of diff --git a/gdb/remote.c b/gdb/remote.c index ff98024cd78..6914947c172 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -13224,7 +13224,8 @@ remote_target::download_tracepoint (struct bp_locat= ion *loc) warning (_("Target does not support fast tracepoints, " "downloading %d as regular tracepoint"), b->number); } - else if (b->type =3D=3D bp_static_tracepoint) + else if (b->type =3D=3D bp_static_tracepoint + || b->type =3D=3D bp_static_marker_tracepoint) { /* Only test for support at download time; we may not know target capabilities at definition time. */