Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Cc: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>,
	       Ulrich.Weigand@de.ibm.com, eliz@gnu.org,
	lgustavo@codesourcery.com
Subject: Re: [PATCH] Enable hw watchpoint with longer ranges using DAWR on Power
Date: Tue, 16 Jul 2013 14:13:00 -0000	[thread overview]
Message-ID: <1373984020-31854-1-git-send-email-emachado@linux.vnet.ibm.com> (raw)
In-Reply-To: <1372798938-3549-1-git-send-email-emachado@linux.vnet.ibm.com>

Resending the patch rebased on current CVS head, with the latest updates on
gdb/ppc-linux-nat.c (thanks Ulrich for committing the patch renaming the
'booke' interface!).

Ok to commit?

Thanks,
--
Edjunior

gdb/ChangeLog
2013-07-16  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

	* ppc-linux-nat.c (PPC_DEBUG_FEATURE_DATA_BP_DAWR): New define.
	(ppc_linux_region_ok_for_hw_watchpoint): Add checking to use the new
	DAWR interface for longer ranges hardware watchpoint (up to 512 bytes).

---
 gdb/ppc-linux-nat.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 4b3c78c..1f3f080 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -177,7 +177,11 @@ struct ppc_hw_breakpoint
         (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT))
 #endif /* PPC_PTRACE_GETHWDBGINFO */
 
-
+/* Feature defined on Linux kernel v3.9: DAWR interface, that enables wider
+   watchpoint (up to 512 bytes).  */
+#ifndef PPC_DEBUG_FEATURE_DATA_BP_DAWR
+#define PPC_DEBUG_FEATURE_DATA_BP_DAWR	0x10
+#endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */
 
 /* Similarly for the general-purpose (gp0 -- gp31)
    and floating-point registers (fp0 -- fp31).  */
@@ -1504,6 +1508,7 @@ ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
      watchpoints.  */
   if (have_ptrace_hwdebug_interface ())
     {
+      int region_size;
       /* 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
@@ -1512,11 +1517,17 @@ ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
 	  && hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
 	  && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
 	return 2;
+      /* Check if the processor provides DAWR interface.  */
+      if (hwdebug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
+	/* DAWR interface allows to watch up to 512 byte wide ranges which
+	   can't cross a 512 byte boundary.  */
+	region_size = 512;
+      else
+	region_size = hwdebug_info.data_bp_alignment;
       /* Server processors provide one hardware watchpoint and addr+len should
          fall in the watchable region provided by the ptrace interface.  */
-      if (hwdebug_info.data_bp_alignment
-	  && (addr + len > (addr & ~(hwdebug_info.data_bp_alignment - 1))
-	      + hwdebug_info.data_bp_alignment))
+      if (region_size
+	  && (addr + len > (addr & ~(region_size - 1)) + region_size))
 	return 0;
     }
   /* addr+len must fall in the 8 byte watchable region for DABR-based
-- 
1.8.2.1


  reply	other threads:[~2013-07-16 14:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-02 17:40 Edjunior Barbosa Machado
2013-07-02 17:59 ` Luis Machado
2013-07-02 18:04   ` Ulrich Weigand
2013-07-02 20:03 ` Eli Zaretskii
2013-07-02 21:02   ` Edjunior Barbosa Machado
2013-07-16 14:13     ` Edjunior Barbosa Machado [this message]
2013-07-22 13:19       ` Ulrich Weigand

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=1373984020-31854-1-git-send-email-emachado@linux.vnet.ibm.com \
    --to=emachado@linux.vnet.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=lgustavo@codesourcery.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