mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
bb95117e10
This fixes offender testcases that have test names starting with uppercase when using gdb_test/mi_gdb_test in a multi-line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.ada/array_return.exp * gdb.ada/expr_delims.exp * gdb.ada/mi_dyn_arr.exp * gdb.ada/mi_interface.exp * gdb.ada/mi_var_array.exp * gdb.ada/watch_arg.exp * gdb.arch/alpha-step.exp * gdb.arch/altivec-regs.exp * gdb.arch/e500-regs.exp * gdb.arch/powerpc-d128-regs.exp * gdb.base/arrayidx.exp * gdb.base/break.exp * gdb.base/checkpoint.exp * gdb.base/debug-expr.exp * gdb.base/dmsym.exp * gdb.base/radix.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.cell/break.exp * gdb.cell/ea-cache.exp * gdb.compile/compile.exp * gdb.cp/gdb2495.exp * gdb.gdb/selftest.exp * gdb.gdb/xfullpath.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.objc/basicclass.exp * gdb.pascal/hello.exp * gdb.pascal/integers.exp * gdb.python/py-breakpoint.exp * gdb.python/py-cmd.exp * gdb.python/py-linetable.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.threads/leader-exit.exp * gdb.threads/pthreads.exp * gdb.threads/wp-replication.exp * gdb.trace/actions.exp * gdb.trace/mi-tsv-changed.exp * gdb.trace/tsv.exp
140 lines
4.9 KiB
Plaintext
140 lines
4.9 KiB
Plaintext
# This testcase is part of GDB, the GNU debugger.
|
|
|
|
# Copyright 2009-2016 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/>.
|
|
|
|
# Check that hardware watchpoints get correctly replicated to all
|
|
# existing threads when hardware watchpoints are created. This test
|
|
# creates one hardware watchpoint per thread until a maximum is
|
|
# reached. It originally addresses a deficiency seen on embedded
|
|
# powerpc targets with slotted hardware *point designs.
|
|
|
|
set NR_THREADS 10
|
|
set NR_TRIGGERS_PER_THREAD 2
|
|
|
|
# This test verifies that a hardware watchpoint gets replicated to
|
|
# every existing thread and is detected properly. This test is
|
|
# only meaningful on a target with hardware watchpoint support.
|
|
if {[skip_hw_watchpoint_tests]} {
|
|
return 0
|
|
}
|
|
|
|
standard_testfile
|
|
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DNR_THREADS=$NR_THREADS -DNR_TRIGGERS_PER_THREAD=$NR_TRIGGERS_PER_THREAD"]] != "" } {
|
|
return -1
|
|
}
|
|
|
|
clean_restart ${binfile}
|
|
|
|
# Force hardware watchpoints to be used.
|
|
gdb_test_no_output "set can-use-hw-watchpoints 1" ""
|
|
|
|
# Run to `main' where we begin our tests.
|
|
if ![runto_main] then {
|
|
fail "failed to run to main"
|
|
return 0
|
|
}
|
|
|
|
# Set some default values.
|
|
set hwatch_count 0
|
|
set count 0
|
|
|
|
# Count the number of hardware watchpoints available on
|
|
# this target.
|
|
|
|
# So we get an immediate warning/error if the target doesn't support a
|
|
# hardware watchpoint or run out of hardware resource.
|
|
gdb_test_no_output "set breakpoint always-inserted on"
|
|
|
|
while { $count < $NR_THREADS } {
|
|
# Some targets do resource counting as we insert watchpoints.
|
|
# Such targets won't cause a watchpoint insertion failure, but
|
|
# will switch to software watchpoints silently. We check for
|
|
# both cases here.
|
|
gdb_test_multiple "watch watched_data\[$hwatch_count\]" \
|
|
"watch watched_data\[$hwatch_count\]" {
|
|
-re ".*Could not insert hardware watchpoint.*$gdb_prompt $" {
|
|
# End the loop.
|
|
set count $NR_THREADS
|
|
}
|
|
-re "Hardware watchpoint .*$gdb_prompt $" {
|
|
incr hwatch_count
|
|
}
|
|
-re "Watchpoint .*$gdb_prompt $" {
|
|
# End the loop.
|
|
set count $NR_THREADS
|
|
}
|
|
}
|
|
incr count
|
|
}
|
|
|
|
gdb_test_no_output "set breakpoint always-inserted off"
|
|
|
|
# Target cannot insert hardware watchpoints. It should have reported
|
|
# (through board settings) that it did not support them in the first place.
|
|
# Just exit.
|
|
if { $hwatch_count == 0} {
|
|
fail "no hardware watchpoints available"
|
|
return 0
|
|
}
|
|
|
|
# Set the testcase's internal variable indicating the number of
|
|
# hardware watchpoints the target supports.
|
|
gdb_test_no_output "set var hw_watch_count=${hwatch_count}" \
|
|
"set var hw_watch_count=${hwatch_count}"
|
|
|
|
# At this point, we know how many hardware watchpoints
|
|
# the target supports. Use that to do further testing.
|
|
delete_breakpoints
|
|
|
|
# Prepare to create all the threads.
|
|
gdb_test "break thread_started" \
|
|
"Breakpoint \[0-9\]+ at .*: file .*${srcfile}, line .*" \
|
|
"breakpoint on thread_started"
|
|
|
|
# Move all threads to where they're supposed to be for testing.
|
|
for { set i 0 } { $i < $NR_THREADS } { incr i } {
|
|
|
|
# We want to set the maximum number of hardware watchpoints
|
|
# and make sure the target can handle that without an error.
|
|
# That will show us the watchpoints got replicated to all the
|
|
# threads correctly, and that no new watchpoints got created
|
|
# in the background for a specific thread.
|
|
if {$i < $hwatch_count} {
|
|
gdb_test "watch watched_data\[$i\]" \
|
|
"Hardware watchpoint .*" \
|
|
"watch watched_data\[$i\]"
|
|
} else {
|
|
verbose -log "Not setting watchpoint for watched_data\[$i\]\n"
|
|
}
|
|
|
|
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, thread_started \\(\\) at .*$srcfile.*" \
|
|
"Thread $i hit breakpoint at thread_started"
|
|
}
|
|
|
|
# Let the threads run and change the watched data, leading
|
|
# to watchpoint triggers.
|
|
gdb_test_no_output "set var test_ready=1" \
|
|
"set var test_ready=1"
|
|
|
|
# Set the number of expected watchpoint triggers.
|
|
set TRIGGERS [expr "$NR_THREADS * $hwatch_count * $NR_TRIGGERS_PER_THREAD"]
|
|
|
|
# Move the threads and hit the watchpoints TRIGGERS times.
|
|
for { set i 1 } { $i <= $TRIGGERS } { incr i } {
|
|
gdb_test continue "Continuing\\..*Hardware watchpoint \[0-9\]+: watched_data\[\[0-9\]+\].*Old value = \[0-9\]+.*New value = \[0-9\]+.*thread_function \\(arg=$hex\\) at .*$srcfile.*" \
|
|
"Continue to watchpoint trigger $i out of ${TRIGGERS} on watched_data"
|
|
}
|