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 1C3E138383F2 for ; Tue, 14 Nov 2023 09:21:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1C3E138383F2 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 1C3E138383F2 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=1699953669; cv=none; b=lCwkHd2yvfsbPQI/FdndzZHylaX7OMHHPDuof+EY20h+RlIKKAO0aubJqkL9Ys1YvDKTzJS6SSLa6B1t6vbM1mnAzni+8Hud6FXLTT1+V/sEXysiMT6NB3z29XbUHFtlFUPfn/AfYSTCwmrcvEjOcU3yaNQzurMyQD2gn7VJEDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699953669; c=relaxed/simple; bh=54GEUR0ATG4HyH0gWLVfdgaRlJAsJGhelSpnz/4bCw8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=MLwHMmx3zgTozqGG3TDNg+cvuHJ0KuHp6mqJcpqut6wUPmp+ujq96iX16MD7M/3n32T78hBqCicRCsfc1VUjXMLRqn7TWmYiS1erzV2ZezrpnxY+VNRYNDEXYi+3BThYwju2a4NF1acfFGGkMmWxg+QYdAl2iSxVlR4hWOFW63o= 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=1699953668; x=1731489668; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=54GEUR0ATG4HyH0gWLVfdgaRlJAsJGhelSpnz/4bCw8=; b=b3WiaLE1+jLD+sYSIEW6qFDCyTGpcsXcep5AFciTdTHbYuLn6z0Q7Bsg s2h5t0ZhOLpNuLB+LY2keWEZHyivwy8Hp+Qf+OghgC8kBWltTqGRvQRmW EuNOeNSVpyj+niXmLszELR9llxq/1IvcyOi0mHeyXdFD7yIPtBPKrhvCt ngvmykeu/eLvfynrrNZMpNJejgbx/senl5vJUajKLU0jTAZEBBeouxQ+A bH/cQmmlIixTxIYQAHiezeuhvQ3UDos1gegCiWllPzvrksIDaOh+sluQl pNKRJ7dqTRSG1m95sbyygk3yY9w2pdjkCBRQxc4jNpJM/noU6EFvqiJIz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10893"; a="3724646" X-IronPort-AV: E=Sophos;i="6.03,301,1694761200"; d="scan'208";a="3724646" 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:21:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,301,1694761200"; d="scan'208";a="5953390" 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:21:05 -0800 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: blarsen@redhat.com, mohamed.bouhaouel@intel.com Subject: [PATCH v2 2/3] gdb, breakpoint: add a breakpoint type converter Date: Tue, 14 Nov 2023 10:20:28 +0100 Message-Id: <20231114092029.31205-3-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.8 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: Add a new function 'bptype_to_target_hw_bp_type' to perform the translation from 'bptype' to 'target_hw_bp_type'. Reviewed-By: Guinevere Larsen --- gdb/breakpoint.c | 20 ++++++++++++++++++++ gdb/breakpoint.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index fe09dbcbeee..13eaff79789 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -9827,6 +9827,26 @@ watchpoint::~watchpoint () bpt->related_breakpoint = this->related_breakpoint; } +/* See breakpoint.h. */ + +target_hw_bp_type +bptype_to_target_hw_bp_type (bptype type) +{ + switch (type) + { + case bp_hardware_watchpoint: + return hw_write; + case bp_read_watchpoint: + return hw_read; + case bp_access_watchpoint: + return hw_access; + case bp_hardware_breakpoint: + return hw_execute; + default: + error (_ ("Bad breakpoint type: bptype %d."), type); + } +} + /* Return non-zero if EXP is verified as constant. Returned zero means EXP is variable. Also the constant detection may fail for some constant expressions and in such case still falsely return diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index e75efc90495..cc9a1ebc184 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -2029,4 +2029,7 @@ extern void enable_disable_bp_location (bp_location *loc, bool enable); extern void notify_breakpoint_modified (breakpoint *b); +/* Translate BPTYPE to TARGET_HW_BP_TYPE. */ + +extern target_hw_bp_type bptype_to_target_hw_bp_type (bptype type); #endif /* !defined (BREAKPOINT_H) */ -- 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