From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by sourceware.org (Postfix) with ESMTPS id 777723857722 for ; Tue, 14 Nov 2023 09:20:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 777723857722 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 777723857722 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699953657; cv=none; b=rEWqR+jb+/NaWDRFyS2gKbq2RvJmrWL/qnDTIGlYfFuru+QhaUv+vbXLJjE6QAqt79hdRTxJWgeU155NKDWmRoHKzU3Log9CM2k+rLWMV9XSIkTLadLvOsUg/TWYWvwPbn68SPtiXnTHRDybFAgjEPPv2aEsFwA3vat3VqBvxAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699953657; c=relaxed/simple; bh=V+EXt9Ip1JVgjUbvByum435H5FsTZCk6StBIlFGDKx8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=AITN5TcMpqemyyJtFoq9lfA8hI92Ob+vsWtK5grq/6kcu47mxhxa2yhej+cBIgTWHLxXdckjTObE3NtTR/V0kUdH5mivoEoFxwK9nghddhfAsldajbrYNaapdTxvfSPRnWOAhdatFTr8EbJnU6YjiNwWiFTujGSS5MEJvTm4sls= 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=1699953654; x=1731489654; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V+EXt9Ip1JVgjUbvByum435H5FsTZCk6StBIlFGDKx8=; b=FU0zFEdWxGskWkwvFnYtatmqYpCKhlT1xOXBKWRv8PN2w0FgoEHoPyOW PA4Lb4DOwUfB70xJXADH+5G80tNlwM9AWINUJlIHeStK3ZLblGPKgp3BO hHE3CXzpwG0uZFjhTKiIILfdgPMjvTV9amyHpFykqgAcYME74i8RKTiwP DGFjHpfcv8IYyP7ibA+V4mJ9xfiORk3/pJLL+gADX05oa+LCsgG+7UwPm lxshPoJXBdFK8NubQMaAm4SM5LW4oJBCvHGsDtlsIkoYTtVzVZ5tOCmqh rOdqNLsxuHNGyqm52c6jn6F6Hsquiy3CXfUiwPHFcjlxj8QO2T0xtifkR w==; X-IronPort-AV: E=McAfee;i="6600,9927,10893"; a="3724585" X-IronPort-AV: E=Sophos;i="6.03,301,1694761200"; d="scan'208";a="3724585" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 01:20:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,301,1694761200"; d="scan'208";a="5953287" Received: from mbouhaou-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.56.16]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 01:20:50 -0800 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: blarsen@redhat.com, mohamed.bouhaouel@intel.com Subject: [PATCH v2 1/3] gdb, gdbserver, zpoint: report z_point support Date: Tue, 14 Nov 2023 10:20:27 +0100 Message-Id: <20231114092029.31205-2-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231114092029.31205-1-mohamed.bouhaouel@intel.com> References: <20231114092029.31205-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.7 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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Make gdbserver report which types of breakpoints and watchpoints are supported when exchanging features. This is done by replying with Z+ (Supported) or Z- (unsupported) --- gdb/NEWS | 4 ++++ gdb/doc/gdb.texinfo | 32 ++++++++++++++++++++++++++++++++ gdb/remote.c | 16 ++++++++++++++++ gdbserver/mem-break.cc | 2 +- gdbserver/mem-break.h | 4 ++++ gdbserver/server.cc | 7 +++++++ 6 files changed, 64 insertions(+), 1 deletion(-) diff --git a/gdb/NEWS b/gdb/NEWS index 682def44ce0..8146f695df3 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -49,6 +49,10 @@ QThreadOptions in qSupported QThreadOptions packet, and the qSupported response can contain the set of thread options the remote stub supports. +qSupported + Gdbserver now reports which types of breakpoints and watchpoints + are supported when exchanging features using Z+, Z-. + *** Changes in GDB 14 * GDB now supports the AArch64 Scalable Matrix Extension 2 (SME2), which diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index e4c00143fd1..20f1906be97 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -44631,6 +44631,31 @@ These are the currently defined stub features and their properties: @tab @samp{-} @tab No +@item @samp{Z0} +@tab No +@tab @samp{-} +@tab No + +@item @samp{Z1} +@tab No +@tab @samp{-} +@tab No + +@item @samp{Z2} +@tab No +@tab @samp{-} +@tab No + +@item @samp{Z3} +@tab No +@tab @samp{-} +@tab No + +@item @samp{Z4} +@tab No +@tab @samp{-} +@tab No + @end multitable These are the currently defined stub features, in more detail: @@ -44858,6 +44883,13 @@ The remote stub supports and implements the required memory tagging functionality and understands the @samp{qMemTags} (@pxref{qMemTags}) and @samp{QMemTags} (@pxref{QMemTags}) packets. +@item Z@var{type} +The remote stub reports which types of breakpoints and watchpoints are +supported. This is done using flags, @samp{Z}@var{type}@samp{+} for supported +and @samp{Z}@var{type}@samp{-} for unsupported, where @var{type} is one of +@samp{0}, @samp{1}, @samp{2}, @samp{3}, @samp{4} +(@pxref{insert breakpoint or watchpoint packet}). + For AArch64 GNU/Linux systems, this feature also requires access to the @file{/proc/@var{pid}/smaps} file so memory mapping page flags can be inspected. This is done via the @samp{vFile} requests. diff --git a/gdb/remote.c b/gdb/remote.c index ce5addade6f..7aa380a5989 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -808,6 +808,10 @@ class remote_target : public process_stratum_target int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; + /* Returns true if GDB Z breakpoint type TYPE is supported, + false otherwise. */ + bool supports_z_point_type (int type); + int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; @@ -5717,6 +5721,11 @@ static const struct protocol_feature remote_protocol_features[] = { { "no-resumed", PACKET_DISABLE, remote_supported_packet, PACKET_no_resumed }, { "memory-tagging", PACKET_DISABLE, remote_supported_packet, PACKET_memory_tagging_feature }, + { "Z0", PACKET_SUPPORT_UNKNOWN, remote_supported_packet, PACKET_Z0 }, + { "Z1", PACKET_SUPPORT_UNKNOWN, remote_supported_packet, PACKET_Z1 }, + { "Z2", PACKET_SUPPORT_UNKNOWN, remote_supported_packet, PACKET_Z2 }, + { "Z3", PACKET_SUPPORT_UNKNOWN, remote_supported_packet, PACKET_Z3 }, + { "Z4", PACKET_SUPPORT_UNKNOWN, remote_supported_packet, PACKET_Z4 }, }; static char *remote_support_xml; @@ -10991,6 +11000,13 @@ watchpoint_to_Z_packet (int type) } } +bool +remote_target::supports_z_point_type (int type) +{ + Z_packet_type packet = watchpoint_to_Z_packet (type); + return (m_features.packet_support (PACKET_Z0 + packet) != PACKET_DISABLE); +} + int remote_target::insert_watchpoint (CORE_ADDR addr, int len, enum target_hw_bp_type type, struct expression *cond) diff --git a/gdbserver/mem-break.cc b/gdbserver/mem-break.cc index 3bee8bc8990..7c3a1d1d47e 100644 --- a/gdbserver/mem-break.cc +++ b/gdbserver/mem-break.cc @@ -998,7 +998,7 @@ find_gdb_breakpoint (char z_type, CORE_ADDR addr, int kind) return NULL; } -static int +int z_type_supported (char z_type) { return (z_type >= '0' && z_type <= '4' diff --git a/gdbserver/mem-break.h b/gdbserver/mem-break.h index 9bf7aa84932..b27f0a23ac2 100644 --- a/gdbserver/mem-break.h +++ b/gdbserver/mem-break.h @@ -276,4 +276,8 @@ int remove_memory_breakpoint (struct raw_breakpoint *bp); void clone_all_breakpoints (struct thread_info *child_thread, const struct thread_info *parent_thread); + +/* Returns true if Z_TYPE is supported by the target. */ + +int z_type_supported (char z_type); #endif /* GDBSERVER_MEM_BREAK_H */ diff --git a/gdbserver/server.cc b/gdbserver/server.cc index a8e23561dcb..e727973ad45 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -2613,6 +2613,13 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p) if (target_supports_memory_tagging ()) strcat (own_buf, ";memory-tagging+"); + /* Z points support. */ + strcat (own_buf, z_type_supported ('0') ? ";Z0+" : ";Z0-"); + strcat (own_buf, z_type_supported ('1') ? ";Z1+" : ";Z1-"); + strcat (own_buf, z_type_supported ('2') ? ";Z2+" : ";Z2-"); + strcat (own_buf, z_type_supported ('3') ? ";Z3+" : ";Z3-"); + strcat (own_buf, z_type_supported ('4') ? ";Z4+" : ";Z4-"); + /* Reinitialize components as needed for the new connection. */ hostio_handle_new_gdb_connection (); target_handle_new_gdb_connection (); -- 2.25.1 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928