summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/hbreak-unmapped.exp
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2014-08-07 16:09:38 +0800
committerYao Qi <yao@codesourcery.com>2014-08-09 08:46:32 +0800
commit20c6f1e176f4139ed1e76d4256e70149e38c0820 (patch)
tree8b75b294fe07e0e89650e997f9594a14897454e5 /gdb/testsuite/gdb.base/hbreak-unmapped.exp
parent5792e8e37be2f848152115fd4783b0e28b5253ad (diff)
downloadbinutils-gdb-20c6f1e176f4139ed1e76d4256e70149e38c0820.tar.gz
Remove duplicated code on checking address 0x0 is accessiable
I find some gdb.python tests fail on arm-none-eabi target, because the tests assume that memory on address 0x is inaccessible. Some tests (in gdb.base) are aware of this, so do a "x 0" check first. However, the code is copy-n-paste. This patch is to move the "x 0" check to a procedure in lib/gdb.exp, and get needed tests call it. The original code matches pattern "0x0:\[ \t\]*Error accessing memory address 0x0\r\n$gdb_prompt $", but I remove it from the new proc is_address_zero_readable, because GDB doesn't emit such message any more. gdb/testsuite: 2014-08-09 Yao Qi <yao@codesourcery.com> * gdb.base/display.exp: Invoke is_address_zero_readable. * gdb.guile/scm-value.exp (test_value_in_inferior): Likewise. * gdb.python/py-value.exp (test_value_in_inferior): Likewise. * gdb.base/hbreak-unmapped.exp: Return if is_address_zero_readable returns true. * gdb.base/signest.exp: Likewise. * gdb.base/signull.exp: Likewise. * gdb.base/sigbpt.exp: Likewise. * gdb.guile/scm-disasm.exp: Do the test if is_address_zero_readable returns false. * gdb.guile/scm-pretty-print.exp (run_lang_tests): Likewise. * gdb.python/py-arch.exp: Likewise. * gdb.python/py-prettyprint.exp (run_lang_tests): Likewise. * lib/gdb.exp (is_address_zero_readable): New proc.
Diffstat (limited to 'gdb/testsuite/gdb.base/hbreak-unmapped.exp')
-rw-r--r--gdb/testsuite/gdb.base/hbreak-unmapped.exp10
1 files changed, 3 insertions, 7 deletions
diff --git a/gdb/testsuite/gdb.base/hbreak-unmapped.exp b/gdb/testsuite/gdb.base/hbreak-unmapped.exp
index 95668f2fd62..b71770fc0da 100644
--- a/gdb/testsuite/gdb.base/hbreak-unmapped.exp
+++ b/gdb/testsuite/gdb.base/hbreak-unmapped.exp
@@ -29,13 +29,9 @@ if ![runto_main] {
}
# 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
- }
+if { [is_address_zero_readable] } {
+ untested "Memory at address 0 is readable"
+ return
}
delete_breakpoints