Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb-patches@sourceware.org
Cc: "Eli Zaretskii" <eliz@gnu.org>,	"Pedro Alves" <palves@redhat.com>
Subject: Re: [PATCH] Extra error message from update_watchpoint
Date: Thu, 31 Oct 2013 13:05:00 -0000	[thread overview]
Message-ID: <52725555.3080009@broadcom.com> (raw)
In-Reply-To: <837gcueh56.fsf@gnu.org>

On 30/10/2013 6:40 PM, Eli Zaretskii wrote:
>> Date: Wed, 30 Oct 2013 17:13:19 +0000
>> From: "Andrew Burgess" <aburgess@broadcom.com>
>> cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
>>
>> I'd rather make you happy if possible, never hurts to suck up right ;-)
> 
> Thank you!
> 
>> The following follows the structure you gave, I'd be happy to go with
>> this except that it's longer than 80 character... is that an issue?
>>
>> "Can't set read/access watchpoint, software read/access watchpoints not
>> supported, and hardware watchpoints disabled (see set/show
>> can-use-hw-watchpoints)."
> 
> This is indeed much better.
> 
> As for length, I can suggest a shorter variant:
> 
>  Can't set read/access watchpoint when hardware watchpoints are disabled.

I've now pushed a version using this shorter message.

Pedro, Eli, thanks for the reviews.

Andrew

gdb/ChangeLog

2013-10-31  Andrew Burgess  <aburgess@broadcom.com>

	* breakpoint.c (update_watchpoint): Update error message and add
	an additional error message.

gdb/testsuite/ChangeLog

2013-10-31  Andrew Burgess  <aburgess@broadcom.com>

	* gdb.base/watchpoint.exp (test_no_hw_watchpoints): Add additional
	tests and update expected error message.
	(test_watch_register_location): New tests.
	(do_tests): Call test_watch_register_location.
	* gdb.base/watchpoints.exp: Update expected error message.

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 608463d..1782c99 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1805,7 +1805,8 @@ update_watchpoint (struct watchpoint *b, int reparse)
 	  if (b->base.ops->works_in_software_mode (&b->base))
 	    b->base.type = bp_watchpoint;
 	  else
-	    error (_("Software read/access watchpoints not supported."));
+	    error (_("Can't set read/access watchpoint when "
+		     "hardware watchpoints are disabled."));
 	}
     }
   else if (within_current_scope && b->exp)
@@ -1946,8 +1947,14 @@ update_watchpoint (struct watchpoint *b, int reparse)
 		}
 	    }
 	  else if (!b->base.ops->works_in_software_mode (&b->base))
-	    error (_("Expression cannot be implemented with "
-		     "read/access watchpoint."));
+	    {
+	      if (!can_use_hw_watchpoints)
+		error (_("Can't set read/access watchpoint when "
+			 "hardware watchpoints are disabled."));
+	      else
+		error (_("Expression cannot be implemented with "
+			 "read/access watchpoint."));
+	    }
 	  else
 	    b->base.type = bp_watchpoint;
 
diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp
index e0d4f81..9576a9e 100644
--- a/gdb/testsuite/gdb.base/watchpoint.exp
+++ b/gdb/testsuite/gdb.base/watchpoint.exp
@@ -825,8 +825,12 @@ proc test_no_hw_watchpoints {} {
     # refrains from using them.
     #
     gdb_test "rwatch ival3" \
-	"Expression cannot be implemented with read/access watchpoint..*" \
+	"Can't set read/access watchpoint when hardware watchpoints are disabled." \
 	"rwatch disallowed when can-set-hw-watchpoints cleared"
+    gdb_test "awatch ival3" \
+	"Can't set read/access watchpoint when hardware watchpoints are disabled." \
+	"awatch disallowed when can-set-hw-watchpoints cleared"
+
 
     # Re-enable hardware watchpoints if necessary.
     if ![target_info exists gdb,no_hardware_watchpoints] {
@@ -879,6 +883,22 @@ proc test_watchpoint_in_big_blob {} {
     gdb_test_no_output "delete \$bpnum" "delete watch buf"
 }
 
+proc test_watch_register_location {} {
+    global no_hw
+
+    if {!$no_hw && ![target_info exists gdb,no_hardware_watchpoints]} {
+	# Non-memory read/access watchpoints are not supported, they would
+	# require software read/access watchpoint support (which is not
+	# currently available).
+	gdb_test "rwatch \$pc" \
+	    "Expression cannot be implemented with read/access watchpoint..*" \
+	    "rwatch disallowed for register based expression"
+	gdb_test "awatch \$pc" \
+	    "Expression cannot be implemented with read/access watchpoint..*" \
+	    "awatch disallowed for register based expression"
+    }
+}
+
 # Start with a fresh gdb.
 
 set prev_timeout $timeout
@@ -940,6 +960,8 @@ proc do_tests {} {
 
     test_wide_location_1
     test_wide_location_2
+
+    test_watch_register_location
 }
 
 # On targets that can do hardware watchpoints, run the tests twice:
diff --git a/gdb/testsuite/gdb.base/watchpoints.exp b/gdb/testsuite/gdb.base/watchpoints.exp
index b70e86c..4e21d14 100644
--- a/gdb/testsuite/gdb.base/watchpoints.exp
+++ b/gdb/testsuite/gdb.base/watchpoints.exp
@@ -41,10 +41,10 @@ with_test_prefix "before inferior start" {
     # and read watchpoints require hardware watchpoint support, with this
     # turned off these can't be created.
     gdb_test "awatch ival1" \
-        "Software read/access watchpoints not supported." \
+        "Can't set read/access watchpoint when hardware watchpoints are disabled." \
         "create access watchpoint"
     gdb_test "rwatch ival1" \
-        "Software read/access watchpoints not supported." \
+        "Can't set read/access watchpoint when hardware watchpoints are disabled." \
         "create read watchpoint"
 }
 




  reply	other threads:[~2013-10-31 13:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18  9:20 Andrew Burgess
2013-10-18 17:18 ` Pedro Alves
2013-10-29 16:44   ` Andrew Burgess
2013-10-29 17:09     ` Pedro Alves
2013-10-29 17:19     ` Eli Zaretskii
2013-10-29 17:38       ` Andrew Burgess
2013-10-29 17:52         ` Pedro Alves
2013-10-29 19:09           ` Eli Zaretskii
2013-10-30 11:49         ` Andrew Burgess
2013-10-30 15:41           ` Eli Zaretskii
2013-10-30 17:13             ` Andrew Burgess
2013-10-30 18:41               ` Eli Zaretskii
2013-10-31 13:05                 ` Andrew Burgess [this message]
2013-10-30 18:48               ` Pedro Alves
2013-10-30 19:19                 ` Eli Zaretskii

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=52725555.3080009@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.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