Blame SOURCES/gdb-power8-2of2.patch

2c2fa1
[PATCH] Enable hw watchpoint with longer ranges using DAWR on Power
2c2fa1
http://sourceware.org/ml/gdb-patches/2013-07/msg00085.html
2c2fa1
http://sourceware.org/ml/gdb-cvs/2013-07/msg00097.html
2c2fa1
2c2fa1
### src/gdb/ChangeLog	2013/07/22 11:42:30	1.15812
2c2fa1
### src/gdb/ChangeLog	2013/07/22 13:17:51	1.15813
2c2fa1
## -1,3 +1,9 @@
2c2fa1
+2013-07-22  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>
2c2fa1
+
2c2fa1
+	* ppc-linux-nat.c (PPC_DEBUG_FEATURE_DATA_BP_DAWR): New define.
2c2fa1
+	(ppc_linux_region_ok_for_hw_watchpoint): Add checking to use the new
2c2fa1
+	DAWR interface for longer ranges hardware watchpoint (up to 512 bytes).
2c2fa1
+
2c2fa1
 2013-07-22  Phil Muldoon  <pmuldoon@redhat.com>
2c2fa1
 
2c2fa1
 	* top.c (print_gdb_version): Add help, apropos description and
2c2fa1
--- gdb-7.6/gdb/ppc-linux-nat.c.orig	2013-07-24 17:39:30.434549279 +0200
2c2fa1
+++ gdb-7.6/gdb/ppc-linux-nat.c	2013-07-24 17:41:31.337706502 +0200
2c2fa1
@@ -178,7 +178,11 @@ struct ppc_hw_breakpoint
2c2fa1
         (1<<((n)+PPC_BREAKPOINT_CONDITION_BE_SHIFT))
2c2fa1
 #endif /* PPC_PTRACE_GETHWDBGINFO */
2c2fa1
 
2c2fa1
-
2c2fa1
+/* Feature defined on Linux kernel v3.9: DAWR interface, that enables wider
2c2fa1
+   watchpoint (up to 512 bytes).  */
2c2fa1
+#ifndef PPC_DEBUG_FEATURE_DATA_BP_DAWR
2c2fa1
+#define PPC_DEBUG_FEATURE_DATA_BP_DAWR	0x10
2c2fa1
+#endif /* PPC_DEBUG_FEATURE_DATA_BP_DAWR */
2c2fa1
 
2c2fa1
 /* Similarly for the general-purpose (gp0 -- gp31)
2c2fa1
    and floating-point registers (fp0 -- fp31).  */
2c2fa1
@@ -1503,6 +1507,7 @@ ppc_linux_region_ok_for_hw_watchpoint (C
2c2fa1
      to determine the hardcoded watchable region for watchpoints.  */
2c2fa1
   if (have_ptrace_booke_interface ())
2c2fa1
     {
2c2fa1
+      int region_size;
2c2fa1
       /* Embedded DAC-based processors, like the PowerPC 440 have ranged
2c2fa1
 	 watchpoints and can watch any access within an arbitrary memory
2c2fa1
 	 region. This is useful to watch arrays and structs, for instance.  It
2c2fa1
@@ -1511,11 +1516,17 @@ ppc_linux_region_ok_for_hw_watchpoint (C
2c2fa1
 	  && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
2c2fa1
 	  && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
2c2fa1
 	return 2;
2c2fa1
+      /* Check if the processor provides DAWR interface.  */
2c2fa1
+      if (booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_DAWR)
2c2fa1
+	/* DAWR interface allows to watch up to 512 byte wide ranges which
2c2fa1
+	   can't cross a 512 byte boundary.  */
2c2fa1
+	region_size = 512;
2c2fa1
+      else
2c2fa1
+	region_size = booke_debug_info.data_bp_alignment;
2c2fa1
       /* Server processors provide one hardware watchpoint and addr+len should
2c2fa1
          fall in the watchable region provided by the ptrace interface.  */
2c2fa1
-      if (booke_debug_info.data_bp_alignment
2c2fa1
-	  && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1))
2c2fa1
-	      + booke_debug_info.data_bp_alignment))
2c2fa1
+      if (region_size
2c2fa1
+	  && (addr + len > (addr & ~(region_size - 1)) + region_size))
2c2fa1
 	return 0;
2c2fa1
     }
2c2fa1
   /* addr+len must fall in the 8 byte watchable region for DABR-based