From patchwork Fri Jan 10 16:01:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 104488 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 079B73858406 for ; Fri, 10 Jan 2025 16:03:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 079B73858406 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=KHLuFNtU X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by sourceware.org (Postfix) with ESMTPS id D1E673857B8F for ; Fri, 10 Jan 2025 16:01:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1E673857B8F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D1E673857B8F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524920; cv=none; b=iz1kdflYnKYhflo07eHvVG5yt34etbkJMC+EHQTbj+WzEjlUWdicYS4b8jt9tjd/i19SdzKBm02y0xMqn0dr8Z2O5we2n3snPa8iJ33T7fI8XfQGdAQVkEap4xo516FDM6BF+s3U4IWbZXjGEj1fyYog+IkAd4NhK2E/fK1veCw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524920; c=relaxed/simple; bh=04RRKZDtBdofdnGubxgsBIFmbM7jSh7x4zY2sbZZMbw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=P5oa6KxAYEl08iHhs/ZC9MGqhWBvzVCzpwYdIXmN1Gjgr+k0pwZjmmRXfImFu76SSYHM+yuM4AJpcH2OOOZQb3AuaslUqu4Q8d23+diDNMCAEp0cPUnjwyXTEKbrE+v/vLv6lIYVEVAN4bzdD80BbGPgAI27XxOIRE5K0NLv2ic= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D1E673857B8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736524920; x=1768060920; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=04RRKZDtBdofdnGubxgsBIFmbM7jSh7x4zY2sbZZMbw=; b=KHLuFNtU8mUDXrC50mn91G0Wz5hoHeoTFZxLD3fBUA71V8LWcvk15KxC JP2xptwSZfRFH4CpUjPndwNgT76bPbcuKs3Wjo5szLgQ9Yu0Gif67hPcY GB2JQlfd9GPYjsHw6d40UHykUElzSocoSfLw13GAHV1bHraReWypIciW4 Cw5O5F6oUMCqRH8656CtTHAAzWTdKExaeNY8cWT/Bgwv9PJ6RQvR9mS/D VxLtrHrbeWlOop6nuOXMM7Oq6C6bhwz+K5OV47vihdxfKHSgLmNcVhI+Y v/qMB/8R2/t2TJWrRAXbmsctQ5AZWUC2x+eaOI0IQQPCgTIVIqymyAJit Q==; X-CSE-ConnectionGUID: Wwux6MiWQEGykVRWPQKpWg== X-CSE-MsgGUID: WKbqQqBCRe21SMoUTXMJOQ== X-IronPort-AV: E=McAfee;i="6700,10204,11311"; a="36931335" X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="36931335" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:01:59 -0800 X-CSE-ConnectionGUID: zSVGnAAxSs+dLibIdsw5tg== X-CSE-MsgGUID: Rxu1XynrQxShPZhr1x0SbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="141072086" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:01:58 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org, Simon Marchi , Eli Zaretskii Subject: [PATCH v2 1/8] gdb, doc: do a minor fix in the description of qTSTMat Date: Fri, 10 Jan 2025 17:01:11 +0100 Message-Id: <20250110-upstream-gdbserver-remove-ust-v2-1-1ab116ffe592@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> References: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Fix a typo and do a format change. --- gdb/doc/gdb.texinfo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 7bd760648500e6064558d6a321fec9fd6b2cfa75..1b8dcc9335ac61ce459a8d3db75b7e53aad1c994 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -46395,9 +46395,9 @@ query), until the target responds with @samp{l} (lower-case ell, for @item qTSTMat:@var{address} @anchor{qTSTMat} @cindex @samp{qTSTMat} packet -This packets requests data about static tracepoint markers in the +This packet requests data about static tracepoint markers in the target program at @var{address}. Replies to this packet follow the -syntax of the @samp{qTfSTM} and @code{qTsSTM} packets that list static +syntax of the @code{qTfSTM} and @code{qTsSTM} packets that list static tracepoint markers. @item QTSave:@var{filename} From patchwork Fri Jan 10 16:01:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 104485 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B1F9B3857B8F for ; Fri, 10 Jan 2025 16:02:45 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by sourceware.org (Postfix) with ESMTPS id EC2FD385780C for ; Fri, 10 Jan 2025 16:02:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC2FD385780C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC2FD385780C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524929; cv=none; b=vmbV39O+dXUQcRj1QkoT4GlzkvRbthCVSPEf+aYKfTjco8XAcmJfmqEYcOEGLcU8Ofzs4rajG31BGFgzZCq6GptTFo+w+D5onCgqWluE8jiIxVjC7tfMlBdW+dADD8Q6NmcAGwWuFIZ28/Q2yW58oJ2z193gBCvzo5cDcsM07iw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524929; c=relaxed/simple; bh=u38Dci2UX7AAnmGoMN7eX4jnm4XkwCJXcaWrxdE+yVM=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=CLK+K2eMnubd0mvNUAsKucpyTw3fUNZTKFmV8swUm73SIQ02Pf/RnXMop8VL22m9StjQVfDmfy+XUysXhcVy76Ip4SBPPRVHHRVOkg/pGW7kuPu4XOQPwJY6G6nU3bO0p2oemgzbQpR5HbY7N4HtatTVt9Td+P6mhcLpf+XZbIM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736524929; x=1768060929; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=u38Dci2UX7AAnmGoMN7eX4jnm4XkwCJXcaWrxdE+yVM=; b=Bi74JRGGYohZfyLQTXo2to8aN9zfvFvsiv1i2o8226MAjPXbfAqbYe8d Oe3WbG58WggFCpuyw9L4YLJVSfxzIUdPY8N9L6gXUm8u1iRZjV3Az5Q/e 9nJ7jY5GJKDnWvRFPhUjFcX2O6iSpBR7hubxHaoshGM06rwV7w9XSXe5F tFmuXvCGA/y5gPfW3uyAkeDoq3cYrZuIZZoRQzsFGlV49gQnKx9h4iC1J OM/zYJEFP5ZKw0q/NIvae3CdW1SaUsQCdN2W8G18IVLZt7g4aoLzXOH4g WK0qr1glvC6IZFB5Yrny4dpTH/aojl71KuQJ+HAtgzeWjHWLfrX5KIAt9 g==; X-CSE-ConnectionGUID: 7A+IM5gNQfabyDkTPZlWJg== X-CSE-MsgGUID: zcJJRdiiT4qSfF8xaU05+g== X-IronPort-AV: E=McAfee;i="6700,10204,11311"; a="36931366" X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="36931366" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:09 -0800 X-CSE-ConnectionGUID: 2ioKu1VJQQq3Mz4H+OvqKA== X-CSE-MsgGUID: eg2EObf+RxWlVC2G5Agy+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="141072112" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:07 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org, Simon Marchi , Eli Zaretskii Subject: [PATCH v2 2/8] gdb, doc: mention the 'S' option for the QTDP packet Date: Fri, 10 Jan 2025 17:01:12 +0100 Message-Id: <20250110-upstream-gdbserver-remove-ust-v2-2-1ab116ffe592@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> References: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org I noticed that gdbserver accepts an 'S' option for the QTDP packet to create a static tracepoint, but this is not mentioned in the document. Update the document. I first thought about updating the argument as `[:Flen|:S]`, but then opted for `[:Flen][:S]`. Although it is odd that ':F' and ':S' are allowed to co-exist, the implementation at the gdbserver side allows this and handles the packet arguments so that the right-most positioned ':F' or ':S' overwrites the final tracepoint type. When the documentation is missing, the implementation usually determines the behavior. Reviewed-By: Eli Zaretskii --- gdb/doc/gdb.texinfo | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 1b8dcc9335ac61ce459a8d3db75b7e53aad1c994..459458f5665953a10f5f87ce349484ab5d0f6d1a 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -45972,7 +45972,7 @@ tracepoints (@pxref{Tracepoints}). @table @samp -@item QTDP:@var{n}:@var{addr}:@var{ena}:@var{step}:@var{pass}[:F@var{flen}][:X@var{len},@var{bytes}]@r{[}-@r{]} +@item QTDP:@var{n}:@var{addr}:@var{ena}:@var{step}:@var{pass}[:F@var{flen}][:S][:X@var{len},@var{bytes}]@r{[}-@r{]} @cindex @samp{QTDP} packet Create a new tracepoint, number @var{n}, at @var{addr}. If @var{ena} is @samp{E}, then the tracepoint is enabled; if it is @samp{D}, then @@ -45980,7 +45980,8 @@ the tracepoint is disabled. The @var{step} gives the tracepoint's step count, and @var{pass} gives its pass count. If an @samp{F} is present, then the tracepoint is to be a fast tracepoint, and the @var{flen} is the number of bytes that the target should copy elsewhere to make room -for the tracepoint. If an @samp{X} is present, it introduces a +for the tracepoint. If an @samp{S} is present, the tracepoint is to be +a static tracepoint. If an @samp{X} is present, it introduces a tracepoint condition, which consists of a hexadecimal length, followed by a comma and hex-encoded bytes, in a manner similar to action encodings as described below. If the trailing @samp{-} is present, From patchwork Fri Jan 10 16:01:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 104489 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B7A93858C35 for ; Fri, 10 Jan 2025 16:04:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B7A93858C35 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NAjKcGBD X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by sourceware.org (Postfix) with ESMTPS id C20233858280 for ; Fri, 10 Jan 2025 16:02:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C20233858280 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C20233858280 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524934; cv=none; b=M3hC2MwnHekgn+rj8UUgfuFdq2KagzucSsQnSdaDOwmt791J5EPuap3jqbwoBQfA5A+woEGDm4M6P/hE6QM0jE419TgKaXvOuAuR7odjvsdBnfR5nUFf/AzkEDCGPc1GN6kTUYnUKRBJscCX04YMN7czPC+dlgB1O8sQakJEY/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524934; c=relaxed/simple; bh=1jjXDMGVd7KncGsf6+BHxSehkGer3F90iGBT1/9rKwA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=OsWgUHXCfPbCETQwwpGbkEe85QgRWCHlecqNDmrdpjAmQeHYmX95vt4HeJPFZsdjHICai7/ejeaYVWmvKnDaRABS9QwRzLNBiMKgRL/4S5fUMa5O68ZsLrcMs/fo9h6jK62D7T4Z5Wx8KOhBQQu+546URd0C/Q838kNKXdIxj4E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736524934; x=1768060934; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=1jjXDMGVd7KncGsf6+BHxSehkGer3F90iGBT1/9rKwA=; b=NAjKcGBDPZEQwkfmVYnR5yq2FBQBjgDINrIINz/9G+rR+voUQ00HcRZl v6DiMk0OunSDDFSJ43ZxVYtO4ZxuoTS0FP8GjNKgxq3xE/eqCPHX671b5 ShLuuYrgio2LDGIFzfUH+taT64T+yde8M0kpB8R0tORhWOPXPJtL8TTfs xpHy/5g2+eWqne+SWv9s5AvfCJNybP2X3+vYfcn8OlUtrhpm5jp2fo25D UjwTM79STUlRLt+7/7OgiK5r/aMDtbkvcfNjsGj7Rj9GzqVY+q+43+VmD AlqnNULh0oRiHOOyHzYlKsOyNSdz+yJtBmwg4wAnmqHyMfbScNLsXXSxf g==; X-CSE-ConnectionGUID: QPX+mnZ/TBivJwcItyKVgg== X-CSE-MsgGUID: Ll/Nx+mASTyzMPZii/Iryw== X-IronPort-AV: E=McAfee;i="6700,10204,11311"; a="36931383" X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="36931383" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:13 -0800 X-CSE-ConnectionGUID: FYdYDplLR9G9WRrP5x+jdQ== X-CSE-MsgGUID: jv7Ub2yOTzayQqEEjqEZQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="141072122" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:12 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org, Simon Marchi , Eli Zaretskii Subject: [PATCH v2 3/8] gdb, doc: describe the 'L' tracepoint action Date: Fri, 10 Jan 2025 17:01:13 +0100 Message-Id: <20250110-upstream-gdbserver-remove-ust-v2-3-1ab116ffe592@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> References: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org I noticed that 'L' is a tracepoint action but it is not defined in the document. Add the description. Reviewed-By: Eli Zaretskii --- gdb/doc/gdb.texinfo | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 459458f5665953a10f5f87ce349484ab5d0f6d1a..3c046db83b4f29faab31053ffdf56a463bfdc7bd 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -46041,6 +46041,9 @@ two-digit hex number in the packet; @var{len} is the number of bytes in the expression (and thus one-half the number of hex digits in the packet). +@item L +Collect static trace data. + @end table Any number of actions may be packed together in a single @samp{QTDP} From patchwork Fri Jan 10 16:01:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 104487 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 039463857002 for ; Fri, 10 Jan 2025 16:03:15 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by sourceware.org (Postfix) with ESMTPS id 660D33857BA9 for ; Fri, 10 Jan 2025 16:02:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 660D33857BA9 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 660D33857BA9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524938; cv=none; b=p8Nu9YZH0PfjKnG5s2wWIQwiWVlrY6NShV/EHq/6nFOVv3aGqmHUifzs50CllcB8Nd+Gmghun4t6T6cpxGEv2thFwkA1wDPmkrXfaid6iyy9vWmGt9njDSBIsU1bTvq5evZEGQQsl3fr6ukwktcS4cGlcc1TAkU5yB6nvktzkVc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524938; c=relaxed/simple; bh=1pOowdp0YoYH0kOGUPlgYPFNI/whB4KHPm8TodjBlwE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=CRjYsPnTwZ4RPMNK0o3NIyPNL2hcu/mbvDgpRZZAX7h1zfjodWhP0oKYJsO1pYQRXFGoSQEoxew3fLwq/Mpmnuimn78GV6WrMQYZ4hfLs5zm9mB++Vf5jbUKL0xdUZXBBRioR39WODVFYF4Ri3bRTrBvfPc1O+jRRsy1E4nnNc8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736524939; x=1768060939; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=1pOowdp0YoYH0kOGUPlgYPFNI/whB4KHPm8TodjBlwE=; b=ZPTFnbK2C9hOgrZVn6KRTOXLTxz0oo0S0kvz6tdZdyZwEqvKRkgXoXLS ASGK6xfVs0Kb4H37bJG7wjsHks+VTWSZgIXLD0WbsjwZXZESvhT7iXrej /33fG/hIVMdLlc6i39zp3Teuya4RpQAhS2ZQWTD/CMo1YMd6Oig3Mwf02 9zRrXQW+VjHrdGup7T1fm9HIHd+v+XDPBi3aFw1nrQZeZTe25lmlrpHWT BUeS2xKKUKsacBuW01J83NcYhkylLuJ34pkX1dblqIi7faODOkTRzDICv Cy9BnmrSPPrBGRiUmBXXZJZ+mzxW/Am9JmRPN/u/J/iTvPsq5+mKn+oHa A==; X-CSE-ConnectionGUID: wKlRu1rIRRO0t79OQUrENA== X-CSE-MsgGUID: iW6CoV4hS2WETT1Ciu2DBQ== X-IronPort-AV: E=McAfee;i="6700,10204,11311"; a="36931397" X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="36931397" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:19 -0800 X-CSE-ConnectionGUID: QGO6UrLZQzC5+r6LyVDWzg== X-CSE-MsgGUID: vuPliTvZQ2Ge0tedYPvNTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="141072136" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:17 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org, Simon Marchi , Eli Zaretskii Subject: [PATCH v2 4/8] gdbserver: remove UST (static tracepoint) support (part 1) Date: Fri, 10 Jan 2025 17:01:14 +0100 Message-Id: <20250110-upstream-gdbserver-remove-ust-v2-4-1ab116ffe592@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> References: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org UST support in gdbserver is substantially outdated. Simon says: ...[having HAVE_UST defined] never happens nowadays because it used a version of lttng-ust that has been deprecated for a loooong time (the 0.x series). So everything in HAVE_UST just bitrots. It might be possible to update all this code to use lttng-ust 2.x (1.x never existed), but I don't think it's going to happen unless somebody specifically asks for it. I would suggest removing support for UST from gdbserver. ...If we ever want to resurrect the support for UST and port to 2.x, we can get the code from the git history. This patch removes the support, mostly mechanically by deleting code guarded by `#ifdef HAVE_UST`. After these removals, `struct static_tracepoint_ctx` becomes unused. So, remove it, too. The following patches remove more code. Reviewed-By: Eli Zaretskii --- gdb/NEWS | 2 + gdb/doc/gdb.texinfo | 16 +- gdbserver/Makefile.in | 9 - gdbserver/config.in | 3 - gdbserver/configure | 94 -------- gdbserver/configure.ac | 55 ----- gdbserver/linux-amd64-ipa.cc | 88 ------- gdbserver/linux-i386-ipa.cc | 77 ------ gdbserver/tracepoint.cc | 563 ------------------------------------------- 9 files changed, 6 insertions(+), 901 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 1b218c40a23e620f1b5e8ecea5b4e7efdbedd057..fce55c69c82b9e8a21330147ad7eceff15216e43 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -3,6 +3,8 @@ *** Changes since GDB 16 +* UST (static tracepoint) support from gdbserver has been removed. + * New commands maintenance check psymtabs diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 3c046db83b4f29faab31053ffdf56a463bfdc7bd..89e00ad77a1d9fb2b23eca29b968ae7f92cf8bff 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -24170,21 +24170,13 @@ of a multi-process mode debug session. @subsection Tracepoints support in @code{gdbserver} @cindex tracepoints support in @code{gdbserver} -On some targets, @code{gdbserver} supports tracepoints, fast -tracepoints and static tracepoints. +On some targets, @code{gdbserver} supports tracepoints and fast +tracepoints. -For fast or static tracepoints to work, a special library called the +For fast tracepoints to work, a special library called the @dfn{in-process agent} (IPA), must be loaded in the inferior process. This library is built and distributed as an integral part of -@code{gdbserver}. In addition, support for static tracepoints -requires building the in-process agent library with static tracepoints -support. At present, the UST (LTTng Userspace Tracer, -@url{http://lttng.org/ust}) tracing engine is supported. This support -is automatically available if UST development headers are found in the -standard include path when @code{gdbserver} is built, or if -@code{gdbserver} was explicitly configured using @option{--with-ust} -to point at such headers. You can explicitly disable the support -using @option{--with-ust=no}. +@code{gdbserver}. There are several ways to load the in-process agent in your program: diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index 365dcf23650476305dacc421c426fe54f4003301..491882e92e3481a7151ef10d2fb89e77f9e76d89 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -104,10 +104,6 @@ LIBIBERTY = $(LIBIBERTY_NORMAL) GDBSUPPORT_BUILDDIR = ../gdbsupport GDBSUPPORT = $(GDBSUPPORT_BUILDDIR)/libgdbsupport.a -# Where is ust? These will be empty if ust was not available. -ustlibs = @ustlibs@ -ustinc = @ustinc@ - # gnulib GNULIB_PARENT_DIR = .. include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc @@ -489,10 +485,6 @@ MAKEOVERRIDES = regdat_sh = $(srcdir)/../gdb/regformats/regdat.sh osabi_def = $(srcdir)/../gdbsupport/osabi.def -UST_CFLAGS = \ - $(ustinc) \ - -DCONFIG_UST_GDB_INTEGRATION - # Undo gnulib replacements for the IPA shared library build. # The gnulib headers are still needed, but gnulib is not linked # into the IPA lib so replacement apis don't work. @@ -506,7 +498,6 @@ UNDO_GNULIB_CFLAGS = \ # the first place. IPAGENT_CFLAGS = \ $(INTERNAL_CFLAGS) \ - $(UST_CFLAGS) \ $(UNDO_GNULIB_CFLAGS) \ -fPIC -DIN_PROCESS_AGENT \ -fvisibility=hidden diff --git a/gdbserver/config.in b/gdbserver/config.in index 65f9ff6e6470369ce8487e0ea3bdb186f323f7b1..ead66ce7a5746c5820f06e985332e4df9949b0ba 100644 --- a/gdbserver/config.in +++ b/gdbserver/config.in @@ -384,9 +384,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define if UST is available */ -#undef HAVE_UST - /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK diff --git a/gdbserver/configure b/gdbserver/configure index 32980e5017edf88ae99d460e92787daadb0eddae..7ff11247e51db6c03fefed3fa770dbaf5ad6b334 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -637,8 +637,6 @@ REPORT_BUGS_TO PKGVERSION WERROR_CFLAGS WARN_CFLAGS -ustinc -ustlibs CCDEPMODE CONFIG_SRC_SUBDIR CATOBJEXT @@ -775,9 +773,6 @@ with_libiconv_prefix with_libiconv_type with_libintl_prefix with_libintl_type -with_ust -with_ust_include -with_ust_lib enable_werror enable_build_warnings enable_gdb_build_warnings @@ -1451,11 +1446,6 @@ Optional Packages: --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir --with-libintl-type=TYPE type of library to search for (auto/static/shared) - --with-ust=PATH Specify prefix directory for the installed UST package - Equivalent to --with-ust-include=PATH/include - plus --with-ust-lib=PATH/lib - --with-ust-include=PATH Specify directory for installed UST include files - --with-ust-lib=PATH Specify the directory for the installed UST library --with-pkgversion=PKG Use PKG in the version string in place of "GDB" --with-bugurl=URL Direct users to URL to report a bug --with-libthread-db=PATH @@ -13601,90 +13591,6 @@ _ACEOF fi -# Check for UST -ustlibs="" -ustinc="" - - -# Check whether --with-ust was given. -if test "${with_ust+set}" = set; then : - withval=$with_ust; -fi - - -# Check whether --with-ust_include was given. -if test "${with_ust_include+set}" = set; then : - withval=$with_ust_include; -fi - - -# Check whether --with-ust_lib was given. -if test "${with_ust_lib+set}" = set; then : - withval=$with_ust_lib; -fi - - -case $with_ust in - no) - ustlibs= - ustinc= - ;; - "" | yes) - ustlibs=" -lust " - ustinc="" - ;; - *) - ustlibs="-L$with_ust/lib -lust" - ustinc="-I$with_ust/include " - ;; -esac -if test "x$with_ust_include" != x; then - ustinc="-I$with_ust_include " -fi -if test "x$with_ust_lib" != x; then - ustlibs="-L$with_ust_lib -lust" -fi - -if test "x$with_ust" != "xno"; then - saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ustinc" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ust" >&5 -$as_echo_n "checking for ust... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define CONFIG_UST_GDB_INTEGRATION -#include - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; }; - -$as_echo "#define HAVE_UST 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ustlibs= ; ustinc= - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$saved_CFLAGS" -fi - -# Flags needed for UST - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking the compiler type" >&5 diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac index 6e3a73a58d53b1bd005bd8d452c118a0835752b6..7a15b8fad99fdac9019697d2d213a871e193ad20 100644 --- a/gdbserver/configure.ac +++ b/gdbserver/configure.ac @@ -108,61 +108,6 @@ AC_CHECK_FUNCS([ \ # Check the return and argument types of ptrace. GDB_AC_PTRACE -# Check for UST -ustlibs="" -ustinc="" - -AC_ARG_WITH(ust, [ --with-ust=PATH Specify prefix directory for the installed UST package - Equivalent to --with-ust-include=PATH/include - plus --with-ust-lib=PATH/lib]) -AC_ARG_WITH(ust_include, [ --with-ust-include=PATH Specify directory for installed UST include files]) -AC_ARG_WITH(ust_lib, [ --with-ust-lib=PATH Specify the directory for the installed UST library]) - -case $with_ust in - no) - ustlibs= - ustinc= - ;; - "" | yes) - ustlibs=" -lust " - ustinc="" - ;; - *) - ustlibs="-L$with_ust/lib -lust" - ustinc="-I$with_ust/include " - ;; -esac -if test "x$with_ust_include" != x; then - ustinc="-I$with_ust_include " -fi -if test "x$with_ust_lib" != x; then - ustlibs="-L$with_ust_lib -lust" -fi - -if test "x$with_ust" != "xno"; then - saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $ustinc" - AC_MSG_CHECKING([for ust]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [ -#define CONFIG_UST_GDB_INTEGRATION -#include - ], - [] - )], - [AC_MSG_RESULT([yes]); - AC_DEFINE(HAVE_UST, 1, [Define if UST is available])], - [AC_MSG_RESULT([no]) - ustlibs= ; ustinc= ] - ) - CFLAGS="$saved_CFLAGS" -fi - -# Flags needed for UST -AC_SUBST(ustlibs) -AC_SUBST(ustinc) - AM_GDB_COMPILER_TYPE AM_GDB_WARNINGS diff --git a/gdbserver/linux-amd64-ipa.cc b/gdbserver/linux-amd64-ipa.cc index c53758a7dbe9f69d006bd9ee2fc815609fe4edf4..046636834fbef5655acb3ab2397916ccedbe0731 100644 --- a/gdbserver/linux-amd64-ipa.cc +++ b/gdbserver/linux-amd64-ipa.cc @@ -76,94 +76,6 @@ get_raw_reg (const unsigned char *raw_regs, int regnum) return *(ULONGEST *) (raw_regs + x86_64_ft_collect_regmap[regnum]); } -#ifdef HAVE_UST - -#include - -/* "struct registers" is the UST object type holding the registers at - the time of the static tracepoint marker call. This doesn't - contain RIP, but we know what it must have been (the marker - address). */ - -#define ST_REGENTRY(REG) \ - { \ - offsetof (struct registers, REG), \ - sizeof (((struct registers *) NULL)->REG) \ - } - -static struct -{ - int offset; - int size; -} x86_64_st_collect_regmap[] = - { - ST_REGENTRY(rax), - ST_REGENTRY(rbx), - ST_REGENTRY(rcx), - ST_REGENTRY(rdx), - ST_REGENTRY(rsi), - ST_REGENTRY(rdi), - ST_REGENTRY(rbp), - ST_REGENTRY(rsp), - ST_REGENTRY(r8), - ST_REGENTRY(r9), - ST_REGENTRY(r10), - ST_REGENTRY(r11), - ST_REGENTRY(r12), - ST_REGENTRY(r13), - ST_REGENTRY(r14), - ST_REGENTRY(r15), - { -1, 0 }, - ST_REGENTRY(rflags), - ST_REGENTRY(cs), - ST_REGENTRY(ss), - }; - -#define X86_64_NUM_ST_COLLECT_GREGS \ - (sizeof (x86_64_st_collect_regmap) / sizeof (x86_64_st_collect_regmap[0])) - -/* GDB's RIP register number. */ -#define AMD64_RIP_REGNUM 16 - -void -supply_static_tracepoint_registers (struct regcache *regcache, - const unsigned char *buf, - CORE_ADDR pc) -{ - int i; - unsigned long newpc = pc; - - supply_register (regcache, AMD64_RIP_REGNUM, &newpc); - - for (i = 0; i < X86_64_NUM_ST_COLLECT_GREGS; i++) - if (x86_64_st_collect_regmap[i].offset != -1) - { - switch (x86_64_st_collect_regmap[i].size) - { - case 8: - supply_register (regcache, i, - ((char *) buf) - + x86_64_st_collect_regmap[i].offset); - break; - case 2: - { - unsigned long reg - = * (short *) (((char *) buf) - + x86_64_st_collect_regmap[i].offset); - reg &= 0xffff; - supply_register (regcache, i, ®); - } - break; - default: - internal_error ("unhandled register size: %d", - x86_64_st_collect_regmap[i].size); - break; - } - } -} - -#endif /* HAVE_UST */ - /* Return target_desc to use for IPA, given the tdesc index passed by gdbserver. */ diff --git a/gdbserver/linux-i386-ipa.cc b/gdbserver/linux-i386-ipa.cc index 2b363271ab6739948f414e945c6579e2d0b45789..6dadaafa22328acfd2cbb5f3d3cc14bb7956d6de 100644 --- a/gdbserver/linux-i386-ipa.cc +++ b/gdbserver/linux-i386-ipa.cc @@ -111,83 +111,6 @@ get_raw_reg (const unsigned char *raw_regs, int regnum) return *(int *) (raw_regs + i386_ft_collect_regmap[regnum]); } -#ifdef HAVE_UST - -#include - -/* "struct registers" is the UST object type holding the registers at - the time of the static tracepoint marker call. This doesn't - contain EIP, but we know what it must have been (the marker - address). */ - -#define ST_REGENTRY(REG) \ - { \ - offsetof (struct registers, REG), \ - sizeof (((struct registers *) NULL)->REG) \ - } - -static struct -{ - int offset; - int size; -} i386_st_collect_regmap[] = - { - ST_REGENTRY(eax), - ST_REGENTRY(ecx), - ST_REGENTRY(edx), - ST_REGENTRY(ebx), - ST_REGENTRY(esp), - ST_REGENTRY(ebp), - ST_REGENTRY(esi), - ST_REGENTRY(edi), - { -1, 0 }, /* eip */ - ST_REGENTRY(eflags), - ST_REGENTRY(cs), - ST_REGENTRY(ss), - }; - -#define i386_NUM_ST_COLLECT_GREGS \ - (sizeof (i386_st_collect_regmap) / sizeof (i386_st_collect_regmap[0])) - -void -supply_static_tracepoint_registers (struct regcache *regcache, - const unsigned char *buf, - CORE_ADDR pc) -{ - int i; - unsigned int newpc = pc; - - supply_register (regcache, I386_EIP_REGNUM, &newpc); - - for (i = 0; i < i386_NUM_ST_COLLECT_GREGS; i++) - if (i386_st_collect_regmap[i].offset != -1) - { - switch (i386_st_collect_regmap[i].size) - { - case 4: - supply_register (regcache, i, - ((char *) buf) - + i386_st_collect_regmap[i].offset); - break; - case 2: - { - unsigned long reg - = * (short *) (((char *) buf) - + i386_st_collect_regmap[i].offset); - reg &= 0xffff; - supply_register (regcache, i, ®); - } - break; - default: - internal_error ("unhandled register size: %d", - i386_st_collect_regmap[i].size); - } - } -} - -#endif /* HAVE_UST */ - - /* This is only needed because reg-i386-linux-lib.o references it. We may use it proper at some point. */ const char *gdbserver_xmltarget; diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index 81104b02c8321fcb4cb247a6166be10ba04aea8c..237290263e20de7e93e4dd41534c4883f2490a12 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -255,13 +255,7 @@ write_e_ipa_not_loaded (char *buffer) static void write_e_ust_not_loaded (char *buffer) { -#ifdef HAVE_UST - sprintf (buffer, - "E.UST library not loaded in process. " - "Static tracepoints unavailable."); -#else sprintf (buffer, "E.GDBserver was built without static tracepoints support"); -#endif } /* If the in-process agent library isn't loaded in the inferior, write @@ -1297,35 +1291,6 @@ struct fast_tracepoint_ctx struct tracepoint *tpoint; }; -/* Static tracepoint specific data to be passed down to - collect_data_at_tracepoint. */ -struct static_tracepoint_ctx -{ - struct tracepoint_hit_ctx base; - - /* The regcache corresponding to the registers state at the time of - the tracepoint hit. Initialized lazily, from REGS. */ - struct regcache regcache; - int regcache_initted; - - /* The buffer space REGCACHE above uses. We use a separate buffer - instead of letting the regcache malloc for both signal safety and - performance reasons; this is allocated on the stack instead. */ - unsigned char *regspace; - - /* The register buffer as passed on by lttng/ust. */ - struct registers *regs; - - /* The "printf" formatter and the args the user passed to the marker - call. We use this to be able to collect "static trace data" - ($_sdata). */ - const char *fmt; - va_list *args; - - /* The GDB tracepoint matching the probed marker that was "hit". */ - struct tracepoint *tpoint; -}; - #else /* Static tracepoint specific data to be passed down to @@ -4585,12 +4550,6 @@ tracepoint_was_hit (thread_info *tinfo, CORE_ADDR stop_pc) #endif -#if defined IN_PROCESS_AGENT && defined HAVE_UST -struct ust_marker_data; -static void collect_ust_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, - struct traceframe *tframe); -#endif - /* Create a trace frame for the hit of the given tracepoint in the given thread. */ @@ -4706,27 +4665,6 @@ get_context_regcache (struct tracepoint_hit_ctx *ctx) } regcache = &fctx->regcache; } -#ifdef HAVE_UST - if (ctx->type == static_tracepoint) - { - struct static_tracepoint_ctx *sctx - = (struct static_tracepoint_ctx *) ctx; - - if (!sctx->regcache_initted) - { - sctx->regcache_initted = 1; - init_register_cache (&sctx->regcache, ipa_tdesc, sctx->regspace); - supply_regblock (&sctx->regcache, NULL); - /* Pass down the tracepoint address, because REGS doesn't - include the PC, but we know what it must have been. */ - supply_static_tracepoint_registers (&sctx->regcache, - (const unsigned char *) - sctx->regs, - sctx->tpoint->address); - } - regcache = &sctx->regcache; - } -#endif #else if (ctx->type == trap_tracepoint) { @@ -4842,13 +4780,8 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx, break; case 'L': { -#if defined IN_PROCESS_AGENT && defined HAVE_UST - trace_debug ("Want to collect static trace data"); - collect_ust_data_at_tracepoint (ctx, tframe); -#else trace_debug ("warning: collecting static trace data, " "but static tracepoints are not supported"); -#endif } break; default: @@ -6542,253 +6475,6 @@ upload_fast_traceframes (void) IP_AGENT_EXPORT_VAR int ust_loaded; IP_AGENT_EXPORT_VAR char cmd_buf[IPA_CMD_BUF_SIZE]; -#ifdef HAVE_UST - -/* Static tracepoints. */ - -/* UST puts a "struct tracepoint" in the global namespace, which - conflicts with our tracepoint. Arguably, being a library, it - shouldn't take ownership of such a generic name. We work around it - here. */ -#define tracepoint ust_tracepoint -#include -#undef tracepoint - -extern int serialize_to_text (char *outbuf, int bufsize, - const char *fmt, va_list ap); - -#define GDB_PROBE_NAME "gdb" - -/* We dynamically search for the UST symbols instead of linking them - in. This lets the user decide if the application uses static - tracepoints, instead of always pulling libust.so in. This vector - holds pointers to all functions we care about. */ - -static struct -{ - int (*serialize_to_text) (char *outbuf, int bufsize, - const char *fmt, va_list ap); - - int (*ltt_probe_register) (struct ltt_available_probe *pdata); - int (*ltt_probe_unregister) (struct ltt_available_probe *pdata); - - int (*ltt_marker_connect) (const char *channel, const char *mname, - const char *pname); - int (*ltt_marker_disconnect) (const char *channel, const char *mname, - const char *pname); - - void (*marker_iter_start) (struct marker_iter *iter); - void (*marker_iter_next) (struct marker_iter *iter); - void (*marker_iter_stop) (struct marker_iter *iter); - void (*marker_iter_reset) (struct marker_iter *iter); -} ust_ops; - -#include - -/* Cast through typeof to catch incompatible API changes. Since UST - only builds with gcc, we can freely use gcc extensions here - too. */ -#define GET_UST_SYM(SYM) \ - do \ - { \ - if (ust_ops.SYM == NULL) \ - ust_ops.SYM = (typeof (&SYM)) dlsym (RTLD_DEFAULT, #SYM); \ - if (ust_ops.SYM == NULL) \ - return 0; \ - } while (0) - -#define USTF(SYM) ust_ops.SYM - -/* Get pointers to all libust.so functions we care about. */ - -static int -dlsym_ust (void) -{ - GET_UST_SYM (serialize_to_text); - - GET_UST_SYM (ltt_probe_register); - GET_UST_SYM (ltt_probe_unregister); - GET_UST_SYM (ltt_marker_connect); - GET_UST_SYM (ltt_marker_disconnect); - - GET_UST_SYM (marker_iter_start); - GET_UST_SYM (marker_iter_next); - GET_UST_SYM (marker_iter_stop); - GET_UST_SYM (marker_iter_reset); - - ust_loaded = 1; - return 1; -} - -/* Given an UST marker, return the matching gdb static tracepoint. - The match is done by address. */ - -static struct tracepoint * -ust_marker_to_static_tracepoint (const struct marker *mdata) -{ - struct tracepoint *tpoint; - - for (tpoint = tracepoints; tpoint; tpoint = tpoint->next) - { - if (tpoint->type != static_tracepoint) - continue; - - if (tpoint->address == (uintptr_t) mdata->location) - return tpoint; - } - - return NULL; -} - -/* The probe function we install on lttng/ust markers. Whenever a - probed ust marker is hit, this function is called. This is similar - to gdb_collect, only for static tracepoints, instead of fast - tracepoints. */ - -static void -gdb_probe (const struct marker *mdata, void *probe_private, - struct registers *regs, void *call_private, - const char *fmt, va_list *args) -{ - struct tracepoint *tpoint; - struct static_tracepoint_ctx ctx; - const struct target_desc *ipa_tdesc; - - /* Don't do anything until the trace run is completely set up. */ - if (!tracing) - { - trace_debug ("gdb_probe: not tracing\n"); - return; - } - - ipa_tdesc = get_ipa_tdesc (ipa_tdesc_idx); - ctx.base.type = static_tracepoint; - ctx.regcache_initted = 0; - ctx.regs = regs; - ctx.fmt = fmt; - ctx.args = args; - - /* Wrap the regblock in a register cache (in the stack, we don't - want to malloc here). */ - ctx.regspace = alloca (ipa_tdesc->registers_size); - if (ctx.regspace == NULL) - { - trace_debug ("Trace buffer block allocation failed, skipping"); - return; - } - - tpoint = ust_marker_to_static_tracepoint (mdata); - if (tpoint == NULL) - { - trace_debug ("gdb_probe: marker not known: " - "loc:0x%p, ch:\"%s\",n:\"%s\",f:\"%s\"", - mdata->location, mdata->channel, - mdata->name, mdata->format); - return; - } - - if (!tpoint->enabled) - { - trace_debug ("gdb_probe: tracepoint disabled"); - return; - } - - ctx.tpoint = tpoint; - - trace_debug ("gdb_probe: collecting marker: " - "loc:0x%p, ch:\"%s\",n:\"%s\",f:\"%s\"", - mdata->location, mdata->channel, - mdata->name, mdata->format); - - /* Test the condition if present, and collect if true. */ - if (tpoint->cond == NULL - || condition_true_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx, - tpoint)) - { - collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx, - tpoint->address, tpoint); - - if (stopping_tracepoint - || trace_buffer_is_full - || expr_eval_result != expr_eval_no_error) - stop_tracing (); - } - else - { - /* If there was a condition and it evaluated to false, the only - way we would stop tracing is if there was an error during - condition expression evaluation. */ - if (expr_eval_result != expr_eval_no_error) - stop_tracing (); - } -} - -/* Called if the gdb static tracepoint requested collecting "$_sdata", - static tracepoint string data. This is a string passed to the - tracing library by the user, at the time of the tracepoint marker - call. E.g., in the UST marker call: - - trace_mark (ust, bar33, "str %s", "FOOBAZ"); - - the collected data is "str FOOBAZ". -*/ - -static void -collect_ust_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, - struct traceframe *tframe) -{ - struct static_tracepoint_ctx *umd = (struct static_tracepoint_ctx *) ctx; - unsigned char *bufspace; - int size; - va_list copy; - unsigned short blocklen; - - if (umd == NULL) - { - trace_debug ("Wanted to collect static trace data, " - "but there's no static trace data"); - return; - } - - va_copy (copy, *umd->args); - size = USTF(serialize_to_text) (NULL, 0, umd->fmt, copy); - va_end (copy); - - trace_debug ("Want to collect ust data"); - - /* 'S' + size + string */ - bufspace = add_traceframe_block (tframe, umd->tpoint, - 1 + sizeof (blocklen) + size + 1); - if (bufspace == NULL) - { - trace_debug ("Trace buffer block allocation failed, skipping"); - return; - } - - /* Identify a static trace data block. */ - *bufspace = 'S'; - - blocklen = size + 1; - memcpy (bufspace + 1, &blocklen, sizeof (blocklen)); - - va_copy (copy, *umd->args); - USTF(serialize_to_text) ((char *) bufspace + 1 + sizeof (blocklen), - size + 1, umd->fmt, copy); - va_end (copy); - - trace_debug ("Storing static tracepoint data in regblock: %s", - bufspace + 1 + sizeof (blocklen)); -} - -/* The probe to register with lttng/ust. */ -static struct ltt_available_probe gdb_ust_probe = - { - GDB_PROBE_NAME, - NULL, - gdb_probe, - }; - -#endif /* HAVE_UST */ #endif /* IN_PROCESS_AGENT */ #ifndef IN_PROCESS_AGENT @@ -6917,229 +6603,6 @@ gdb_agent_socket_init (void) return fd; } -#ifdef HAVE_UST - -/* The next marker to be returned on a qTsSTM command. */ -static const struct marker *next_st; - -/* Returns the first known marker. */ - -struct marker * -first_marker (void) -{ - struct marker_iter iter; - - USTF(marker_iter_reset) (&iter); - USTF(marker_iter_start) (&iter); - - return iter.marker; -} - -/* Returns the marker following M. */ - -const struct marker * -next_marker (const struct marker *m) -{ - struct marker_iter iter; - - USTF(marker_iter_reset) (&iter); - USTF(marker_iter_start) (&iter); - - for (; iter.marker != NULL; USTF(marker_iter_next) (&iter)) - { - if (iter.marker == m) - { - USTF(marker_iter_next) (&iter); - return iter.marker; - } - } - - return NULL; -} - -/* Return an hexstr version of the STR C string, fit for sending to - GDB. */ - -static char * -cstr_to_hexstr (const char *str) -{ - int len = strlen (str); - char *hexstr = xmalloc (len * 2 + 1); - bin2hex ((gdb_byte *) str, hexstr, len); - return hexstr; -} - -/* Compose packet that is the response to the qTsSTM/qTfSTM/qTSTMat - packets. */ - -static void -response_ust_marker (char *packet, const struct marker *st) -{ - char *strid, *format, *tmp; - - next_st = next_marker (st); - - tmp = xmalloc (strlen (st->channel) + 1 + - strlen (st->name) + 1); - sprintf (tmp, "%s/%s", st->channel, st->name); - - strid = cstr_to_hexstr (tmp); - free (tmp); - - format = cstr_to_hexstr (st->format); - - sprintf (packet, "m%s:%s:%s", - paddress ((uintptr_t) st->location), - strid, - format); - - free (strid); - free (format); -} - -/* Return the first static tracepoint, and initialize the state - machine that will iterate through all the static tracepoints. */ - -static void -cmd_qtfstm (char *packet) -{ - trace_debug ("Returning first trace state variable definition"); - - if (first_marker ()) - response_ust_marker (packet, first_marker ()); - else - strcpy (packet, "l"); -} - -/* Return additional trace state variable definitions. */ - -static void -cmd_qtsstm (char *packet) -{ - trace_debug ("Returning static tracepoint"); - - if (next_st) - response_ust_marker (packet, next_st); - else - strcpy (packet, "l"); -} - -/* Disconnect the GDB probe from a marker at a given address. */ - -static void -unprobe_marker_at (char *packet) -{ - char *p = packet; - ULONGEST address; - struct marker_iter iter; - - p += sizeof ("unprobe_marker_at:") - 1; - - p = unpack_varlen_hex (p, &address); - - USTF(marker_iter_reset) (&iter); - USTF(marker_iter_start) (&iter); - for (; iter.marker != NULL; USTF(marker_iter_next) (&iter)) - if ((uintptr_t ) iter.marker->location == address) - { - int result; - - result = USTF(ltt_marker_disconnect) (iter.marker->channel, - iter.marker->name, - GDB_PROBE_NAME); - if (result < 0) - warning ("could not disable marker %s/%s", - iter.marker->channel, iter.marker->name); - break; - } -} - -/* Connect the GDB probe to a marker at a given address. */ - -static int -probe_marker_at (char *packet) -{ - char *p = packet; - ULONGEST address; - struct marker_iter iter; - struct marker *m; - - p += sizeof ("probe_marker_at:") - 1; - - p = unpack_varlen_hex (p, &address); - - USTF(marker_iter_reset) (&iter); - - for (USTF(marker_iter_start) (&iter), m = iter.marker; - m != NULL; - USTF(marker_iter_next) (&iter), m = iter.marker) - if ((uintptr_t ) m->location == address) - { - int result; - - trace_debug ("found marker for address. " - "ltt_marker_connect (marker = %s/%s)", - m->channel, m->name); - - result = USTF(ltt_marker_connect) (m->channel, m->name, - GDB_PROBE_NAME); - if (result && result != -EEXIST) - trace_debug ("ltt_marker_connect (marker = %s/%s, errno = %d)", - m->channel, m->name, -result); - - if (result < 0) - { - sprintf (packet, "E.could not connect marker: channel=%s, name=%s", - m->channel, m->name); - return -1; - } - - strcpy (packet, "OK"); - return 0; - } - - sprintf (packet, "E.no marker found at 0x%s", paddress (address)); - return -1; -} - -static int -cmd_qtstmat (char *packet) -{ - char *p = packet; - ULONGEST address; - struct marker_iter iter; - struct marker *m; - - p += sizeof ("qTSTMat:") - 1; - - p = unpack_varlen_hex (p, &address); - - USTF(marker_iter_reset) (&iter); - - for (USTF(marker_iter_start) (&iter), m = iter.marker; - m != NULL; - USTF(marker_iter_next) (&iter), m = iter.marker) - if ((uintptr_t ) m->location == address) - { - response_ust_marker (packet, m); - return 0; - } - - strcpy (packet, "l"); - return -1; -} - -static void -gdb_ust_init (void) -{ - if (!dlsym_ust ()) - return; - - USTF(ltt_probe_register) (&gdb_ust_probe); -} - -#endif /* HAVE_UST */ - #include static void @@ -7214,28 +6677,6 @@ gdb_agent_helper_thread (void *arg) { stop_loop = 1; } -#ifdef HAVE_UST - else if (strcmp ("qTfSTM", cmd_buf) == 0) - { - cmd_qtfstm (cmd_buf); - } - else if (strcmp ("qTsSTM", cmd_buf) == 0) - { - cmd_qtsstm (cmd_buf); - } - else if (startswith (cmd_buf, "unprobe_marker_at:")) - { - unprobe_marker_at (cmd_buf); - } - else if (startswith (cmd_buf, "probe_marker_at:")) - { - probe_marker_at (cmd_buf); - } - else if (startswith (cmd_buf, "qTSTMat:")) - { - cmd_qtstmat (cmd_buf); - } -#endif /* HAVE_UST */ } /* Fix compiler's warning: ignoring return value of 'write'. */ @@ -7295,10 +6736,6 @@ gdb_agent_init (void) while (helper_thread_id == 0) usleep (1); - -#ifdef HAVE_UST - gdb_ust_init (); -#endif } #include From patchwork Fri Jan 10 16:01:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 104491 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 546573857C47 for ; Fri, 10 Jan 2025 16:05:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 546573857C47 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=dnq59fun X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by sourceware.org (Postfix) with ESMTPS id A7CBC3858CD9 for ; Fri, 10 Jan 2025 16:02:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7CBC3858CD9 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A7CBC3858CD9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524943; cv=none; b=c94TLKb3Fi8YJdCiqKggnlXQWTiyJ9steQbO4auu0cHfuIfzinxQt1m+Yi+Vhuff8Q1Jwj72EhA19Gg1pOfVDGPHNA299K+uVQ/41IQqSKh8lN78OaDDwdn82X7rqo+qYCv97sdtyTafO2x5NY4UICe9aLqLswOZu9OJWXRanzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524943; c=relaxed/simple; bh=lcczXBXrfazew1zVbT7Jla6K89zJjltZN8huSiStTXg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=rRkvHF+ubnVxxg+y6uo5fPqO5H0LDr+09EMIIXIRnLztQQ0RgCh7YdIT4+jbtD0cdmLG0dygHInzNtYmUtFfFr/ohsBEC6TvGC3xpwNBI5EGtc2rVBpo7FfJT5jUswTFbo7X3BB7C4EiQ0hwNhpe7HwGWEOz7Ar5PHiLONR+/Cg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736524944; x=1768060944; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=lcczXBXrfazew1zVbT7Jla6K89zJjltZN8huSiStTXg=; b=dnq59funpQ47yrJXPkq5717vhQ9MPchL1yhNGcUXHPIEVlUMhg8nAyRt gWcBL52A1EACYPpKlC73PKGXFR2B3LgX+BfUIPsjonGljhL5h7VRw3DqM O5795Vdtleu7PZX7taIeaCQNQQ70s2JhumbXQcxS4DgR99KnPlb1KAglE L0q5hQcE9KXkr6sIfMNUdBts97L4y2tBuvKI6Dlo8Bhxn/R9GxIgG7Rk7 wzT2HVWZO4S2/OOsWLMhUMRoAP/o2dxFj10pZBuFFpZCwvdLs5s1ji3PM RZZ4Vk/AaOKo/ASc5MpdskcSbmRKP0PUzNeZ9uu1f/6ZPjZyjtIdNSV7+ w==; X-CSE-ConnectionGUID: UAcyXKjyRBC25w7l9cmpvQ== X-CSE-MsgGUID: q8QPbTvnQvOZFDuekojIBw== X-IronPort-AV: E=McAfee;i="6700,10204,11311"; a="36721919" X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="36721919" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:22 -0800 X-CSE-ConnectionGUID: +IIAbACeSv+b3QCfWa+swA== X-CSE-MsgGUID: kTQVMe6bSsKVSUK2Vyiu6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="104327837" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:22 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org, Simon Marchi Subject: [PATCH v2 5/8] gdbserver: remove UST (static tracepoint) support (part 2) Date: Fri, 10 Jan 2025 17:01:15 +0100 Message-Id: <20250110-upstream-gdbserver-remove-ust-v2-5-1ab116ffe592@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> References: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org With the removal of UST, the `in_process_agent_supports_ust` query would essentially always be false. Remove the function and adjust the uses, comments, and warning/error messages. --- gdbserver/tracepoint.cc | 119 +++++++----------------------------------------- 1 file changed, 17 insertions(+), 102 deletions(-) diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index 237290263e20de7e93e4dd41534c4883f2490a12..8b50330276346ea5d199c92fd4a5b16faea8e21b 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -125,7 +125,6 @@ trace_vdebug (const char *fmt, ...) IPA_SYM_EXPORTED_NAME (get_trace_state_variable_value_ptr) # define set_trace_state_variable_value_ptr \ IPA_SYM_EXPORTED_NAME (set_trace_state_variable_value_ptr) -# define ust_loaded IPA_SYM_EXPORTED_NAME (ust_loaded) # define helper_thread_id IPA_SYM_EXPORTED_NAME (helper_thread_id) # define cmd_buf IPA_SYM_EXPORTED_NAME (cmd_buf) # define ipa_tdesc_idx IPA_SYM_EXPORTED_NAME (ipa_tdesc_idx) @@ -165,7 +164,6 @@ struct ipa_sym_addresses CORE_ADDR addr_get_raw_reg_ptr; CORE_ADDR addr_get_trace_state_variable_value_ptr; CORE_ADDR addr_set_trace_state_variable_value_ptr; - CORE_ADDR addr_ust_loaded; CORE_ADDR addr_ipa_tdesc_idx; }; @@ -202,7 +200,6 @@ static struct IPA_SYM(get_raw_reg_ptr), IPA_SYM(get_trace_state_variable_value_ptr), IPA_SYM(set_trace_state_variable_value_ptr), - IPA_SYM(ust_loaded), IPA_SYM(ipa_tdesc_idx), }; @@ -210,52 +207,21 @@ static struct ipa_sym_addresses ipa_sym_addrs; static int read_inferior_integer (CORE_ADDR symaddr, int *val); -/* Returns true if both the in-process agent library and the static - tracepoints libraries are loaded in the inferior, and agent has - capability on static tracepoints. */ - -static int -in_process_agent_supports_ust (void) -{ - int loaded = 0; - - if (!agent_loaded_p ()) - { - warning ("In-process agent not loaded"); - return 0; - } - - if (agent_capability_check (AGENT_CAPA_STATIC_TRACE)) - { - /* Agent understands static tracepoint, then check whether UST is in - fact loaded in the inferior. */ - if (read_inferior_integer (ipa_sym_addrs.addr_ust_loaded, &loaded)) - { - warning ("Error reading ust_loaded in lib"); - return 0; - } - - return loaded; - } - else - return 0; -} - static void write_e_ipa_not_loaded (char *buffer) { sprintf (buffer, "E.In-process agent library not loaded in process. " - "Fast and static tracepoints unavailable."); + "Fast tracepoints unavailable."); } -/* Write an error to BUFFER indicating that UST isn't loaded in the - inferior. */ +/* Write an error to BUFFER indicating that static tracepoint support + does not exist. */ static void -write_e_ust_not_loaded (char *buffer) +write_e_static_tracepoints_not_supported (char *buffer) { - sprintf (buffer, "E.GDBserver was built without static tracepoints support"); + sprintf (buffer, "E.GDBserver does not have static tracepoints support"); } /* If the in-process agent library isn't loaded in the inferior, write @@ -272,26 +238,6 @@ maybe_write_ipa_not_loaded (char *buffer) return 0; } -/* If the in-process agent library and the ust (static tracepoints) - library aren't loaded in the inferior, write an error to BUFFER, - and return 1. Otherwise, return 0. */ - -static int -maybe_write_ipa_ust_not_loaded (char *buffer) -{ - if (!agent_loaded_p ()) - { - write_e_ipa_not_loaded (buffer); - return 1; - } - else if (!in_process_agent_supports_ust ()) - { - write_e_ust_not_loaded (buffer); - return 1; - } - return 0; -} - /* Cache all future symbols that the tracepoints module might request. We can not request symbols at arbitrary states in the remote protocol, only when the client tells us that new symbols are @@ -786,7 +732,7 @@ struct tracepoint char **step_actions_str; /* Handle returned by the breakpoint or tracepoint module when we - inserted the trap or jump, or hooked into a static tracepoint. + inserted the trap or jump. NULL if we haven't inserted it yet. */ void *handle; #endif @@ -2567,7 +2513,7 @@ cmd_qtdp (char *own_buf) if (tpoint->type != trap_tracepoint) { - /* Find another fast or static tracepoint at the same address. */ + /* Find another fast tracepoint at the same address. */ for (tp = tracepoints; tp; tp = tp->next) { if (tp->address == tpoint->address && tp->type == tpoint->type @@ -3110,12 +3056,11 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf) write_e_ipa_not_loaded (own_buf); return; } - if (tpoint->type == static_tracepoint - && !in_process_agent_supports_ust ()) + if (tpoint->type == static_tracepoint) { trace_debug ("Requested a static tracepoint, but static " "tracepoints are not supported."); - write_e_ust_not_loaded (own_buf); + write_e_static_tracepoints_not_supported (own_buf); return; } @@ -3145,7 +3090,7 @@ static void download_tracepoint_1 (struct tracepoint *tpoint); static void cmd_qtstart (char *packet) { - struct tracepoint *tpoint, *prev_ftpoint, *prev_stpoint; + struct tracepoint *tpoint, *prev_ftpoint; CORE_ADDR tpptr = 0, prev_tpptr = 0; trace_debug ("Starting the trace"); @@ -3169,9 +3114,6 @@ cmd_qtstart (char *packet) /* No previous fast tpoint yet. */ prev_ftpoint = NULL; - /* No previous static tpoint yet. */ - prev_stpoint = NULL; - *packet = '\0'; if (agent_loaded_p ()) @@ -3249,29 +3191,9 @@ cmd_qtstart (char *packet) } else { - if (!in_process_agent_supports_ust ()) - { - trace_debug ("Requested a static tracepoint, but static " - "tracepoints are not supported."); - break; - } - - download_tracepoint_1 (tpoint); - /* Can only probe a given marker once. */ - if (prev_stpoint != NULL - && prev_stpoint->address == tpoint->address) - tpoint->handle = (void *) -1; - else - { - if (probe_marker_at (tpoint->address, packet) == 0) - { - tpoint->handle = (void *) -1; - - /* So that we can handle multiple static tracepoints - at the same address easily. */ - prev_stpoint = tpoint; - } - } + trace_debug ("Requested a static tracepoint, but static " + "tracepoints are not supported."); + break; } prev_tpptr = tpptr; @@ -3876,8 +3798,7 @@ cmd_qtsv (char *packet) static void cmd_qtfstm (char *packet) { - if (!maybe_write_ipa_ust_not_loaded (packet)) - run_inferior_command (packet, strlen (packet) + 1); + write_e_static_tracepoints_not_supported (packet); } /* Return additional static tracepoints markers. */ @@ -3885,8 +3806,7 @@ cmd_qtfstm (char *packet) static void cmd_qtsstm (char *packet) { - if (!maybe_write_ipa_ust_not_loaded (packet)) - run_inferior_command (packet, strlen (packet) + 1); + write_e_static_tracepoints_not_supported (packet); } /* Return the definition of the static tracepoint at a given address. @@ -3895,8 +3815,7 @@ cmd_qtsstm (char *packet) static void cmd_qtstmat (char *packet) { - if (!maybe_write_ipa_ust_not_loaded (packet)) - run_inferior_command (packet, strlen (packet) + 1); + write_e_static_tracepoints_not_supported (packet); } /* Sent the agent a command to close it. */ @@ -4508,10 +4427,7 @@ tracepoint_was_hit (thread_info *tinfo, CORE_ADDR stop_pc) { /* Note that we collect fast tracepoints here as well. We'll step over the fast tracepoint jump later, which avoids the - double collect. However, we don't collect for static - tracepoints here, because UST markers are compiled in program, - and probes will be executed in program. So static tracepoints - are collected there. */ + double collect. */ if (tpoint->enabled && stop_pc == tpoint->address && tpoint->type != static_tracepoint) { @@ -6472,7 +6388,6 @@ upload_fast_traceframes (void) #ifdef IN_PROCESS_AGENT -IP_AGENT_EXPORT_VAR int ust_loaded; IP_AGENT_EXPORT_VAR char cmd_buf[IPA_CMD_BUF_SIZE]; #endif /* IN_PROCESS_AGENT */ From patchwork Fri Jan 10 16:01:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 104486 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B35E3857709 for ; Fri, 10 Jan 2025 16:03:04 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by sourceware.org (Postfix) with ESMTPS id 53E12385782C for ; Fri, 10 Jan 2025 16:02:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 53E12385782C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 53E12385782C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524947; cv=none; b=LKM4adq0qirXBLV+JTvs03mM1L/iA04icuhrNCyCe4i8yxn3/ydm4qCTVSoVUvWuWHxUM4846Mn/BM3/r2QP7RgxWFCIvJ1Aht7mq7HLlx1WEiVEpZ7tGGVKumTQRG+sgj9YCjnKVCOFEEIJGfAs64FCJM2qO+Noky3+MZHCQgc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524947; c=relaxed/simple; bh=aqMT7PZwjv0M3DcCAGEZN6Nz0Vx4iV18Qgge10uZpxE=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=K1nWr80qXZl9s971fbTPsF45RipB3pJTw/K6R5WqGBftuTmr50z1CORHeXemekLjCE0XWbhfppE8YSwmwhR8ZQxmHEuLtuJO6OpSMJtcTUN4VHE1QqN3MSMuim9zybOPQCapADZc3iVDtVGbnUV+p14TEGN3Plr/7o5TM5Gal88= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736524947; x=1768060947; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=aqMT7PZwjv0M3DcCAGEZN6Nz0Vx4iV18Qgge10uZpxE=; b=GDsHxbvi3tNe5XirqtlZ+la2ikVgn5Q+LL/NURCEcCyfvZ6vuIxdtIIq mYnAcZoC52PBzlUr2BWiL8OPZs2QjD6KznzIkT7Rh9qKDRcL3G9p1u1AK IvIisimwmWwYQ6nEE5cmoE1LoyT+i3YTEzb8SiyZ5II9/ril5QWjOXUIS RXr8ekrLK/iljL3PIG9g82RZpwdvaIaY5edZHAwBqhKHpXY4QBRWCH+sl WUIleJ3U3y5fK35nOFMolZP7CQwiJEGHU/UxaGubfKLDlYnOsPmtwZcFw +RBH7mMAac5mYQqv66SeV7WqK4QY5mDgUFjlHndF7isWdxGF2NalJlWxo w==; X-CSE-ConnectionGUID: WOAUCTV6RMyYNvcly6eSZw== X-CSE-MsgGUID: SfSV+sP/T/aU2F7M7l7Q1g== X-IronPort-AV: E=McAfee;i="6700,10204,11311"; a="36721926" X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="36721926" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:26 -0800 X-CSE-ConnectionGUID: vm3aPhdkRnyi9aenL4tu4g== X-CSE-MsgGUID: pw/kbEJcQY2UqPmxRJcb+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="104327882" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:26 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org, Simon Marchi Subject: [PATCH v2 6/8] gdbserver: do not announce static tracepoint support Date: Fri, 10 Jan 2025 17:01:16 +0100 Message-Id: <20250110-upstream-gdbserver-remove-ust-v2-6-1ab116ffe592@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> References: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Remove the announcement that qXfer:statictrace:read is supported. Associated to this, remove the handling of "qTfSTM", "qTsSTM", and "qTSTMat" packets. --- gdbserver/server.cc | 26 -------------- gdbserver/tracepoint.cc | 95 ------------------------------------------------- gdbserver/tracepoint.h | 4 --- 3 files changed, 125 deletions(-) diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 55898f59556b2d16bebe319e48321cdfb0cc9f89..bc591599b0299fe5257e0ca779b6ad1a46703b34 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -1965,29 +1965,6 @@ handle_qxfer_siginfo (const char *annex, return the_target->qxfer_siginfo (annex, readbuf, writebuf, offset, len); } -/* Handle qXfer:statictrace:read. */ - -static int -handle_qxfer_statictrace (const char *annex, - gdb_byte *readbuf, const gdb_byte *writebuf, - ULONGEST offset, LONGEST len) -{ - client_state &cs = get_client_state (); - ULONGEST nbytes; - - if (writebuf != NULL) - return -2; - - if (annex[0] != '\0' || current_thread == NULL - || cs.current_traceframe == -1) - return -1; - - if (traceframe_read_sdata (cs.current_traceframe, offset, - readbuf, len, &nbytes)) - return -1; - return nbytes; -} - /* Helper for handle_qxfer_threads_proper. Emit the XML to describe the thread of INF. */ @@ -2324,7 +2301,6 @@ static const struct qxfer qxfer_packets[] = { "libraries-svr4", handle_qxfer_libraries_svr4 }, { "osdata", handle_qxfer_osdata }, { "siginfo", handle_qxfer_siginfo }, - { "statictrace", handle_qxfer_statictrace }, { "threads", handle_qxfer_threads }, { "traceframe-info", handle_qxfer_traceframe_info }, }; @@ -2842,9 +2818,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) strcat (own_buf, ";DisconnectedTracing+"); if (gdb_supports_qRelocInsn && target_supports_fast_tracepoints ()) strcat (own_buf, ";FastTracepoints+"); - strcat (own_buf, ";StaticTracepoints+"); strcat (own_buf, ";InstallInTrace+"); - strcat (own_buf, ";qXfer:statictrace:read+"); strcat (own_buf, ";qXfer:traceframe-info:read+"); strcat (own_buf, ";EnableDisableTracepoints+"); strcat (own_buf, ";QTBuffer:size+"); diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index 8b50330276346ea5d199c92fd4a5b16faea8e21b..46fff32662213e5b3bb0efb5479a873ca8a32957 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -3791,33 +3791,6 @@ cmd_qtsv (char *packet) strcpy (packet, "l"); } -/* Return the first static tracepoint marker, and initialize the state - machine that will iterate through all the static tracepoints - markers. */ - -static void -cmd_qtfstm (char *packet) -{ - write_e_static_tracepoints_not_supported (packet); -} - -/* Return additional static tracepoints markers. */ - -static void -cmd_qtsstm (char *packet) -{ - write_e_static_tracepoints_not_supported (packet); -} - -/* Return the definition of the static tracepoint at a given address. - Result packet is the same as qTsST's. */ - -static void -cmd_qtstmat (char *packet) -{ - write_e_static_tracepoints_not_supported (packet); -} - /* Sent the agent a command to close it. */ void @@ -4133,21 +4106,6 @@ handle_tracepoint_query (char *packet) cmd_qtbuffer (packet); return 1; } - else if (strcmp ("qTfSTM", packet) == 0) - { - cmd_qtfstm (packet); - return 1; - } - else if (strcmp ("qTsSTM", packet) == 0) - { - cmd_qtsstm (packet); - return 1; - } - else if (startswith (packet, "qTSTMat:")) - { - cmd_qtstmat (packet); - return 1; - } else if (strcmp ("qTMinFTPILen", packet) == 0) { cmd_qtminftpilen (packet); @@ -5176,59 +5134,6 @@ traceframe_read_tsv (int tsvnum, LONGEST *val) return !found; } -/* Read a requested block of static tracepoint data from a trace - frame. */ - -int -traceframe_read_sdata (int tfnum, ULONGEST offset, - unsigned char *buf, ULONGEST length, - ULONGEST *nbytes) -{ - struct traceframe *tframe; - unsigned char *database, *dataptr; - unsigned int datasize; - unsigned short mlen; - - trace_debug ("traceframe_read_sdata"); - - tframe = find_traceframe (tfnum); - - if (!tframe) - { - trace_debug ("traceframe %d not found", tfnum); - return 1; - } - - datasize = tframe->data_size; - database = &tframe->data[0]; - - /* Iterate through a traceframe's blocks, looking for static - tracepoint data. */ - dataptr = traceframe_find_block_type (database, datasize, - tfnum, 'S'); - if (dataptr != NULL) - { - memcpy (&mlen, dataptr, sizeof (mlen)); - dataptr += sizeof (mlen); - if (offset < mlen) - { - if (offset + length > mlen) - length = mlen - offset; - - memcpy (buf, dataptr, length); - *nbytes = length; - } - else - *nbytes = 0; - return 0; - } - - trace_debug ("traceframe %d has no static trace data", tfnum); - - *nbytes = 0; - return 0; -} - /* Callback for traceframe_walk_blocks. Builds a traceframe-info object. DATA is pointer to a string holding the traceframe-info object being built. */ diff --git a/gdbserver/tracepoint.h b/gdbserver/tracepoint.h index e74458abbf70891c3614082205bb5b8708707965..b2e410f1df8201bac83132721106469d2eade139 100644 --- a/gdbserver/tracepoint.h +++ b/gdbserver/tracepoint.h @@ -87,10 +87,6 @@ int fetch_traceframe_registers (int tfnum, struct regcache *regcache, int regnum); -int traceframe_read_sdata (int tfnum, ULONGEST offset, - unsigned char *buf, ULONGEST length, - ULONGEST *nbytes); - int traceframe_read_info (int tfnum, std::string *buffer); /* If a thread is determined to be collecting a fast tracepoint, this From patchwork Fri Jan 10 16:01:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 104490 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3598F3857C6D for ; Fri, 10 Jan 2025 16:05:33 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by sourceware.org (Postfix) with ESMTPS id A7F6F3858427 for ; Fri, 10 Jan 2025 16:02:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7F6F3858427 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A7F6F3858427 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524952; cv=none; b=XAhP7U03HGmWyyHncb+DXAGcswSDNA4slYmGnyQscAntypZK5KySd6jpvBxUwQzwWCXeIJqvNEBvcXXUMtCP2U1TGJW/VO+vzhGiHvO7UqqSaEv4Y+Gq708S09A4hcXePbIXGmQkxrVZPOkuJJKJr//PHKnk/kY+RgiEoF8/0xM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524952; c=relaxed/simple; bh=+vvDj06NY49W4ErdrEzt4W490QcL7AMIMk9A3EoqL6w=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=i0GXDEoOqWoRHxVU9binfTMFeOodTQ5MKY0AqCdVowURdXqf8kHHTu5t86lOYZOkAKYOonYuuvrm7TGg/n+OITc3pcHtNCixEw1epmDwA+0pbQVlXdJe6wtaOYQnYYHg6ASB/Hy3zlxB43l3txRf9Q1jQkTVCdstRkEnSEjV8js= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736524952; x=1768060952; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=+vvDj06NY49W4ErdrEzt4W490QcL7AMIMk9A3EoqL6w=; b=YX2x7jmaUZWp4lqBqg2RnWgXi5NI/+HdNtP9JqJzU3qQmY5IxunvYetm DC/oPJTWtlYz++MTR6FyznuOPc+ZbsIVhr9OzY3sSweQfF93blAggr4Vv Yf1FxoxdHFa2p5KKEhBj4FWZQh8GWjwIrnP/SNiGseCTrDsa814mgsGrt w4WtouWFcyyDIBmw6mIBVGmJ6w7bNkBuBb3LRZs6ejeVs12+tZuJYMDpF AKoBzdneUk8qeaW81KRRy5iLyYM3cWgRSNLEnu8hnIZBlPg1cW5fthFF+ YYN8fyN8hkNMfxw7My1AspZ3zj4FCH4eIgtEcu2gWATARhk/Nr+jXdExY g==; X-CSE-ConnectionGUID: K+WlsyunQBOuQ0Gal9qLeA== X-CSE-MsgGUID: 1aEL2P8OQRO4qURjM9zSjA== X-IronPort-AV: E=McAfee;i="6700,10204,11311"; a="36721931" X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="36721931" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:31 -0800 X-CSE-ConnectionGUID: 010JRJpITiKPzSl80RFttg== X-CSE-MsgGUID: U+pRv+zbT3y1SsW2T12zDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="104327914" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:30 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org, Simon Marchi Subject: [PATCH v2 7/8] gdbserver: remove the static_tracepoint enum value Date: Fri, 10 Jan 2025 17:01:17 +0100 Message-Id: <20250110-upstream-gdbserver-remove-ust-v2-7-1ab116ffe592@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> References: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org As a continuation of the previous patches that remove UST from gdbserver, remove the `static_tracepoint` enum value from `tracepoint_type` and all the associated code. Now that the last use of `write_e_static_tracepoints_not_supported` is gone, also remove that function. This patch is easier to view with "git show -w". --- gdbserver/tracepoint.cc | 180 +++++++++++------------------------------------- 1 file changed, 40 insertions(+), 140 deletions(-) diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index 46fff32662213e5b3bb0efb5479a873ca8a32957..bbce1f939920bcf4769761029d88a76a69f638d6 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -215,15 +215,6 @@ write_e_ipa_not_loaded (char *buffer) "Fast tracepoints unavailable."); } -/* Write an error to BUFFER indicating that static tracepoint support - does not exist. */ - -static void -write_e_static_tracepoints_not_supported (char *buffer) -{ - sprintf (buffer, "E.GDBserver does not have static tracepoints support"); -} - /* If the in-process agent library isn't loaded in the inferior, write an error to BUFFER, and return 1. Otherwise, return 0. */ @@ -621,10 +612,6 @@ enum tracepoint_type /* A fast tracepoint implemented with a jump instead of a trap. */ fast_tracepoint, - - /* A static tracepoint, implemented by a program call into a tracing - library. */ - static_tracepoint }; struct tracepoint_hit_ctx; @@ -2311,17 +2298,6 @@ cmd_qtinit (char *packet) write_ok (packet); } -/* Unprobe the UST marker at ADDRESS. */ - -static void -unprobe_marker_at (CORE_ADDR address) -{ - char cmd[IPA_CMD_BUF_SIZE]; - - sprintf (cmd, "unprobe_marker_at:%s", paddress (address)); - run_inferior_command (cmd, strlen (cmd) + 1); -} - /* Restore the program to its pre-tracing state. This routine may be called in error situations, so it needs to be careful about only restoring from known-valid bits. */ @@ -2330,12 +2306,9 @@ static void clear_installed_tracepoints (void) { struct tracepoint *tpoint; - struct tracepoint *prev_stpoint; target_pause_all (true); - prev_stpoint = NULL; - /* Restore any bytes overwritten by tracepoints. */ for (tpoint = tracepoints; tpoint; tpoint = tpoint->next) { @@ -2367,19 +2340,6 @@ clear_installed_tracepoints (void) delete_fast_tracepoint_jump (jump); } break; - case static_tracepoint: - if (prev_stpoint != NULL - && prev_stpoint->address == tpoint->address) - /* Nothing to do. We already unprobed a tracepoint set at - this marker address (and there can only be one probe - per marker). */ - ; - else - { - unprobe_marker_at (tpoint->address); - prev_stpoint = tpoint; - } - break; } tpoint->handle = NULL; @@ -2455,8 +2415,10 @@ cmd_qtdp (char *own_buf) } else if (*packet == 'S') { - tpoint->type = static_tracepoint; - ++packet; + trace_debug ("Tracepoint error: static tracepoints" + " not supported"); + write_enn (own_buf); + return; } else if (*packet == 'X') { @@ -2477,8 +2439,7 @@ cmd_qtdp (char *own_buf) trace_debug ("Defined %stracepoint %d at 0x%s, " "enabled %d step %" PRIu64 " pass %" PRIu64, - tpoint->type == fast_tracepoint ? "fast " - : tpoint->type == static_tracepoint ? "static " : "", + tpoint->type == fast_tracepoint ? "fast " : "", tpoint->number, paddress (tpoint->address), tpoint->enabled, tpoint->step_count, tpoint->pass_count); } @@ -2526,8 +2487,6 @@ cmd_qtdp (char *own_buf) { if (tpoint->type == fast_tracepoint) clone_fast_tracepoint (tpoint, tp); - else if (tpoint->type == static_tracepoint) - tpoint->handle = (void *) -1; } } @@ -2689,7 +2648,7 @@ cmd_qtenable_disable (char *own_buf, int enable) tp->enabled = enable; - if (tp->type == fast_tracepoint || tp->type == static_tracepoint) + if (tp->type == fast_tracepoint) { int offset = offsetof (struct tracepoint, enabled); CORE_ADDR obj_addr = tp->obj_addr_on_target + offset; @@ -2920,33 +2879,6 @@ have_fast_tracepoint_trampoline_buffer (char *buf) return trampoline_end != 0; } -/* Ask the IPA to probe the marker at ADDRESS. Returns -1 if running - the command fails, or 0 otherwise. If the command ran - successfully, but probing the marker failed, ERROUT will be filled - with the error to reply to GDB, and -1 is also returned. This - allows directly passing IPA errors to GDB. */ - -static int -probe_marker_at (CORE_ADDR address, char *errout) -{ - char cmd[IPA_CMD_BUF_SIZE]; - int err; - - sprintf (cmd, "probe_marker_at:%s", paddress (address)); - err = run_inferior_command (cmd, strlen (cmd) + 1); - - if (err == 0) - { - if (*cmd == 'E') - { - strcpy (errout, cmd); - return -1; - } - } - - return err; -} - static void clone_fast_tracepoint (struct tracepoint *to, const struct tracepoint *from) { @@ -3046,32 +2978,17 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf) tpoint->handle = set_breakpoint_at (tpoint->address, tracepoint_handler); } - else if (tpoint->type == fast_tracepoint || tpoint->type == static_tracepoint) + else if (tpoint->type == fast_tracepoint) { if (!agent_loaded_p ()) { - trace_debug ("Requested a %s tracepoint, but fast " - "tracepoints aren't supported.", - tpoint->type == static_tracepoint ? "static" : "fast"); + trace_debug ("Requested a fast tracepoint, but fast " + "tracepoints aren't supported."); write_e_ipa_not_loaded (own_buf); return; } - if (tpoint->type == static_tracepoint) - { - trace_debug ("Requested a static tracepoint, but static " - "tracepoints are not supported."); - write_e_static_tracepoints_not_supported (own_buf); - return; - } - - if (tpoint->type == fast_tracepoint) - install_fast_tracepoint (tpoint, own_buf); - else - { - if (probe_marker_at (tpoint->address, own_buf) == 0) - tpoint->handle = (void *) -1; - } + install_fast_tracepoint (tpoint, own_buf); } else internal_error ("Unknown tracepoint type"); @@ -3144,56 +3061,44 @@ cmd_qtstart (char *packet) tpoint->handle = set_breakpoint_at (tpoint->address, tracepoint_handler); } - else if (tpoint->type == fast_tracepoint - || tpoint->type == static_tracepoint) + else if (tpoint->type == fast_tracepoint) { if (maybe_write_ipa_not_loaded (packet)) { - trace_debug ("Requested a %s tracepoint, but fast " - "tracepoints aren't supported.", - tpoint->type == static_tracepoint - ? "static" : "fast"); + trace_debug ("Requested a fast tracepoint, but fast " + "tracepoints aren't supported."); break; } - if (tpoint->type == fast_tracepoint) + int use_agent_p + = use_agent && agent_capability_check (AGENT_CAPA_FAST_TRACE); + + if (prev_ftpoint != NULL + && prev_ftpoint->address == tpoint->address) { - int use_agent_p - = use_agent && agent_capability_check (AGENT_CAPA_FAST_TRACE); + if (use_agent_p) + tracepoint_send_agent (tpoint); + else + download_tracepoint_1 (tpoint); - if (prev_ftpoint != NULL - && prev_ftpoint->address == tpoint->address) - { - if (use_agent_p) - tracepoint_send_agent (tpoint); - else - download_tracepoint_1 (tpoint); + clone_fast_tracepoint (tpoint, prev_ftpoint); + } + else + { + /* Tracepoint is installed successfully? */ + int installed = 0; - clone_fast_tracepoint (tpoint, prev_ftpoint); - } + /* Download and install fast tracepoint by agent. */ + if (use_agent_p) + installed = !tracepoint_send_agent (tpoint); else { - /* Tracepoint is installed successfully? */ - int installed = 0; - - /* Download and install fast tracepoint by agent. */ - if (use_agent_p) - installed = !tracepoint_send_agent (tpoint); - else - { - download_tracepoint_1 (tpoint); - installed = !install_fast_tracepoint (tpoint, packet); - } - - if (installed) - prev_ftpoint = tpoint; + download_tracepoint_1 (tpoint); + installed = !install_fast_tracepoint (tpoint, packet); } - } - else - { - trace_debug ("Requested a static tracepoint, but static " - "tracepoints are not supported."); - break; + + if (installed) + prev_ftpoint = tpoint; } prev_tpptr = tpptr; @@ -3621,8 +3526,6 @@ response_tracepoint (char *packet, struct tracepoint *tpoint) tpoint->pass_count); if (tpoint->type == fast_tracepoint) sprintf (packet + strlen (packet), ":F%x", tpoint->orig_size); - else if (tpoint->type == static_tracepoint) - sprintf (packet + strlen (packet), ":S"); if (tpoint->cond) { @@ -4386,8 +4289,7 @@ tracepoint_was_hit (thread_info *tinfo, CORE_ADDR stop_pc) /* Note that we collect fast tracepoints here as well. We'll step over the fast tracepoint jump later, which avoids the double collect. */ - if (tpoint->enabled && stop_pc == tpoint->address - && tpoint->type != static_tracepoint) + if (tpoint->enabled && stop_pc == tpoint->address) { trace_debug ("Thread %s at address of tracepoint %d at 0x%s", target_pid_to_str (tinfo->id).c_str (), @@ -5753,8 +5655,7 @@ download_tracepoint_1 (struct tracepoint *tpoint) struct tracepoint target_tracepoint; CORE_ADDR tpptr = 0; - gdb_assert (tpoint->type == fast_tracepoint - || tpoint->type == static_tracepoint); + gdb_assert (tpoint->type == fast_tracepoint); if (tpoint->cond != NULL && target_emit_ops () != NULL) { @@ -5914,8 +5815,7 @@ download_tracepoint (struct tracepoint *tpoint) { struct tracepoint *tp, *tp_prev; - if (tpoint->type != fast_tracepoint - && tpoint->type != static_tracepoint) + if (tpoint->type != fast_tracepoint) return; download_tracepoint_1 (tpoint); @@ -5925,7 +5825,7 @@ download_tracepoint (struct tracepoint *tpoint) tp_prev = NULL; for (tp = tracepoints; tp != tpoint; tp = tp->next) { - if (tp->type == fast_tracepoint || tp->type == static_tracepoint) + if (tp->type == fast_tracepoint) tp_prev = tp; } From patchwork Fri Jan 10 16:01:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aktemur, Tankut Baris" X-Patchwork-Id: 104492 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 691AB3858023 for ; Fri, 10 Jan 2025 16:06:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 691AB3858023 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=T2fntgbZ X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by sourceware.org (Postfix) with ESMTPS id C0D293858C35 for ; Fri, 10 Jan 2025 16:02:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C0D293858C35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C0D293858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.17 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524956; cv=none; b=hmPc1NtQpBFjTmWjsiTlxYMGI+qowY5h6NV5zbLNfWgkLwVBD8IIdLDZs7X6mDO7zZH13CHrHXDY8zkubi8gPndwoAj18zoc3d18Mw/YC2tlokDa7B4c5xCFeVgfF/dZP/70ygSOGI+ro8/TTlRCbu1JFADN8CyBge9keJn+eco= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736524956; c=relaxed/simple; bh=g363s6UM67I2z81nZqoWH1X1iRTn9O7F3u26jNUfHtw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=qB96p5hUvPicukDvqQJde82UBWdTMph6iEe8wTjtHT1U4HeKAk7fgDhA20ycGXgW29KuVD8iCGEURTLKyS3Cp/w52J+xE/trDbCs+9McRdnn4DxgcoSZsIWcJqugAaUwcVWxsJuv0z7yKptOKZ5SRl4A2+vbe55kdohas7ar5kk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736524956; x=1768060956; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=g363s6UM67I2z81nZqoWH1X1iRTn9O7F3u26jNUfHtw=; b=T2fntgbZY+qNCSzLXDcMNpD5B4J8kxRPJ2BTEtKfePdnu3+gk3oj69KJ 0hee3Y7Nho17NhTFRVV3yJrs77dDXpqqJCnNm06y6S3+c4uDfWJ/Q4jKC puAVh93lIJqLvKJaB6EmTQGq0mRtZ8Kk32qhRPf10k/nV+5wjldJvPhif fJw8yHn5C0z9yn775ZSqPZFjZRge1ZlKTHoJGFkymHaqy9giaQ1BzV4D3 +viQUtQj+XrHctdopeNsM5qUJr5j2OzawJmOF7pbF9YJUNxLyDzDx92Jr viWv9nL9cLnigXHhxTEuz97VQtjJ1jAlf7ZwPjcifkUTBVPh/b37S97sD A==; X-CSE-ConnectionGUID: ojuzypsBQ+KiC4D6VLxpfg== X-CSE-MsgGUID: t0P2c9pRRoaxiGKcww4Y8w== X-IronPort-AV: E=McAfee;i="6700,10204,11311"; a="36721938" X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="36721938" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:35 -0800 X-CSE-ConnectionGUID: wx0YP3D0QqW7yFfb28YoHg== X-CSE-MsgGUID: vAzpCnr7Q7aDbHS2g4rOaQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,303,1728975600"; d="scan'208";a="104327935" Received: from gkldtt-dev-004.igk.intel.com (HELO localhost) ([10.123.221.202]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2025 08:02:35 -0800 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org, Simon Marchi Subject: [PATCH v2 8/8] gdbserver: remove handling of the 'L' tracepoint action Date: Fri, 10 Jan 2025 17:01:18 +0100 Message-Id: <20250110-upstream-gdbserver-remove-ust-v2-8-1ab116ffe592@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> References: <20250110-upstream-gdbserver-remove-ust-v2-0-1ab116ffe592@intel.com> MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Now that static tracepoint support is removed from gdbserver, it makes sense to remove handling of the 'L' tracepoint action, too. The code that checks received actions already has a default case that tolerates unrecognized actions: default: trace_debug ("unknown trace action '%c', ignoring...", *act); In case 'L' is unexpectedly received, we would at least be able to see this in the logs. --- gdbserver/tracepoint.cc | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc index bbce1f939920bcf4769761029d88a76a69f638d6..2203b6242a7ec5bf3a627f382a7793e8fdebd15b 100644 --- a/gdbserver/tracepoint.cc +++ b/gdbserver/tracepoint.cc @@ -435,12 +435,6 @@ struct eval_expr_action struct agent_expr *expr; }; -/* An 'L' (collect static trace data) action. */ -struct collect_static_trace_data_action -{ - struct tracepoint_action base; -}; - #ifndef IN_PROCESS_AGENT static CORE_ADDR m_tracepoint_action_download (const struct tracepoint_action *action) @@ -532,24 +526,6 @@ x_tracepoint_action_send ( char *buffer, const struct tracepoint_action *action) return agent_expr_send (buffer, eaction->expr); } -static CORE_ADDR -l_tracepoint_action_download (const struct tracepoint_action *action) -{ - CORE_ADDR ipa_action - = target_malloc (sizeof (struct collect_static_trace_data_action)); - - target_write_memory (ipa_action, (unsigned char *) action, - sizeof (struct collect_static_trace_data_action)); - - return ipa_action; -} - -static char * -l_tracepoint_action_send (char *buffer, const struct tracepoint_action *action) -{ - return buffer; -} - static char * tracepoint_action_send (char *buffer, const struct tracepoint_action *action) { @@ -561,8 +537,6 @@ tracepoint_action_send (char *buffer, const struct tracepoint_action *action) return r_tracepoint_action_send (buffer, action); case 'X': return x_tracepoint_action_send (buffer, action); - case 'L': - return l_tracepoint_action_send (buffer, action); } error ("Unknown trace action '%c'.", action->type); } @@ -578,8 +552,6 @@ tracepoint_action_download (const struct tracepoint_action *action) return r_tracepoint_action_download (action); case 'X': return x_tracepoint_action_download (action); - case 'L': - return l_tracepoint_action_download (action); } error ("Unknown trace action '%c'.", action->type); } @@ -1863,18 +1835,6 @@ add_tracepoint_action (struct tracepoint *tpoint, const char *packet) ++act; break; } - case 'L': - { - struct collect_static_trace_data_action *raction = - XNEW (struct collect_static_trace_data_action); - - raction->base.type = *act; - action = &raction->base; - - trace_debug ("Want to collect static trace data"); - ++act; - break; - } case 'S': trace_debug ("Unexpected step action, ignoring"); ++act; @@ -4554,12 +4514,6 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx, } } break; - case 'L': - { - trace_debug ("warning: collecting static trace data, " - "but static tracepoints are not supported"); - } - break; default: trace_debug ("unknown trace action '%c', ignoring", taction->type); break;