From patchwork Tue Nov 14 13:35:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bouhaouel, Mohamed" X-Patchwork-Id: 79831 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 C6159385783F for ; Tue, 14 Nov 2023 13:36:44 +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.7]) by sourceware.org (Postfix) with ESMTPS id 8E56D3854143 for ; Tue, 14 Nov 2023 13:36:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8E56D3854143 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 8E56D3854143 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699968984; cv=none; b=RUKSRdltHJWLpLbyYWlupqGi+S/9TuIFhR5TaWTPTG1vJ/sjYvfUdLzX9H2mj9Em+OJU6ywpl5tXh5nZkOv9GaHl2GEEBRJaMEZGMoPNHRSXrAKxmQLPhgxHeygNPTSWgib1Hr1kYWXGCKPXHSRNewazrGWTNvdJnnSIi/KpRfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699968984; c=relaxed/simple; bh=54GEUR0ATG4HyH0gWLVfdgaRlJAsJGhelSpnz/4bCw8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=FeVwt9XVL+Q2qfA+3DbYhW8Pojrjkiheowp1Wbn75OJrMzLBb8rzZs1/Z2DS743jbckouOqhK+6vpkX0GFd8xb5KKcvGPBlCUqXMoGX2P79C80c2Sxm0b18VAc+294x9RqIhq7nGQLICSgsCzItDmehxhdhb/DeCJHSlu1bCM3Y= 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=1699968983; x=1731504983; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=54GEUR0ATG4HyH0gWLVfdgaRlJAsJGhelSpnz/4bCw8=; b=DkI7aNAGTmRNPzFileMxOM9To/CpJm/dLov/1+ZKHYoaWJlwFNtkfkGV lbvnm7GKLW4bS8im/q90T1RAI2xvWI21HlLOIqCBzGuHPUWv+JXyRD4jR M83YDSvP/Fre2exXC8eY/rWzqpOJ8IuM+LYrX2OtKTdVgdruAQ3YfISeq AXt3ng+kDhVVtUWFPVsWUjiXqMZtK9+T4BQ5Hb+BYggLQvRuRFBLOs2zG mkWEd+EG0f092qwntGEB0FvQ2FTXvUwKLcOslvnWxrs8sRaLYQVBwVY7e KJ6I024rxGxIWIJiz7441eCwCWvHAh+20yTCF0kPldjXUW5KF4kyHJhWb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10894"; a="12199812" X-IronPort-AV: E=Sophos;i="6.03,302,1694761200"; d="scan'208";a="12199812" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 05:36:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,302,1694761200"; d="scan'208";a="5808077" Received: from mbouhaou-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.56.16]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2023 05:36:20 -0800 From: Mohamed Bouhaouel To: gdb-patches@sourceware.org Cc: blarsen@redhat.com, mohamed.bouhaouel@intel.com, eliz@gnu.org Subject: [PATCH v3 2/3] gdb, breakpoint: add a breakpoint type converter Date: Tue, 14 Nov 2023 14:35:31 +0100 Message-Id: <20231114133532.3877-3-mohamed.bouhaouel@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231114133532.3877-1-mohamed.bouhaouel@intel.com> References: <20231114133532.3877-1-mohamed.bouhaouel@intel.com> MIME-Version: 1.0 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, 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 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 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) */