From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from outbound-ss-820.bluehost.com (outbound-ss-820.bluehost.com [69.89.24.241]) by sourceware.org (Postfix) with ESMTPS id B76BD3857813 for ; Tue, 18 Jan 2022 19:40:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B76BD3857813 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw13.mail.unifiedlayer.com (unknown [10.0.90.128]) by progateway2.mail.pro1.eigbox.com (Postfix) with ESMTP id 33C2D10041521 for ; Tue, 18 Jan 2022 19:40:19 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id 9uL4nWPCYEaNC9uL5nPhlj; Tue, 18 Jan 2022 19:40:19 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=dJtjJMVb c=1 sm=1 tr=0 ts=61e717a3 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=DghFqjY3_ZEA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=_vhvy-_qKPA13JR0U6gA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ALm6lGIXxQqgX/pzHep/FEep5+ZzdkOFSnphZkEGRvw=; b=G+6yBaWBPuP3fplTeQw4Oe2KwE Kve9rKBvP0EzjgRwCEEtQHJBBbKfpOBf8onTEiv6TQ1Tx6PeKkqK0BLWh+mnUGPFTQOtkcJNGqQyZ 0ky68oVYDivmhgoXaUeE8O0Jd; Received: from 75-166-134-30.hlrn.qwest.net ([75.166.134.30]:40586 helo=prentzel.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n9uL4-0015YU-Bn; Tue, 18 Jan 2022 12:40:18 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 24/36] Add bp_static_marker_tracepoint Date: Tue, 18 Jan 2022 12:39:55 -0700 Message-Id: <20220118194007.2853108-25-tom@tromey.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220118194007.2853108-1-tom@tromey.com> References: <20220118194007.2853108-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.134.30 X-Source-L: No X-Exim-ID: 1n9uL4-0015YU-Bn X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-134-30.hlrn.qwest.net (prentzel.Home) [75.166.134.30]:40586 X-Source-Auth: tom+tromey.com X-Email-Count: 25 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3021.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2022 19:40:21 -0000 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. --- 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 eacaee1b349..e1c6efafc25 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1180,7 +1180,8 @@ is_tracepoint_type (bptype type) { return (type == bp_tracepoint || type == bp_fast_tracepoint - || type == bp_static_tracepoint); + || type == bp_static_tracepoint + || type == bp_static_marker_tracepoint); } /* See breakpoint.h. */ @@ -1208,6 +1209,7 @@ new_breakpoint_from_type (bptype type) case bp_fast_tracepoint: case bp_static_tracepoint: + case bp_static_marker_tracepoint: case bp_tracepoint: b = new tracepoint (); break; @@ -1288,7 +1290,8 @@ validate_commands_for_breakpoint (struct breakpoint *b, if (b->type == bp_fast_tracepoint) error (_("The 'while-stepping' command " "cannot be used for fast tracepoint")); - else if (b->type == bp_static_tracepoint) + else if (b->type == bp_static_tracepoint + || b->type == bp_static_marker_tracepoint) error (_("The 'while-stepping' command " "cannot be used for static tracepoint")); @@ -1329,7 +1332,8 @@ static_tracepoints_here (CORE_ADDR addr) std::vector found; for (breakpoint *b : all_breakpoints ()) - if (b->type == bp_static_tracepoint) + if (b->type == bp_static_tracepoint + || b->type == bp_static_marker_tracepoint) { for (bp_location *loc : b->locations ()) if (loc->address == addr) @@ -5728,6 +5732,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. */ @@ -6019,6 +6024,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"}, @@ -7080,6 +7086,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")); @@ -8292,7 +8299,8 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, if ((flags & CREATE_BREAKPOINT_FLAGS_INSERTED) != 0) b->loc->inserted = 1; - if (type == bp_static_tracepoint) + if (type == bp_static_tracepoint + || type == bp_static_marker_tracepoint) { struct tracepoint *t = (struct tracepoint *) b; struct static_tracepoint_marker marker; @@ -12211,7 +12219,8 @@ tracepoint::print_one_detail (struct ui_out *uiout) const { if (!static_trace_marker_id.empty ()) { - gdb_assert (type == bp_static_tracepoint); + gdb_assert (type == bp_static_tracepoint + || type == bp_static_marker_tracepoint); uiout->message ("\tmarker id is %pF\n", string_field ("static-tracepoint-marker-string-id", @@ -12236,6 +12245,7 @@ tracepoint::print_mention () printf_filtered (_(" %d"), number); break; case bp_static_tracepoint: + case bp_static_marker_tracepoint: printf_filtered (_("Static tracepoint")); printf_filtered (_(" %d"), number); break; @@ -12252,7 +12262,8 @@ tracepoint::print_recreate (struct ui_file *fp) { if (type == bp_fast_tracepoint) fprintf_unfiltered (fp, "ftrace"); - else if (type == bp_static_tracepoint) + else if (type == bp_static_tracepoint + || type == bp_static_marker_tracepoint) fprintf_unfiltered (fp, "strace"); else if (type == bp_tracepoint) fprintf_unfiltered (fp, "trace"); @@ -12451,7 +12462,7 @@ static struct breakpoint_ops strace_marker_breakpoint_ops; static int strace_marker_p (struct breakpoint *b) { - return b->ops == &strace_marker_breakpoint_ops; + return b->type == bp_static_marker_tracepoint; } /* Delete a breakpoint and clean up all traces of it in the data @@ -13056,7 +13067,7 @@ location_to_sals (struct breakpoint *b, struct event_location *location, b->condition_not_parsed = 0; } - if (b->type == bp_static_tracepoint && !strace_marker_p (b)) + if (b->type == bp_static_tracepoint) sals[0] = update_static_tracepoint (b, sals[0]); *found = 1; @@ -13933,6 +13944,7 @@ strace_command (const char *arg, int from_tty) { struct breakpoint_ops *ops; event_location_up location; + enum bptype type; /* Decide if we are dealing with a static tracepoint marker (`-m'), or with a normal static tracepoint. */ @@ -13940,18 +13952,20 @@ strace_command (const char *arg, int from_tty) { ops = &strace_marker_breakpoint_ops; location = new_linespec_location (&arg, symbol_name_match_type::FULL); + type = bp_static_marker_tracepoint; } else { ops = &vtable_breakpoint_ops; location = string_to_event_location (&arg, current_language); + type = bp_static_tracepoint; } 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 4bbfb27f733..e362cd454ec 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, /* 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 b093ad86675..e739a8f4ceb 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -13236,7 +13236,8 @@ remote_target::download_tracepoint (struct bp_location *loc) warning (_("Target does not support fast tracepoints, " "downloading %d as regular tracepoint"), b->number); } - else if (b->type == bp_static_tracepoint) + else if (b->type == bp_static_tracepoint + || b->type == bp_static_marker_tracepoint) { /* Only test for support at download time; we may not know target capabilities at definition time. */ -- 2.31.1