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: Ulrich Weigand <uweigand@de.ibm.com>
Subject: [PATCH] Fix hardware watchpoints on PowerPC servers
Date: Mon, 13 May 2013 06:29:00 -0000	[thread overview]
Message-ID: <1368426484-32623-1-git-send-email-emachado@linux.vnet.ibm.com> (raw)

Hi,

initially developed only for bookE (embedded processors), the new ptrace
interface is now available for Power server processors too [1].

This patch fixes the insertion of hardware watchpoints on Power servers
using this new interface available on kernel 3.7 and newer (currently, the
region should be aligned to 8 bytes, which is also the max length). It reduces
the number of unexpected failures in gdb testsuite in 40 failures (ppc64
running kernel 3.8).

Thanks and regards,
--
Edjunior.

[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/arch/powerpc/kernel/ptrace.c?id=6c7a2856ade6a58c20038024247d16a12a8d2323

gdb/ChangeLog
2013-05-12  Edjunior Machado  <emachado@linux.vnet.ibm.com>

	* ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): Check if the
	region is ok for a hardware watchpoint using the new ptrace interface
	on Power servers.

---
 gdb/ppc-linux-nat.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 280dcbe..1ff00a6 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1503,16 +1503,19 @@ ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
      to determine the hardcoded watchable region for watchpoints.  */
   if (have_ptrace_booke_interface ())
     {
-      /* DAC-based processors (i.e., embedded 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 takes two hardware watchpoints though.  */
+      /* 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
+         takes two hardware watchpoints though.  */
       if (len > 1
-	  && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE)
+	  && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
+	  && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
 	return 2;
-      else if (booke_debug_info.data_bp_alignment
-	       && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1))
-		   + booke_debug_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 (booke_debug_info.data_bp_alignment
+	  && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1))
+	      + booke_debug_info.data_bp_alignment))
 	return 0;
     }
   /* addr+len must fall in the 8 byte watchable region for DABR-based
-- 
1.7.1


             reply	other threads:[~2013-05-13  6:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13  6:29 Edjunior Barbosa Machado [this message]
2013-05-13  7:08 ` Luis Machado
2013-05-13 14:16   ` Edjunior Barbosa Machado
2013-05-13 13:19 ` Ulrich Weigand
2013-05-13 14:17   ` Edjunior Barbosa Machado
2013-05-17 23:09     ` Edjunior Barbosa Machado

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=1368426484-32623-1-git-send-email-emachado@linux.vnet.ibm.com \
    --to=emachado@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@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