public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <lgustavo@codesourcery.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Handle memory write errors on gdb.base/break-always.exp
Date: Wed, 29 Apr 2015 15:30:00 -0000	[thread overview]
Message-ID: <5540F51C.2030303@codesourcery.com> (raw)
In-Reply-To: <86mw1swmwi.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

On 04/28/2015 07:46 AM, Yao Qi wrote:
> Luis Machado <lgustavo@codesourcery.com> writes:
>
>> Ping?
>
> Hi Luis,
> I've approved this patch here
> https://sourceware.org/ml/gdb-patches/2015-04/msg00512.html  If my
> comments are addressed in the updated patch, you can push it in.
>

Sorry. For some reason i didn't get that reply. I did the changes and 
pushed the attached patch in.

Thanks,
Luis



[-- Attachment #2: break-always.diff --]
[-- Type: text/x-patch, Size: 2034 bytes --]

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 639dae7..3e2df8f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-29  Luis Machado  <lgustavo@codesourcery.com>
+
+	* gdb.base/break-always.exp: Abort testing if writing to memory
+	causes an error.
+
 2015-04-28  Doug Evans  <dje@google.com>
 
 	* gdb.python/py-pp-maint.py: Move "replace" testing to ...
diff --git a/gdb/testsuite/gdb.base/break-always.exp b/gdb/testsuite/gdb.base/break-always.exp
index 681be37..c45ce54 100644
--- a/gdb/testsuite/gdb.base/break-always.exp
+++ b/gdb/testsuite/gdb.base/break-always.exp
@@ -69,19 +69,25 @@ gdb_test "p /x \$shadow = *(char *) $bp_address" \
 # and still leave the breakpoint insn planted.  Try twice with
 # different values, in case we happen to be writting exactly what was
 # there already.
-gdb_test "p /x *(char *) $bp_address = 0" \
-    " = 0x0" \
-    "write 0 to breakpoint's address"
-gdb_test "p /x *(char *) $bp_address" \
-    " = 0x0" \
-    "read back 0 from the breakpoint's address"
-
-gdb_test "p /x *(char *) $bp_address = 1" \
-    " = 0x1" \
-    "write 1 to breakpoint's address"
-gdb_test "p /x *(char *) $bp_address" \
-    " = 0x1" \
-    "read back 1 from the breakpoint's address"
+foreach test_value {0 1} {
+    set write_test "write $test_value to breakpoint's address"
+
+    gdb_test_multiple "p /x *(char *) $bp_address = $test_value" $write_test {
+	-re "Cannot access memory at address $hex.*$gdb_prompt $" {
+
+	    # Some targets do not allow manually writing a breakpoint to a
+	    # certain memory address, like QEMU.  In that case, just bail out.
+	    unsupported "Cannot write to address $bp_address"
+	    return -1
+	}
+	-re " = .*$gdb_prompt $" {
+	    pass $write_test
+	}
+    }
+
+    set read_test "read back $test_value from the breakpoint's address"
+    gdb_test "p /x *(char *) $bp_address" " = 0x$test_value" $read_test
+}
 
 # Restore the original contents.
 gdb_test "p /x *(char *) $bp_address = \$shadow" "" \

      reply	other threads:[~2015-04-29 15:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 18:21 Luis Machado
2015-04-14  9:00 ` Yao Qi
2015-04-27 15:41 ` Luis Machado
2015-04-28 11:07   ` Yao Qi
2015-04-29 15:30     ` Luis Machado [this message]

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=5540F51C.2030303@codesourcery.com \
    --to=lgustavo@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.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).