Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Rogerio Alves via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: ulrich.weigand@de.ibm.com, pedromfc@linux.ibm.com
Subject: [PATCH v1] [powerpc] Remove 512 bytes region limit if using 2nd DAWR.
Date: Sun,  8 Nov 2020 23:12:04 -0300	[thread overview]
Message-ID: <20201109021204.48664-1-rcardoso@linux.ibm.com> (raw)

Power 10 introduces the 2nd DAWR (second watchpoint) and also removed
a restriction that limit the watch region to 512 bytes.

2020-11-08  Rogerio A. Cardoso  <rcardoso@linux.ibm.com>

gdb/

* ppc-linux-nat.c: (PPC_DEBUG_FEATURE_DATA_BP_ARCH_31): New define.
(region_ok_for_hw_watchpoint): Check if 2nd DAWR is avaliable before set
region.

---
 gdb/ppc-linux-nat.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 7131134c10..643400eac5 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -138,6 +138,11 @@ struct ppc_hw_breakpoint
 #define PPC_DEBUG_FEATURE_DATA_BP_DAWR	0x10
 #endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */
 
+/* Feature defined on Linux kernel v5.1: Second watchpoint support.  */
+#ifndef PPC_DEBUG_FEATURE_DATA_BP_ARCH_31
+#define PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 0x20
+#endif /* PPC_DEBUG_FEATURE_DATA_BP_ARCH_31 */
+
 /* The version of the PowerPC HWDEBUG kernel interface that we will use, if
    available.  */
 #define PPC_DEBUG_CURRENT_VERSION 1
@@ -2111,7 +2116,6 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
       int region_size;
       const struct ppc_debug_info &hwdebug_info = (m_dreg_interface
 						   .hwdebug_info ());
-
       /* Embedded DAC-based processors, like the PowerPC 440 have ranged
 	 watchpoints and can watch any access within an arbitrary memory
 	 region. This is useful to watch arrays and structs, for instance.  It
@@ -2121,9 +2125,11 @@ ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 	  && linux_get_hwcap (current_top_target ()) & PPC_FEATURE_BOOKE)
 	return 2;
       /* Check if the processor provides DAWR interface.  */
-      if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
+      if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR
+	  && !(hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_ARCH_31))
 	/* DAWR interface allows to watch up to 512 byte wide ranges which
-	   can't cross a 512 byte boundary.  */
+	   can't cross a 512 byte boundary unless it uses a second DARW
+	   ISA 3.1 (P10) which has no such restriction.  */
 	region_size = 512;
       else
 	region_size = hwdebug_info.data_bp_alignment;
-- 
2.17.1


             reply	other threads:[~2020-11-09  2:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-09  2:12 Rogerio Alves via Gdb-patches [this message]
2020-11-09 10:24 ` Ulrich Weigand via Gdb-patches
2020-11-09 13:08   ` Rogerio Alves via Gdb-patches
2020-11-10 10:21     ` Ulrich Weigand via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201109021204.48664-1-rcardoso@linux.ibm.com \
    --to=gdb-patches@sourceware.org \
    --cc=pedromfc@linux.ibm.com \
    --cc=rcardoso@linux.ibm.com \
    --cc=ulrich.weigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox