mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
20c6f1e176
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.
79 lines
2.2 KiB
Plaintext
79 lines
2.2 KiB
Plaintext
# Copyright 2014 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
if {[skip_hw_breakpoint_tests]} {
|
|
return 0
|
|
}
|
|
|
|
standard_testfile
|
|
|
|
if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
|
|
return -1
|
|
}
|
|
|
|
if ![runto_main] {
|
|
fail "Can't run to main"
|
|
return -1
|
|
}
|
|
|
|
# If we can read the memory at address 0, skip the test.
|
|
if { [is_address_zero_readable] } {
|
|
untested "Memory at address 0 is readable"
|
|
return
|
|
}
|
|
|
|
delete_breakpoints
|
|
|
|
# Test whether the target supports hardware breakpoints at all.
|
|
|
|
set supports_hbreak 0
|
|
set test "probe hardware breakpoint support"
|
|
gdb_test_multiple "hbreak main" $test {
|
|
-re "No hardware breakpoint support in the target.*$gdb_prompt $" {
|
|
pass $test
|
|
}
|
|
-re "Hardware breakpoints used exceeds limit.*$gdb_prompt $" {
|
|
pass $test
|
|
}
|
|
-re "Hardware assisted breakpoint.*at.* file .*$srcfile, line.*$gdb_prompt $" {
|
|
set supports_hbreak 1
|
|
pass $test
|
|
}
|
|
}
|
|
|
|
if {!$supports_hbreak} {
|
|
unsupported "hardware breakpoints"
|
|
return
|
|
}
|
|
|
|
delete_breakpoints
|
|
|
|
# Force immediate breakpoint insertion.
|
|
gdb_test_no_output "set breakpoint always-inserted on"
|
|
|
|
# Hardware breakpoints are implemented using a mechanism that is not
|
|
# dependent on being able to modify the target's memory, we should be
|
|
# able to set them even in unmapped memory areas.
|
|
gdb_test "hbreak *0" "Hardware assisted breakpoint \[0-9\]+ at 0x0"
|
|
|
|
gdb_test "info break" "hw breakpoint.*y.*0x0\+\[ \t\]\+" \
|
|
"info break shows hw breakpoint"
|
|
|
|
gdb_test_no_output "delete \$bpnum" "" "delete" \
|
|
"delete hw breakpoint"
|
|
|
|
gdb_test "info break" "No breakpoints or watchpoints\." \
|
|
"info break shows no breakpoints"
|