public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org, luisgpm@linux.vnet.ibm.com
Subject: Re: [PATCH] testcases: Fix assorted problems related to powerpc
Date: Tue, 28 Sep 2010 21:48:00 -0000	[thread overview]
Message-ID: <201009281708.26790.pedro@codesourcery.com> (raw)
In-Reply-To: <1285689421.12736.138.camel@gargoyle>

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:

  reply	other threads:[~2010-09-28 16:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28 21:47 Luis Machado
2010-09-28 21:48 ` Pedro Alves [this message]
2010-09-29 15:04   ` Luis Machado
2010-09-29 16:32 Luis Machado
2010-11-09  4:47 ` Jan Kratochvil
2010-11-09  5:46   ` Doug Evans
2010-11-27 22:09   ` Andreas Schwab

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=201009281708.26790.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luisgpm@linux.vnet.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).