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: [pushed] Don't suppress errors inserting/removing hardware breakpoints in shared libraries.


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


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