public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [pushed] Don't suppress errors inserting/removing hardware breakpoints in shared libraries.
Date: Fri, 06 Jun 2014 03:10:00 -0000	[thread overview]
Message-ID: <539130AC.2050401@codesourcery.com> (raw)
In-Reply-To: <5390946C.6010408@redhat.com>

On 06/06/2014 12:01 AM, Pedro Alves wrote:
> Yes, but no need to match by target, we can do like e.g.,
> gdb.base/signull.exp does, and check whether "x /b 0" manages
> to read memory.  If so, then skip the test.  Any sane target with
> an MMU will leave page 0 unmapped, so no need to look for some other
> address.

How about the patch below?

-- 
Yao (齐尧)

Subject: [PATCH] Skip hbreak-unmapped.exp if memory at address 0 is readable

hbreak-unmapped.exp assumes that memory at address 0 is unmapped or
unreadable, but on bare metal or uclinux targets, memory at address
0 is readable.  For example, on arm-none-eabi, the vector table base
address is 0x0.

hbreak *0^M
Hardware assisted breakpoint 3 at 0x0: file
/scratch/yqi/arm-none-eabi-lite/obj/cs3-2014.11-999999-arm-none-eabi-i686-pc-linux-gnu/generated/arm-vector.S,
line 25.^M
(gdb) FAIL: gdb.base/hbreak-unmapped.exp: hbreak *0
info break^M
Num     Type           Disp Enb Address    What^M
3       hw breakpoint  keep y   0x00000000
/scratch/yqi/arm-none-eabi-lite/obj/cs3-2014.11-999999-arm-none-eabi-i686-pc-linux-gnu/generated/arm-vector.S:25^M
(gdb) FAIL: gdb.base/hbreak-unmapped.exp: info break shows hw breakpoint
delete $bpnum

This patch is to check whether address 0 is readable via command 'x 0'.
If it is, skip the test.

gdb/testsuite:

2014-06-06  Yao Qi  <yao@codesourcery.com>

	* gdb.base/hbreak-unmapped.exp: Read memory at address 0.  If
	readable, skip the test.
---
 gdb/testsuite/gdb.base/hbreak-unmapped.exp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gdb/testsuite/gdb.base/hbreak-unmapped.exp b/gdb/testsuite/gdb.base/hbreak-unmapped.exp
index 5cb655c..95668f2 100644
--- a/gdb/testsuite/gdb.base/hbreak-unmapped.exp
+++ b/gdb/testsuite/gdb.base/hbreak-unmapped.exp
@@ -28,6 +28,16 @@ if ![runto_main] {
     return -1
 }
 
+# If we can read the memory at address 0, skip the test.
+gdb_test_multiple "x 0" "memory at address 0" {
+    -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
+    -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
+    -re ".*$gdb_prompt $" {
+	untested "Memory at address 0 is readable"
+	return
+    }
+}
+
 delete_breakpoints
 
 # Test whether the target supports hardware breakpoints at all.
-- 
1.9.0

  reply	other threads:[~2014-06-06  3:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 14:08 Pedro Alves
2014-06-03  9:43 ` Yao Qi
2014-06-05 16:02   ` Pedro Alves
2014-06-06  3:10     ` Yao Qi [this message]
2014-06-06  8:41       ` Pedro Alves
2014-06-06  9:00         ` Yao Qi

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=539130AC.2050401@codesourcery.com \
    --to=yao@codesourcery.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).