This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] testcases: Fix assorted problems related to powerpc


On Tuesday 28 September 2010 16:57:01, Luis Machado wrote:
> gdb.base/watch-read.exp tries to create both a HW write watchpoint and a
> HW read watchpoint, but since POWER server processors only support a
> single HW watchpoint, this doesn't work right. It's strange, though,
> that GDB actually creates two HW watches for ppc, but the last one
> overrides the read/write flags of the previous one and thus we miss
> triggers. I've used an awatch instead, though i'd have to check if GDB
> is doing something wrong and if we could make this testcase pass without
> any changes. The results with AWATCH are pretty much the same as with
> RWATCH + WATCH.
> 

GDB is doing something wrong, and it's possible to make ppc pass this
testcase without any (test) changes.  I think the patch below is what
I used to test on ppc when I wrote that test
(<http://sourceware.org/ml/gdb-patches/2010-02/msg00521.html>), and
the test passed with it.

-- 
Pedro Alves

Index: src/gdb/ppc-linux-nat.c
===================================================================
--- src.orig/gdb/ppc-linux-nat.c	2010-02-22 12:27:25.000000000 -0800
+++ src/gdb/ppc-linux-nat.c	2010-02-22 12:27:29.000000000 -0800
@@ -1270,6 +1270,9 @@ store_ppc_registers (const struct regcac
     store_spe_register (regcache, tid, -1);
 }
 
+/* The cached DABR value, to install in new threads.  */
+static long saved_dabr_value;
+
 static int
 ppc_linux_check_watch_resources (int type, int cnt, int ot)
 {
@@ -1324,9 +1327,6 @@ ppc_linux_region_ok_for_hw_watchpoint (C
   return 1;
 }
 
-/* The cached DABR value, to install in new threads.  */
-static long saved_dabr_value;
-
 /* Set a watchpoint of type TYPE at address ADDR.  */
 static int
 ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw)
@@ -1352,6 +1352,11 @@ ppc_linux_insert_watchpoint (CORE_ADDR a
   }
 
   dabr_value = addr & ~(read_mode | write_mode);
+
+  gdb_assert (saved_dabr_value == 0
+	      || (saved_dabr_value & ~(read_mode | write_mode)) == dabr_value);
+
+  dabr_value |= (saved_dabr_value & (read_mode | write_mode));
   switch (rw)
     {
     case hw_read:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]