Running tclint on the test-cases in gdb.base shows a few problems.
Fix these.
"gdb/testsuite/boards",
"gdb/testsuite/config",
"gdb/testsuite/lib",
-"gdb/testsuite/gdb.base",
# IGNORE (document reason in trailing comment):
"gdb/testsuite/gdb.stabs", # To be removed.
]
# work with stub targets, where GDB connects to debug an already started
# process.
-if [use_gdb_stub] {
+if {[use_gdb_stub]} {
verbose "Skipping rest of a2-run.exp because target is a stub."
return
}
gdb_load $binfile
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
}
foreach non_stop { "off" "on" } {
- set stop_mode [expr ($non_stop=="off")?"all-stop":"non-stop"]
+ set stop_mode [expr {($non_stop=="off")?"all-stop":"non-stop"}]
with_test_prefix "$stop_mode" {
test $non_stop
}
proc_with_prefix until_advance_lineno_from_inlined {cmd} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
gdb_breakpoint $lineno
gdb_continue_to_breakpoint "break here"
- set lineno2 [expr $lineno + 1]
+ set lineno2 [expr {$lineno + 1}]
gdb_test "$cmd $lineno2" \
"inline_func .* at .*:$lineno2.*return i.*" \
proc_with_prefix until_advance_lineno_from_non_inlined {cmd} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
proc_with_prefix until_advance_inline_func {cmd} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
proc_with_prefix advance_overload {} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
proc_with_prefix until_overload {} {
global lineno
- if ![runto test] {
+ if {![runto test]} {
return
}
".*Breakpoint ${decimal}, main.*func3.*break here.*" \
"continue to call to func3 in main"
-# Verify that "advance <funcname>" when funcname is called as parameter to
+# Verify that "advance <funcname>" when funcname is called as parameter to
# another function works.
#
gdb_test "advance foo" \
set num_slices 8
set num_archs [llength $supported_archs]
-set archs_per_slice [expr (($num_archs + $num_slices - 1) / $num_slices)]
+set archs_per_slice [expr {(($num_archs + $num_slices - 1) / $num_slices)}]
with_test_prefix "tests" {
foreach_with_prefix osabi $supported_osabis {
incr arch_count
# Skip architectures outside our slice.
- if {$arch_count < [expr $test_slice * $archs_per_slice]} {
+ if {$arch_count < $test_slice * $archs_per_slice} {
continue
}
- if {$arch_count >= [expr ($test_slice + 1) * $archs_per_slice]} {
+ if {$arch_count >= ($test_slice + 1) * $archs_per_slice} {
continue
}
foreach v $options {
with_test_prefix "$var=$v" {
gdb_test_no_output_osabi "$cmd $v" "$cmd"
- run_axis $all_axes [expr $cur_axis + 1] $arch
+ run_axis $all_axes [expr {$cur_axis + 1}] $arch
}
}
}
#
# tests for arithmetic, logical and relational operators
# with mixed types
-#
+#
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
#
-# Escape all the characters in the path that need it. For instance
+# Escape all the characters in the path that need it. For instance
# the directory name could contain '+'.
#
set escapedsrcfile [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
}
#
-# break at printf. When we are stopped at printf, we can test
+# break at printf. When we are stopped at printf, we can test
#
gdb_test_multiple "break printf" "break printf" {
-re "\r\n\032\032post-prompt\r\nBreakpoint.*at $hex.*\032\032breakpoints-invalid\r\n.*$gdb_prompt$" {
#
-# test printing a frame with some arguments:
+# test printing a frame with some arguments:
# annotate-arg-begin
# annotate-arg-name-end
# annotate-arg-value
# annotate-arg-end
#
-if [target_info exists gdb,nosignals] {
+if {[target_info exists gdb,nosignals]} {
unsupported "send SIGUSR1"
unsupported "backtrace @ signal handler"
} else {
# annotate-signal-name-end
# annotate-signal-string
# annotate-signal-string-end
-# FIXME: annotate-signal not tested (requires that the inferior be
+# FIXME: annotate-signal not tested (requires that the inferior be
# stopped by a "random" signal)
-if [target_info exists gdb,nosignals] {
+if {[target_info exists gdb,nosignals]} {
unsupported "signal sent"
} else {
gdb_test_multiple "signal SIGTRAP" "signal sent" {
#
# info break:
#
-send_gdb "info break\n"
+send_gdb "info break\n"
gdb_expect_list "breakpoint info" "$gdb_prompt$" [concat {
"\r\n\032\032post-prompt\r\n"
"Num Type Disp Enb Address +What\r\n" } [list \
# We don't care about the annotated output for this operation, it is the same as
# the one produced by run above
#
-send_gdb "next\n"
+send_gdb "next\n"
gdb_expect_list "go after array init line" "$gdb_prompt$" {
"\r\n\032\032post-prompt\r\n"
"\r\n\032\032starting\r\n"
#
-# test printing a frame with some arguments:
+# test printing a frame with some arguments:
#
-if [target_info exists gdb,nosignals] {
+if {[target_info exists gdb,nosignals]} {
unsupported "send SIGUSR1"
unsupported "backtrace @ signal handler"
} else {
# Send a signal that is not handled
-if [target_info exists gdb,nosignals] {
+if {[target_info exists gdb,nosignals]} {
unsupported "signal sent"
} else {
send_gdb "signal SIGTRAP\n"
set re_list $re_no_esc_list
}
- set expected_len [expr 1 + [llength $re_list]]
+ set expected_len [expr {1 + [llength $re_list]}]
gdb_test "print argc" \
"\\\$$::decimal = $expected_len" "argc for $name"
gdb_test "print argv\[$i\]" \
"\\\$$::decimal = $::hex \"$arg\"" \
"argv\[$i\] for $name"
- set i [expr $i + 1]
+ set i [expr {$i + 1}]
}
}
}
# command expanding symlinks in the name of the program being run.
# This test uses pathnames on build to create symbolic links on host and
# expects the test program running on target to see those symbolic links.
-# Therefore, it can't work reliably on anything other than configurations
+# Therefore, it can't work reliably on anything other than configurations
# where build/host/target are all the same.
require isnative
clean_restart "$filelink"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
clean_restart "$dirlink/$filelink"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
#
# tests for correctness of arithmetic operators, associativity and precedence
# with integer type variables
-#
+#
#
# test running programs
gdb_test "print y" "2"
gdb_test "print z" "2"
gdb_test "print w" "3"
-
+
gdb_test "print x+y" "16"
gdb_test "print x-y" "12"
gdb_test "print x*y" "28"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
#
# tests for all the assignemnt operators
# with mixed types and with int type variables
-#
+#
#
# test running programs
}
}
set next_insn_is_stmt \
- [expr [lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1]
+ [expr {[lsearch -regexp $is_stmt 0x0*$next_insn_addr] != -1}]
if { $next_insn_is_stmt } {
set prefix ""
set readelf_program [gdb_find_readelf]
set command "exec $readelf_program -Wl $binfile"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
if {$result != 0} {
fail $test
return
}
- if ![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr] {
+ if {![regexp {\nProgram Headers:\n *Type [^\n]* Align\n(.*?)\n\n} $output trash phdr]} {
fail "$test (no Program Headers)"
return
}
- if ![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr] {
+ if {![regexp -line {^ *DYNAMIC +0x[0-9a-f]+ +(0x[0-9a-f]+) } $phdr trash dynamic_vaddr]} {
fail "$test (no DYNAMIC found)"
return
}
set dynamic_vaddr [lindex $phdr 0]
set align_max [lindex $phdr 1]
-set stub_size [format 0x%x [expr "2 * $align_max - ($dynamic_vaddr & ($align_max - 1))"]]
+set stub_size [format 0x%x [expr {2 * $align_max - ($dynamic_vaddr & ($align_max - 1))}]]
verbose -log "stub_size is $stub_size"
# On x86_64 it is commonly about 4MB.
set test "generate stub"
set command "exec $binfile $stub_size >$genfile"
verbose -log "command is $command"
-set result [catch $command output]
+set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
if {$result == 0} {
set phdr [read_phdr $binfile "readelf rebuilt with stub_size"]
set dynamic_vaddr_prelinkno [lindex $phdr 0]
-if ![prelink_yes $prelink_args] {
+if {![prelink_yes $prelink_args]} {
return -1
}
set phdr [read_phdr $binfile "readelf with prelink -R"]
set dynamic_vaddr_prelinkyes [lindex $phdr 0]
-set first_offset [format 0x%x [expr $dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno]]
+set first_offset [format 0x%x [expr {$dynamic_vaddr_prelinkyes - $dynamic_vaddr_prelinkno}]]
verbose -log "first_offset is $first_offset"
set test "first offset is non-zero"
foreach align_mult {1 2} { with_test_prefix "shift-by-$align_mult" {
# FIXME: We believe there is enough room under FIRST_OFFSET.
- set shifted_offset [format 0x%x [expr "$first_offset - $align_mult * $align_max"]]
+ set shifted_offset [format 0x%x [expr {$first_offset - $align_mult * $align_max}]]
verbose -log "shifted_offset is $shifted_offset"
# For normal prelink (prelink_yes call), we need to supply $prelink_args.
# as the libraries would also get relocated.
set command "exec /usr/sbin/prelink -q -N --no-exec-shield -r $shifted_offset $binfile"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
pass $test
}
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
set test "sanity check info shared"
}
-re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
# Response expected from /proc-based systems.
- pass "$test"
+ pass "$test"
}
-re "Can't attach to process..*$gdb_prompt $" {
# Response expected on Cygwin
}
-re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
# Response expected from /proc-based systems.
- pass "$test"
+ pass "$test"
}
-re "Can't attach to process..*$gdb_prompt $" {
# Response expected on Cygwin
pass "$test"
}
}
-
+
# Verify that we can't double attach to the process.
set test "first attach"
# (Actually, the test system appears to do this automatically for
# us. So, we must also be prepared to be asked if we want to
# discard an existing set of symbols.)
-
+
set test "set file, before attach1"
gdb_test_multiple "file $binfile" "$test" {
-re "Load new symbol table from.*y or n. $" {
# Verify that we can "see" the variable "should_exit" in the
# program, and that it is zero.
-
+
gdb_test "print should_exit" " = 0" "after attach1, print should_exit"
# Detach the process.
-
+
gdb_test "detach" \
"Detaching from program: .*$escapedbinfile, process $testpid\r\n\\\[Inferior $decimal \\(.*\\) detached\\\]" \
"attach1 detach"
# Wait a bit for gdb to finish detaching
-
+
exec sleep 5
# Purge the symbols from gdb's brain. (We want to be certain the
# next attach, which won't be preceded by a "file" command, is
# really getting the executable file without our help.)
-
+
set old_timeout $timeout
- set timeout 15
+ set timeout 15
set test "attach1, purging symbols after detach"
gdb_test_multiple "file" "$test" {
-re "No executable file now.*Discard symbol table.*y or n. $" {
# Verify that we can attach to the process just by giving the
# process ID.
-
+
set test "attach2, with no file"
set found_exec_file 0
gdb_test_multiple "attach $testpid" "$test" {
# Verify that we can attach to the process, and find its a.out
# when we're cd'd to some directory that doesn't contain the
# a.out. (We use the source path set by the "dir" command.)
-
+
gdb_test "dir [standard_output_file {}]" "Source directories searched: .*" \
"set source path"
"$test" \
"Kill the program being debugged.*y or n. $" \
"y"
-
+
# Another "don't leave a process around"
kill_wait_spawned_process $test_spawn_id
}
set testpid [spawn_id_get_pid $test_spawn_id]
# Attach
-
+
gdb_test "file $binfile2" ".*" "load file"
set test "attach call"
gdb_test_multiple "attach $testpid" "$test" {
}
# See if other registers are problems
-
+
set test "info other register"
gdb_test_multiple "i r r3" "$test" {
-re "warning: reading register.*$gdb_prompt $" {
}
# Get rid of the process
-
+
gdb_test "p should_exit = 1"
gdb_continue_to_end
-
+
# Be paranoid
-
+
kill_wait_spawned_process $test_spawn_id
}
gdb_test "y" "Reading symbols from .*attach.*" $gdb_test_name
}
}
-
+
gdb_test "detach" "Detaching from program: .* detached\\\]" "$test detach attach initial exec-file"
# Make it the working directory for the inferior.
set coredir [standard_output_file coredir.[getpid]]
file mkdir $coredir
-set core_works [expr [isnative] && ! [is_remote target]]
+set core_works [expr {[isnative] && ! [is_remote target]}]
# Run GDB on the test program up to where it will dump core.
# Are we using DWARF debug format?
get_debug_format
-set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]]
+set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}]
# Find line numbers for use in tests.
set line_0 [gdb_get_line_number "prologue location"]
return
}
- set has_re [expr ![string equal $re ""]]
+ set has_re [expr {![string equal $re ""]}]
if { ! $has_re } {
set re "\$FOOBAR^"
}
}
set file_arg $binfile
-if [is_remote host] {
+if {[is_remote host]} {
set file_arg [remote_download host $file_arg]
}
# Try to match:
# PS1="gdb-subshell$ "^M
- # $ gdb-subshell$
+ # $ gdb-subshell$
# or:
# PS1="gdb-subshell$ "^M
# sh-4.4$ PS1="gdb-subshell$ "^M
- # gdb-subshell$
+ # gdb-subshell$
set gotit 0
set test "spawn shell"
gdb_expect {
pass "$test"
}
}
- if ![is_remote host] {
+ if {![is_remote host]} {
remote_close host
}
}
global gdb_prompt
global shell_prompt_re
- if ![spawn_shell] {
+ if {![spawn_shell]} {
return
}
}
set test "terminal settings preserved"
- if $stty_supported {
+ if {$stty_supported} {
run_stty "stty after" stty_after
gdb_assert [string equal $stty_before $stty_after] $test
global gdb_prompt
global shell_prompt_re
- if ![spawn_shell] {
+ if {![spawn_shell]} {
return
}
send_quit_command "quit gdb"
set test "terminal settings preserved"
- if $stty_supported {
+ if {$stty_supported} {
run_stty "stty after" stty_after
gdb_assert [string equal $stty_before $stty_after] $test
# On Windows, GDB's "shell" command spawns cmd.exe, which does not
# understand PPID. So we're out of luck even if the test harness
# uses a remote_exec shell with a working "kill" command.
- if [ishost *-*-mingw*] {
+ if {[ishost *-*-mingw*]} {
return
}
- if ![spawn_shell] {
+ if {![spawn_shell]} {
return
}
}
}
- if !$gdb_killed {
+ if {!$gdb_killed} {
send_quit_command "quit gdb"
}
}
set test "terminal settings preserved"
- if $stty_supported {
+ if {$stty_supported} {
run_stty "stty after" stty_after
gdb_assert [string equal $stty_before $stty_after] $test
#
# This test then loads the shared library's symbol table (and other
# debug info) using the 'add-symbol-file' command. While doing this,
-# the test observes and records the BFD errors that were output.
+# the test observes and records the BFD errors that were output.
# Finally, data collected while adding the shared library symbols are
# examined to make sure that identical messages were suppressed while
# also making sure that at least two messages have been printed.
set objcopy_program [gdb_find_objcopy]
# Extract the .dynsym and .dynstr section from the shared object.
-if { [catch "exec $objcopy_program \
- --dump-section .dynsym=${binfile_lib}.dynsym \
- --dump-section .dynstr=${binfile_lib}.dynstr \
- ${binfile_lib}" output] } {
+if { [catch {exec $objcopy_program \
+ --dump-section .dynsym=${binfile_lib}.dynsym \
+ --dump-section .dynstr=${binfile_lib}.dynstr \
+ ${binfile_lib}} output] } {
untested "failed objcopy dump-section"
verbose -log "objcopy output: $output"
return -1
} else {
set sz 16
}
-set cnt [expr $dynsym_len / $sz]
+set cnt [expr {$dynsym_len / $sz}]
# Create 32-bit patterns (bad offsets) to write into the st_name area.
if { $is_big_endian } {
- set pat(0) [binary format I [expr $dynstr_len + 1000]]
- set pat(1) [binary format I [expr $dynstr_len + 2000]]
+ set pat(0) [binary format I [expr {$dynstr_len + 1000}]]
+ set pat(1) [binary format I [expr {$dynstr_len + 2000}]]
} else {
- set pat(0) [binary format i [expr $dynstr_len + 1000]]
- set pat(1) [binary format i [expr $dynstr_len + 2000]]
+ set pat(0) [binary format i [expr {$dynstr_len + 1000}]]
+ set pat(1) [binary format i [expr {$dynstr_len + 2000}]]
}
# Mangle st_name for the symbols following the first (STN_UNDEF) entry.
while { [incr cnt -1] > 0 } {
seek $dynsym_fp [incr off $sz]
- puts $dynsym_fp $pat([expr $cnt % 2])
+ puts $dynsym_fp $pat([expr {$cnt % 2}])
}
close $dynsym_fp
# Replace .dynsym section in shared object with the mangled version.
-if { [catch "exec $objcopy_program \
- --update-section .dynsym=${binfile_lib}.dynsym \
- ${binfile_lib}" output] } {
+if { [catch {exec $objcopy_program \
+ --update-section .dynsym=${binfile_lib}.dynsym \
+ ${binfile_lib}} output] } {
untested "failed objcopy update-section"
verbose -log "objcopy output: $output"
return -1
gdb_test "print b64" ".*2 = 2\.25.*" "the original value of b64 is 2.25"
gdb_test "print b128" ".*3 = 3\.375.*" "the original value of b128 is 3.375"
-# Test that gdb could correctly recognize float constant expression with a suffix.
+# Test that gdb could correctly recognize float constant expression with a suffix.
gdb_test "print b32=-1.5f" ".*4 = -1\.5.*" "try to change b32 to -1.5 with 'print b32=-1.5f'"
gdb_test "print b64=-2.25f" ".*5 = -2\.25.*" "try to change b64 to -2.25 with 'print b64=-2.25f'"
gdb_test "print b128=-3.375l" ".*6 = -3\.375.*" "try to change b128 to -3.375 with 'print b128=-3.375l'"
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
# I/O bandwidth.
if { [istarget "*-*-*bsd*"]
- || [istarget "*-*-solaris*"]
- || [istarget "*-*-darwin*"]
+ || [istarget "*-*-solaris*"]
+ || [istarget "*-*-darwin*"]
|| [istarget "*-*-cygwin*"] } {
untested "kernel lacks sparse corefile support (PR gdb/1551)"
return
global srcfile
gdb_breakpoint break5
- if [gdb_test "cont" "Break.*break5 \\(\\) at .*$srcfile:$decimal.*" "continuing to break5"] {
+ if {[gdb_test "cont" "Break.*break5 \\(\\) at .*$srcfile:$decimal.*" "continuing to break5"]} {
return
}
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# This file was adapted from bitfields.exp by Paul Hilfinger
+# This file was adapted from bitfields.exp by Paul Hilfinger
# (Hilfinger@gnat.com)
#
-# Tests for bit-fields that do not fit in type (unsigned) int, but do fit
+# Tests for bit-fields that do not fit in type (unsigned) int, but do fit
# in type (unsigned) long long. We perform essentially the same tests as
# in bitfields.c, which considers only bit-fields that are <= 9 bits long.
#
set has_signed_bitfields 1
#
-# Continue to expected breakpoint at FUNCTION. Append TAG to make pass/fail
+# Continue to expected breakpoint at FUNCTION. Append TAG to make pass/fail
# messages (to make them unique). Suppress tests on failure.
#
proc continue_test { function tag } {
gdb_breakpoint $function
continue_test $function "#0"
}
-
+
#
# Test bitfield locating and uniqueness.
# tests expressions with bitwise operators, and some
# logical operators
# Does not use a target program
-#
+#
#
set sign_prefix "u"
}
foreach bits {8 16 32 64} {
+ # tclint-disable-next-line command-args
proc make_${sign_prefix}int${bits} {lang val} \
"make_val_cast \$lang $signed $bits \$val"
}
# We now have the breakpoint instruction stored in 'buffer'. Poke it
# to memory manually.
- set count [expr $address_after_bp - $address_bp]
+ set count [expr {$address_after_bp - $address_bp}]
for {set i 0} {$i < $count} {incr i} {
set test "p /x addr_bp\[$i\] = buffer\[$i\]"
gdb_test_multiple $test $test {
gdb_test "next" "after next .*"
}
- if ![target_info exists gdb,nosignals] {
+ if {![target_info exists gdb,nosignals]} {
with_test_prefix "continue trips on nested permanent bp" {
delete_breakpoints
gdb_test "p counter" " = 2"
}
- if [can_single_step_to_signal_handler] {
+ if {[can_single_step_to_signal_handler]} {
with_test_prefix "stepi signal with handler" {
delete_breakpoints
global testfile
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
set line_num [gdb_get_line_number "loop-line" ${testfile}.c]
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
return -1
}
-if ![runto callee] {
+if {![runto callee]} {
return 0
}
}
}
-if ![runto "*$entry"] {
+if {![runto "*$entry"]} {
return
}
gdb_test {p/x $pc} " = $entry"
continue
}
- if [is_remote host] {
+ if {[is_remote host]} {
set arg [remote_download host $binfile]
if { $arg == "" } {
untested "download failed"
# isfile returns 1 even for symlinks to files.
set retval $debug_root/$exec_build_id_debug
- if [file isfile $retval] {
+ if {[file isfile $retval]} {
return $retval
}
set retval $exec_dir/$debug_base
- if [file isfile $retval] {
+ if {[file isfile $retval]} {
return $retval
}
set retval $exec_dir/.debug/$debug_base
- if [file isfile $retval] {
+ if {[file isfile $retval]} {
return $retval
}
set retval $debug_root/$exec_dir/$debug_base
- if [file isfile $retval] {
+ if {[file isfile $retval]} {
return $retval
}
return ""
set strip_program [transform strip]
set command "exec $strip_program --strip-debug $dest"
verbose -log "command is $command"
- if [catch $command] {
+ if {[catch {{*}$command}]} {
fail $test
return 0
} else {
}
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ if {![regexp {^(NONE|FOUND-.*)$} $displacement]} {
fail $test_displacement
}
pass $test
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ if {![regexp {^(NONE|FOUND-.*)$} $displacement]} {
fail $test_displacement
}
gdb_test_no_output "set verbose off"
pass $test
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ if {![regexp {^(NONE|FOUND-.*)$} $displacement]} {
fail $test_displacement
}
gdb_test_no_output "set verbose off"
# `libfunc' is present in the backtrace and therefore the
# displacement has been guessed right.
- if [prelink$relink $relink_args [file tail $exec]] {
+ if {[prelink$relink $relink_args [file tail $exec]]} {
# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
test_attach_gdb $exec $pid $displacement "attach-relink$relink"
}
# prevents that from happening. So turn it off.
gdb_test "set disable-randomization off"
- if $ifmain {
+ if {$ifmain} {
gdb_test_no_output "set args segv"
} else {
global binfile_test
gdb_test_no_output "set verbose on"
}
- if $ifmain {
+ if {$ifmain} {
reach "main" continue "NONE"
reach "libfunc" continue "NONE"
reach $solib_bp "run" $displacement 2
gdb_test_no_output "set verbose off"
- if $ifmain {
+ if {$ifmain} {
test_core $file $displacement
test_attach $file $displacement
}
- if !$trynosym {
+ if {!$trynosym} {
return
}
set escapedfile [string_to_regexp $file]
gdb_test "exec-file $file" "exec-file $escapedfile" "load"
- if $ifmain {
+ if {$ifmain} {
reach $solib_bp run $displacement 3
set entrynohex ""
pass $test
}
}
- if ![regexp {^(NONE|FOUND-.*)$} $displacement] {
+ if {![regexp {^(NONE|FOUND-.*)$} $displacement]} {
fail $test_displacement
}
}
file_copy $interp_system $interp
# Never call strip-debug before unprelink:
# prelink: ...: Section .note.gnu.build-id created after prelinking
- if ![prelinkNO $interp] {
+ if {![prelinkNO $interp]} {
continue
}
strip_debug $interp
set test "eu-unstrip unprelinked:[file tail $interp_system] + [file tail $interp_system_debug] to [file tail $interp]"
set command "exec eu-unstrip -o $interp $interp ${interp}.debug"
verbose -log "command is $command"
- if [catch $command] {
+ if {[catch {{*}$command}]} {
setup_xfail *-*-*
fail $test
continue
} elseif {$ldsepdebug == "SEP" && $interp_system_debug == ""} {
file_copy $interp_system $interp
# eu-unstrip: DWARF data in '...' not adjusted for prelinking bias; consider prelink -u
- if ![prelinkNO $interp] {
+ if {![prelinkNO $interp]} {
continue
}
gdb_gnu_strip_debug $interp
}
if {$ldsepdebug == "SEP"} {
- if ![prelinkNO "${interp}.debug"] {
+ if {![prelinkNO "${interp}.debug"]} {
continue
}
} else {
file delete "${interp}.debug"
}
- if ![prelink$ldprelink $interp "[file tail $interp], second time"] {
+ if {![prelink$ldprelink $interp "[file tail $interp], second time"]} {
continue
}
}
test_ld $interp 0 [expr {$ldsepdebug == "NO"}] $displacement
- if ![file_copy $interp $interp_saved] {
+ if {![file_copy $interp $interp_saved]} {
continue
}
gdb_reload
}
- if ![runto start] {
+ if {![runto start]} {
return
}
# remove the memory breakpoint afterwards should fail, and GDB
# should warn the user about it.
set pagesize [get_integer_valueof "pg_size" 0]
- set align_addr [expr $bp_addr - $bp_addr % $pagesize]
+ set align_addr [expr {$bp_addr - $bp_addr % $pagesize}]
set munmap_prototype "int (*) (void *, size_t)"
set munmap_expr "(($munmap_prototype) munmap) ($align_addr, $pagesize)"
delete_breakpoints
- if [istarget "mips*tx39-*"] {
+ if {[istarget "mips*tx39-*"]} {
set timeout 60
}
# We used to set timeout here for all other targets as well. This
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set hw_step [probe_target_hardware_step]
-if ![get_function_bounds "main" main_lo main_hi] {
+if {![get_function_bounds "main" main_lo main_hi]} {
# Can't do the following tests if main's bounds are unknown.
return -1
}
}
# We need to start the inferior to place the breakpoints in the memory at all.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test_multiple "disass main" $test {
-re $match {
set got $expect_out(1,string)
- if [string equal -nocase $orig $got] {
+ if {[string equal -nocase $orig $got]} {
pass $test
} else {
fail $test
gdb_assert { $saw_fatal_msg }
gdb_assert { $saw_bt_start }
gdb_assert { $saw_bt_end }
- gdb_assert { [expr $internal_error_msg_count == 2] }
+ gdb_assert { [expr {$internal_error_msg_count == 2}] }
}
-re "$gdb_prompt $" {
# GDB should terminate, we should never get back to
set oldtimeout $timeout
-set timeout [expr "$timeout + 60"]
+set timeout [expr {$timeout + 60}]
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
"aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ" \
"aZaZaZaZaZaZaZaZaZa"]
-if ![gdb_skip_stdio_test "print_char_array(char_array)"] {
+if {![gdb_skip_stdio_test "print_char_array(char_array)"]} {
gdb_test_stdio "print print_char_array(char_array)" $array_c_re
}
"Temporary breakpoint.*file.*$srcfile, line $stop_line.*" \
"tbreakpoint at tbreak2"
-if ![gdb_skip_stdio_test "continue to tbreak2"] {
+if {![gdb_skip_stdio_test "continue to tbreak2"]} {
set gdb_re \
[multi_line \
"main.*at.*:\[0-9\]+" \
}
# I am disabling this test, because it takes too long. I verified by
-# hand that it works, feel free to check for yourself.
+# hand that it works, feel free to check for yourself.
#call print_all_arrays(integer_array, char_array, float_array, double_array)
#send_gdb "print print_all_arrays(integer_array, char_array, float_array, double_array)\n"
#gdb_expect {
"step inside print_all_arrays"
#step -over
-if ![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"] {
+if {![gdb_skip_stdio_test "next over print_int_array in print_all_arrays"]} {
set stop_line [gdb_get_line_number "-next1-"]
gdb_test_stdio "next" \
"array_i :" \
#call sum_array_print(10, *list1, *list2, *list3, *list4)
-if ![gdb_skip_stdio_test "print sum_array_print(...)"] {
+if {![gdb_skip_stdio_test "print sum_array_print(...)"]} {
gdb_test_stdio "print sum_array_print(10, *list1, *list2, *list3, *list4)" \
[multi_line \
#step over
set stop_line [gdb_get_line_number "-next2-"]
-if ![gdb_skip_stdio_test "next to next2"] {
+if {![gdb_skip_stdio_test "next to next2"]} {
gdb_test_stdio "next" \
"BYE BYE FOR NOW" \
"$stop_line.*printf\\(.VERY GREEN GRASS.n.\\);.*" \
#call print_array_rep(\*list1, \*list2, \*list3)
-if ![gdb_skip_stdio_test "print print_array_rep(...)"] {
+if {![gdb_skip_stdio_test "print print_array_rep(...)"]} {
gdb_test_stdio "print print_array_rep(\*list1, \*list2, \*list3)" \
"Contents of linked list3:"
}
"Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
"tbreakpoint at tbreak6"
-if ![gdb_skip_stdio_test "continuing to tbreak6"] {
+if {![gdb_skip_stdio_test "continuing to tbreak6"]} {
gdb_test_stdio "continue" \
"Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t" \
"main \\(\\) at .*$srcfile:$stop_line.*c = 0.*" \
gdb_test "continue" ".*" ""
}
-#call print_small_structs(*struct1, *struct2, *struct3, *struct4,
-# *flags, *flags_combo, *three_char, *five_char,
+#call print_small_structs(*struct1, *struct2, *struct3, *struct4,
+# *flags, *flags_combo, *three_char, *five_char,
# *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
if {$allow_float_test && \
"\[0-9\]+ = void"
-#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098,
+#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098,
# 3.14, -5678.12345, -0.11111111, 216.97065)
if {$allow_float_test && \
set ws "\[\n\r\t \]+"
-#call print_small_structs(struct1, struct2, struct3, struct4, flags,
-# flags_combo, three_char, five_char, int_char_combo,
+#call print_small_structs(struct1, struct2, struct3, struct4, flags,
+# flags_combo, three_char, five_char, int_char_combo,
# d1, d2, d3, f1, f2, f3)
if {$allow_float_test && \
"Temporary breakpoint.* file .*$srcfile, line $stop_line.*" \
"tbreakpoint at tbreak8"
-if ![gdb_skip_stdio_test "continuing to tbreak8"] {
+if {![gdb_skip_stdio_test "continuing to tbreak8"]} {
gdb_test_stdio "continue" \
"Contents of two_floats_t:" \
".*main \\(\\) at.*$srcfile:$stop_line.*$stop_line.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
"step into init_bit_flags_combo"
#call print_bit_flags_combo(*bit_flags_combo)
-if ![gdb_skip_stdio_test "continuing at step3"] {
+if {![gdb_skip_stdio_test "continuing at step3"]} {
gdb_test_stdio "print print_bit_flags_combo(*bit_flags_combo)" \
"alpha.*gamma.*epsilon.*ch1: y.*ch2: n"
}
#call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
-if ![gdb_skip_stdio_test "print sum_struct_print(...)"] {
+if {![gdb_skip_stdio_test "print sum_struct_print(...)"]} {
gdb_test_stdio "print sum_struct_print(10,*struct1,*struct2,*struct3,*struct4)" \
"Sum of the 4 struct values and seed :\[ \t\n\r\]+218"
}
#call print_struct_rep(*struct1, *struct2, *struct3)
-if ![gdb_skip_stdio_test "print print_struct_rep(...)"] {
+if {![gdb_skip_stdio_test "print print_struct_rep(...)"]} {
gdb_test_stdio "print print_struct_rep(*struct1, *struct2, *struct3)" \
[multi_line \
"Contents of struct1: " \
]
}
-if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
+if {![gdb_skip_stdio_test "print print_one_large_struct(...)"]} {
gdb_test_stdio "print print_one_large_struct(*list1)" \
" 4 1"
}
}
-if ![gdb_skip_stdio_test "print print_struct_rep(*struct1)"] {
+if {![gdb_skip_stdio_test "print print_struct_rep(*struct1)"]} {
print_struct_call "print_struct_rep(*struct1)" \
".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+" \
".\[0-9\]+ = \\{value = 5, head = 0\\}"
}
-if ![gdb_skip_stdio_test "print print_one_large_struct(...)"] {
+if {![gdb_skip_stdio_test "print print_one_large_struct(...)"]} {
print_struct_call "print_one_large_struct(*list1)" \
".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+" \
".\[0-9\]+ = \\{next_index = \\{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\}, values = \\{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\\}, head = 0\\}"
".\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"] {
+if {![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"]} {
print_struct_call "print_bit_flags_char(*cflags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
".\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\000', gamma = 1 '\\\\001', delta = 0 '\\\\000', epsilon = 1 '\\\\001', omega = 0 '\\\\000'\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"] {
+if {![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"]} {
print_struct_call "print_bit_flags_short(*sflags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
".\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags(*flags)"] {
+if {![gdb_skip_stdio_test "print print_bit_flags(*flags)"]} {
print_struct_call "print_bit_flags(*flags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+" \
".\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"] {
+if {![gdb_skip_stdio_test "print print_bit_flags_combo(*flags_combo)"]} {
print_struct_call "print_bit_flags_combo(*flags_combo)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+" \
".\[0-9\]+ = \\{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\\}"
}
-if ![gdb_skip_stdio_test "print print_three_chars(*three_chars)"] {
+if {![gdb_skip_stdio_test "print print_three_chars(*three_chars)"]} {
print_struct_call "print_three_chars(*three_char)" \
".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+" \
".\[0-9\]+ = \\{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\\}"
}
-if ![gdb_skip_stdio_test "print print_five_chars(*five_chars)"] {
+if {![gdb_skip_stdio_test "print print_five_chars(*five_chars)"]} {
print_struct_call "print_five_chars(*five_char)" \
".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+" \
".\[0-9\]+ = \\{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\\}"
}
-if ![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"] {
+if {![gdb_skip_stdio_test "print print_int_char_combo(*int_char_combo)"]} {
print_struct_call "print_int_char_combo(*int_char_combo)" \
".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+" \
".\[0-9\]+ = \\{int1 = 13, ch1 = 33 '!'\\}"
# Check that GDB can always extract a scalar-return value from an
# inferior function call. Since GDB always knows the location of
# an inferior function call's return value these should never fail
-
+
# Implemented by calling the parameterless function "fun" and then
# examining the return value printed by GDB.
set test "value foo returned; ${tests}"
gdb_test_multiple "p/c L" "${test}" {
-re " = 49 '1'.*${gdb_prompt} $" {
- if $return_value_unknown {
+ if {$return_value_unknown} {
# This contradicts the above claim that GDB didn't
# know the location of the return-value.
fail "${test}"
}
}
-re " = 90 .*${gdb_prompt} $" {
- if $return_value_unknown {
+ if {$return_value_unknown} {
# The struct return case. Since any modification
# would be by reference, and that can't happen, the
# value should be unmodified and hence Z is expected.
}
}
-re " = 57 .*${gdb_prompt} $" {
- if $return_value_unknown {
+ if {$return_value_unknown} {
# The struct return case.
# The return value is stored on the stack, and since GDB
# didn't override it, it still has value that was stored
}
}
-re ".*${gdb_prompt} $" {
- if $return_value_unimplemented {
+ if {$return_value_unimplemented} {
# What a surprise. The architecture hasn't implemented
# return_value, and hence has to fail.
kfail "$test" gdb/1444
fail "$test"
}
}
- }
-
+ }
+
# Check that a "finish" works.
# This is almost but not quite the same as "call struct funcs".
set test "value foo finished; ${tests}"
gdb_test_multiple "p/c" "${test}" {
-re " = 49 '1'\[\r\n\]+${gdb_prompt} $" {
- if $finish_value_unknown {
+ if {$finish_value_unknown} {
# This contradicts the above claim that GDB didn't
# know the location of the return-value.
fail "${test}"
}
-re " = 90 'Z'\[\r\n\]+${gdb_prompt} $" {
# The value didn't get found. This is "expected".
- if $finish_value_unknown {
+ if {$finish_value_unknown} {
pass "${test}"
} else {
# This contradicts the above claim that GDB did
" = \"test string\".*"
#print str_func1(s)
-if ![gdb_skip_stdio_test "print str_func1(s)"] {
+if {![gdb_skip_stdio_test "print str_func1(s)"]} {
gdb_test_stdio "print str_func1(s)" \
"first string arg is: test string" \
"\"test string\".*"
}
#print str_func1("test string")
-if ![gdb_skip_stdio_test "print str_func1(teststring)"] {
+if {![gdb_skip_stdio_test "print str_func1(teststring)"]} {
gdb_test_stdio "print str_func1(\"test string\")" \
"first string arg is: test string" \
"\"test string\".*"
}
#call str_func1(s)
-if ![gdb_skip_stdio_test "call str_func1(s)"] {
+if {![gdb_skip_stdio_test "call str_func1(s)"]} {
gdb_test_stdio "call str_func1(s)" \
"first string arg is: test string" \
"\"test string\".*"
}
#call str_func1("test string")
-if ![gdb_skip_stdio_test "call str_func1 (...)"] {
+if {![gdb_skip_stdio_test "call str_func1 (...)"]} {
gdb_test_stdio "call str_func1(\"test string\")" \
"first string arg is: test string" \
"\"test string\".*"
}
#print str_func1(buf)
-if ![gdb_skip_stdio_test "print str_func1(buf)"] {
+if {![gdb_skip_stdio_test "print str_func1(buf)"]} {
gdb_test_stdio "print str_func1(buf)" \
"first string arg is: test string" \
"\"test string\".*"
}
#call str_func1(buf)
-if ![gdb_skip_stdio_test "call str_func1(buf)"] {
+if {![gdb_skip_stdio_test "call str_func1(buf)"]} {
gdb_test_stdio "call str_func1(buf)" \
"first string arg is: test string" \
"\"test string\".*"
}
#print str_func("a","b","c","d","e","f","g")
-if ![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"] {
+if {![gdb_skip_stdio_test "print str_func(a,b,c,d,e,f,g)"]} {
gdb_test_stdio "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
"first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+" \
"= \"abcdefg\".*"
}
#call str_func("a","b","c","d","e","f","g")
-if ![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"] {
+if {![gdb_skip_stdio_test "call str_func(a,b,c,d,e,f,g)"]} {
gdb_test_stdio "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" \
"first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+" \
"= \"abcdefg\".*"
}
#print str_func(s,s,s,s,s,s,s)
-if ![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"] {
+if {![gdb_skip_stdio_test "print str_func(s,s,s,s,s,s,s,s)"]} {
gdb_test_stdio "print str_func(s,s,s,s,s,s,s)" \
"first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+" \
"\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
}
#call str_func(s,s,s,s,s,s,s)
-if ![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"] {
+if {![gdb_skip_stdio_test "call str_func(s,s,s,s,s,s,s,s)"]} {
gdb_test_stdio "call str_func(s,s,s,s,s,s,s)" \
"first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+" \
"\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*"
# We still want to test non-prototype functions for now, which is why
# we disable compilers warning about them.
set compile_flags {debug additional_flags=-Wno-deprecated-non-prototype}
-if [support_complex_tests] {
+if {[support_complex_tests]} {
lappend compile_flags "additional_flags=-DTEST_COMPLEX"
}
gdb_test "p t_int_double(99, 99.0)" " = 1"
}
- if [support_complex_tests] {
+ if {[support_complex_tests]} {
gdb_test "p t_float_complex_values(fc1, fc2)" " = 1"
gdb_test "p t_float_complex_values(fc3, fc4)" " = 0"
"call inferior func with struct - returns double"
}
- if [support_complex_tests] {
+ if {[support_complex_tests]} {
gdb_test "p t_structs_fc(struct_val1)" ".*= 3 \\+ 3i" \
"call inferior func with struct - returns float _Complex"
exp_continue
}
-re "^bspstore\[ \t\]+\[^\r\n\]+\r\n" {
- if [istarget "ia64-*-*"] {
+ if {[istarget "ia64-*-*"]} {
# Filter out bspstore which is specially tied to bsp,
# giving spurious differences.
} else {
exp_continue
}
-re "^pstate\[ \t\]+\[^\r\n\]+\r\n" {
- if [istarget "sparc64-*-linux-gnu"] {
+ if {[istarget "sparc64-*-linux-gnu"]} {
# Filter out the pstate register, since in sparc64
# targets the Linux kernel disables pstate.PEF when
# returning from traps, giving spurious differences.
exp_continue
}
-re "^last_break\[ \t\]+\[^\r\n\]+\r\n" {
- if [istarget "s390*-*-*"] {
+ if {[istarget "s390*-*-*"]} {
# Filter out last_break which is read-only,
# giving spurious differences.
} else {
exp_continue
}
-re "^\(?:cycle\|instret\)\[ \t\]+\[^\r\n\]+\r\n" {
- if [istarget "riscv*-*-*"] {
+ if {[istarget "riscv*-*-*"]} {
# Filter out the cycle counter and instructions
# retired counter CSRs which are read-only, giving
# spurious differences.
"The program being debugged stopped while.*" \
"stop at breakpoint in call dummy function"
gdb_test "continue" "Continuing.*" "continue from call dummy breakpoint"
- if ![gdb_test "bt 2" \
- "#0 main.*" \
- "bt after continuing from call dummy breakpoint"] then {
+ if {![gdb_test "bt 2" \
+ "#0 main.*" \
+ "bt after continuing from call dummy breakpoint"]} then {
set new_reg_content [fetch_all_registers \
"register contents after stop in call dummy"]
if {$old_reg_content == $new_reg_content} {
gdb_test "finish" \
"Value returned is .* = 9" \
"finish from call dummy breakpoint returns correct value"
- if ![gdb_test "bt 2" \
- "#0 main.*" \
- "bt after finishing from call dummy breakpoint"] then {
+ if {![gdb_test "bt 2" \
+ "#0 main.*" \
+ "bt after finishing from call dummy breakpoint"]} then {
set new_reg_content [fetch_all_registers \
"register contents after finish in call dummy"]
if {$old_reg_content == $new_reg_content} {
# with a value, make sure we are back at main with the same register contents.
gdb_test "print add(4,5)" "The program being debugged stopped while.*" \
"call function causing a breakpoint and then do a return"
- if ![gdb_test "return 7" \
- "#0 main.*" \
- "back at main after return from call dummy breakpoint" \
- "Make add return now. .y or n.*" \
- "y"] then {
+ if {![gdb_test "return 7" \
+ "#0 main.*" \
+ "back at main after return from call dummy breakpoint" \
+ "Make add return now. .y or n.*" \
+ "y"]} then {
set new_reg_content [fetch_all_registers \
"register contents after return in call dummy"]
if {$old_reg_content == $new_reg_content} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
with_test_prefix "$fork_kind" {
clean_restart $testfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "print return_one()" " = 1"
-if ![target_info exists gdb,noinferiorio] {
+if {![target_info exists gdb,noinferiorio]} {
# Clean up the breakpoint state.
delete_breakpoints
# Check for entry/return across the execve, making sure that the
# syscall_state isn't lost when turning into a new process.
insert_catch_syscall_with_arg "execve"
- if [check_continue "execve"] {
+ if {[check_continue "execve"]} {
# The check_continue test generates an XFAIL on Powerpc. In
# that case, gdb is already at main so don't do the continue.
set var_name [string tolower "${target_charset}_string"]
regsub -all -- "\[^a-z0-9_\]" $var_name "_" var_name
}
-
+
# Compute a regexp matching the results we expect. This is static,
# but it's easier than writing it out.
regsub -all "." "abfnrtv" "(\\\\&|x)" escapes
}
}
- # Try printing a character escape that doesn't exist. We should
+ # Try printing a character escape that doesn't exist. We should
# get the unescaped character, in the target character set.
gdb_test "print $L'\\q'" " = \[0-9-\]+ $L'q'" \
"print escape that doesn't exist in $target_charset"
set ucs2_ok [expr {[get_sizeof char16_t 99] == 2}]
-if ![valid_host_charset "UTF-16"] {
+if {![valid_host_charset "UTF-16"]} {
verbose -log "Disabling UTF-16 tests."
set ucs2_ok 0
}
}
-gdb_exit
+gdb_exit
# Author: Paul N. Hilfinger (Hilfinger@gnat.com)
-# Test that GDB cleans up properly after errors that result when a
-# breakpoint is reset.
+# Test that GDB cleans up properly after errors that result when a
+# breakpoint is reset.
standard_testfile .c
gdb_run_cmd
expect_to_stop_here "first time"
-
+
gdb_continue_to_end "breakpoint first time through"
# Now we recompile the executable, but without a variable named "var1", first
# waiting to insure that even on fast machines, the file modification times
-# are distinct. This will force GDB to reload the file on the
-# next "run" command, causing an error when GDB tries to tries to reset
+# are distinct. This will force GDB to reload the file on the
+# next "run" command, causing an error when GDB tries to tries to reset
# the breakpoint.
sleep 2
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var2}] != "" } {
-# Complication: Since GDB generally holds an open file descriptor on the
-# executable at this point, there are some systems in which the
-# re-compilation will fail. In such cases, we'll consider the test
+# Complication: Since GDB generally holds an open file descriptor on the
+# executable at this point, there are some systems in which the
+# re-compilation will fail. In such cases, we'll consider the test
# (vacuously) passed providing that re-running it succeeds as before.
gdb_run_cmd
"type = @data enum misordered" \
"(enum misordered @data)"
-#
+#
# Pointers
#
delete_breakpoints
gdb_test "break factorial if value == 5" "Breakpoint.*at.*"
-# infrun_breakpoint_command_test - This test was broken into two parts
+# infrun_breakpoint_command_test - This test was broken into two parts
# to get around a synchronization problem in expect.
# part1: issue the gdb command "commands"
# part2: send the list of commands
set expected "nargs=$nargs:"
for {set i 1} {$i <= $nargs} {incr i} {
- append expected " " [expr 2 * $i]
+ append expected " " [expr {2 * $i}]
}
gdb_test $cmd $expected "execute command"
gdb_test_multiple "printf \"Now the value is %d\\n\", value" $test {
-re "^printf.*value\r\n>$" {
gdb_test_multiple "end" $test {
- -re "^end\r\n$gdb_prompt $" {
+ -re "^end\r\n$gdb_prompt $" {
pass $test
}
}
gdb_test "p 5" ".\[0-9\]* = 5.*" "deprecated warning goes away /1/"
gdb_test_no_output "maintenance deprecate p \"new_p\"" "maintenance deprecate p \"new_p\" /2/"
- gdb_test_no_output "maintenance deprecate print \"new_print\""
+ gdb_test_no_output "maintenance deprecate print \"new_print\""
gdb_test "p 5" \
"Warning: command 'print' \\(p\\) is deprecated.*Use 'new_print'.*" \
"both alias and command are deprecated"
# one command that deletes this breakpoint.
gdb_test "break factorial" \
"Breakpoint \[0-9\]+ at .*: file .*run.c, line \[0-9\]+\."
-
+
gdb_test_multiple "commands" "begin commands" {
-re "Type commands for breakpoint.*>$" {
pass "begin commands"
}
# Come up with different value.
- set patch [expr 255 - $orig]
+ set patch [expr {255 - $orig}]
# Write PATCH to memory.
set written -1
#
# tests for command completion
#
-# Here are some useful test cases for completion.
+# Here are some useful test cases for completion.
# They should be tested with both M-? and TAB.
#
# "show output-" "radix"
}
# If the directory name contains a '+' we must escape it, adding a backslash.
-# If not, the test below will fail because it will interpret the '+' as a
+# If not, the test below will fail because it will interpret the '+' as a
# regexp operator. We use string_to_regexp for this purpose.
gdb_test "cd ${fullsrcdir}" \
set objcopy_program [gdb_find_objcopy]
set cmd "$objcopy_program --compress-debug-sections $ofile"
verbose "invoking $cmd"
-set result [catch "exec $cmd" output]
+set result [catch {exec {*}$cmd} output]
verbose "result is $result"
verbose "output is $output"
# We now know that the target supports target-side conditional
# evaluation. Now make sure we can force-disable the
# ConditionalBreakpoints RSP feature.
-if [gdb_protocol_is_remote] {
+if {[gdb_protocol_is_remote]} {
gdb_test \
"set remote conditional-breakpoints-packet off" \
"Support for the 'ConditionalBreakpoints' packet on the current remote target is set to \"off\"."
# This file is part of the gdb testsuite
#
-# test of evaluation of conditional expressions, with constants and
+# test of evaluation of conditional expressions, with constants and
# variables. Using the print and the whatis command
# written with the only purpose in mind to cover the holes in the
# eval.c file
set bpnum [get_integer_valueof "\$bpnum" 0 "get bpnum"]
gdb_test_no_output "cond $bpnum a == 999"
-
+
gdb_test "cond $bpnum gibberish" \
"No symbol \"gibberish\" in current context." \
"attempt a bad condition"
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# This test was written by Rich Title.
+# This test was written by Rich Title.
# Purpose is to test conditional breakpoints.
# Modeled after "break.exp".
"Breakpoint.*at.* file .*$srcfile, line.*" \
"breakpoint function"
-#
+#
# test conditional break at function
#
gdb_test "break marker1 if 1==1" \
gdb_test_no_output "delete 3"
-#
+#
# test conditional break at function
#
gdb_test "break marker1 if (1==1)" \
# user instruction, GDB's search finds the second line entry, decides
# that the PC is indeed at the beginning of a source line, and doesn't
# print an address in the breakpoint hit message.
-#
+#
# GCC's Dwarf2 writer, on the other hand, squeezes out duplicate line
# entries, so GDB considers the source line to begin at the start of
# the function's prologue. Thus, if the program stops at the
# Extract addresses of a few consecutive instructions.
set test "get breakpoint addresses"
-if { [gdb_test_multiple "x /[expr $n_insns + 1]i \$pc" $test {
+if { [gdb_test_multiple "x /[expr {$n_insns + 1}]i \$pc" $test {
-re "=> $hex${up_to_nl} ($hex)${up_to_nl} ($hex)${up_to_nl} ($hex)${up_to_nl}$gdb_prompt $" {
for {set i 1} {$i <= $n_insns} {incr i} {
set bp_addrs($i) $expect_out($i,string)
if {[test_compiler_info gcc-2-*]} {
if { ![test_debug_format "HP"] \
&& ![test_debug_format "DWARF \[0-9\]"] } then {
- setup_xfail "*-*-*"
+ setup_xfail "*-*-*"
}
}
}
}
}
-gdb_test "break marker1" "Breakpoint $decimal at .*"
+gdb_test "break marker1" "Breakpoint $decimal at .*"
gdb_test_multiple "cont" "up from marker1" {
-re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
gdb_test_no_output "set displaced-stepping $displaced"
gdb_test_no_output "set breakpoint always-inserted $breakpoint_always_inserted"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# any kind of breakpoint insertion failure. If we can examine
# what's at memory address 0, it is possible that we could also
# execute it.
- if [is_address_zero_readable] {
+ if {[is_address_zero_readable]} {
untested "memory at address 0 is possibly executable"
return
}
}
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
# Determine if GDB dumped the mapping containing the build-id. This
# is done by invoking an external program (eu-unstrip).
-if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefilename" output] == 0 } {
+if { [catch {exec [gdb_find_eu-unstrip] -n --core $corefilename} output] == 0 } {
set line [lindex [split $output "\n"] 0]
set test "gcore dumped mapping with build-id"
verbose -log "corefile is $corefile"
# Check the corefile has a build-id for the executable.
- if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefile" output] == 0 } {
+ if { [catch {exec [gdb_find_eu-unstrip] -n --core $corefile} output] == 0 } {
set line [lindex [split $output "\n"] 0]
set binfile_re (?:[string_to_regexp $progname]|\\\[(?:exe|pie)\\\])
if { ![regexp "^${::hex}\\+${::hex} \[a-f0-9\]+@${::hex}.*$binfile_re$" $line] } {
# length then lets try to make it longer.
set binfile_len [string length $binfile]
if { $binfile_len <= 80 } {
- set extra_len [expr 80 - $binfile_len + 1]
+ set extra_len [expr {80 - $binfile_len + 1}]
set extra_str [string repeat "x" $extra_len]
set new_binfile $binfile$extra_str
remote_exec build "mv $binfile $new_binfile"
"run: sanity check we see the core file"
set test "run: with core"
- if [runto_main] {
+ if {[runto_main]} {
pass $test
} else {
fail $test
return
}
- if [can_spawn_for_attach] {
+ if {[can_spawn_for_attach]} {
set test "attach: spawn sleep"
set res [remote_spawn host "$binfile sleep"]
if { $res < 0 || $res == "" } {
if {[runto_main]} {
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
gdb_load_shlib $libobj1
gdb_load_shlib $libobj2
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto func] {
+if {![runto func]} {
return -1
}
return -1
}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
# Make the dcache line size bigger than the pagesize.
set pagesize [get_integer_valueof "pg_size" -1]
-set linesize [expr $pagesize * 2]
+set linesize [expr {$pagesize * 2}]
gdb_test_no_output "set dcache line-size $linesize" \
"set dcache line size to twice the pagesize"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address"
# test append
-gdb_test "append" "List of \"append\" subcommands:.*"
-gdb_test "append binary" "List of \"append binary\" subcommands:.*"
-gdb_test "append memory" "Missing filename\."
-gdb_test "append value" "Missing filename\."
-gdb_test "append binary memory" "Missing filename\."
-gdb_test "append binary value" "Missing filename\."
-
-if !$use_gdb_stub {
+gdb_test "append" "List of \"append\" subcommands:.*"
+gdb_test "append binary" "List of \"append binary\" subcommands:.*"
+gdb_test "append memory" "Missing filename\."
+gdb_test "append value" "Missing filename\."
+gdb_test "append binary memory" "Missing filename\."
+gdb_test "append binary value" "Missing filename\."
+
+if {!$use_gdb_stub} {
gdb_test_multiple "attach" "attach" {
-re "Argument required .(process-id|program) to attach.*$gdb_prompt $"\
{ pass "attach" }
gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation"
}
-
+
gdb_test "backtrace" "No stack."
# ba and bac are no longer unique command prefixes. So these tests
#test down-silently
gdb_test "down-silently" "No stack."
# test dump
-gdb_test "dump" "List of \"dump\" subcommands:.*"
-gdb_test "dump binary" "List of \"dump binary\" subcommands:.*"
-gdb_test "dump ihex" "List of \"dump ihex\" subcommands:.*"
-gdb_test "dump memory" "Missing filename\."
-gdb_test "dump srec" "List of \"dump srec\" subcommands:.*"
-gdb_test "dump tekhex" "List of \"dump tekhex\" subcommands:.*"
-gdb_test "dump value" "Missing filename\."
-gdb_test "dump binary memory" "Missing filename\."
-gdb_test "dump binary value" "Missing filename\."
-gdb_test "dump ihex memory" "Missing filename\."
-gdb_test "dump ihex value" "Missing filename\."
-gdb_test "dump srec memory" "Missing filename\."
-gdb_test "dump srec value" "Missing filename\."
-gdb_test "dump tekhex memory" "Missing filename\."
-gdb_test "dump tekhex value" "Missing filename\."
+gdb_test "dump" "List of \"dump\" subcommands:.*"
+gdb_test "dump binary" "List of \"dump binary\" subcommands:.*"
+gdb_test "dump ihex" "List of \"dump ihex\" subcommands:.*"
+gdb_test "dump memory" "Missing filename\."
+gdb_test "dump srec" "List of \"dump srec\" subcommands:.*"
+gdb_test "dump tekhex" "List of \"dump tekhex\" subcommands:.*"
+gdb_test "dump value" "Missing filename\."
+gdb_test "dump binary memory" "Missing filename\."
+gdb_test "dump binary value" "Missing filename\."
+gdb_test "dump ihex memory" "Missing filename\."
+gdb_test "dump ihex value" "Missing filename\."
+gdb_test "dump srec memory" "Missing filename\."
+gdb_test "dump srec value" "Missing filename\."
+gdb_test "dump tekhex memory" "Missing filename\."
+gdb_test "dump tekhex value" "Missing filename\."
#test echo
gdb_test_no_output "echo" "echo"
#test enable breakpoints delete
gdb_test "pwd" "Working directory .*"
#test run "r" abbreviation
-if $use_gdb_stub {
+if {$use_gdb_stub} {
# Only extended-remote supports "run".
} else {
gdb_test_multiple "r" "run \"r\" abbreviation" {
}
#test run
-if $use_gdb_stub {
+if {$use_gdb_stub} {
# Only extended-remote supports "run".
} else {
gdb_test_multiple "run" "run" {
{$_linker_namespace_count = 0} \
{$_linker_namespace = <error: No registers.>}\
}
-if [allow_python_tests] {
+if {[allow_python_tests]} {
append show_conv_list \
{
{$_memeq = <internal function _memeq>} \
}
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Preserve the old timeout, and set a new one that should be
# sufficient to avoid timing out during this test.
set oldtimeout $timeout
-set timeout [expr "$timeout + 60"]
+set timeout [expr {$timeout + 60}]
verbose "Timeout is now $timeout seconds" 2
# use this to debug:
# Some coverage stuff
#
-if !$use_gdb_stub {
+if {!$use_gdb_stub} {
gdb_test "kill" ".*The program is not being run.*"
gdb_test "detach" ".*"
gdb_test "run" ".*"
gdb_test_multiple "info shared" "info shared" {
-re "$hex $hex \($::decimal\\s+\)\?Yes \[^\r\n\]*$dso\r\n" {
# use longer form so debug remote does not interfere
- set count [expr $count + 1]
+ set count [expr {$count + 1}]
exp_continue
}
-re "$gdb_prompt " {
standard_testfile
-if [build_executable "failed to prepare" \
- ${testfile} ${srcfile} {debug}] {
+if {[build_executable "failed to prepare" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
standard_testfile
set escapedbinfile [string_to_regexp ${binfile}]
-if [build_executable "failed to prepare for dprintf-detach" \
- ${testfile} ${srcfile} {debug}] {
+if {[build_executable "failed to prepare for dprintf-detach" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
gdb_test_no_output "set dprintf-style ${dprintf_style}"
gdb_test_no_output "set disconnected-dprintf ${disconnected_dprintf}"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
set dp_location [gdb_get_line_number "Set dprintf here"]
-if [prepare_for_testing "failed to prepare for dprintf with next" \
- ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare for dprintf with next" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile
set executable ${testfile}
-if [build_executable "failed to prepare for dprintf with non-stop" \
- ${testfile} ${srcfile} {debug}] {
+if {[build_executable "failed to prepare for dprintf with non-stop" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
clean_restart ${executable}
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
set dp_location1 [gdb_get_line_number "set dprintf 1 here"]
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# The "call" style depends on having I/O functions available.
-if ![target_info exists gdb,noinferiorio] {
+if {![target_info exists gdb,noinferiorio]} {
with_test_prefix "call" {
test_call
}
}
}
- if !$target_can_dprintf {
+ if {!$target_can_dprintf} {
return
}
}
}
- if $target_can_dprintf {
+ if {$target_can_dprintf} {
gdb_test "continue" "Breakpoint \[0-9\]+, foo .*" "2nd dprintf"
gdb_test_sequence "info breakpoints" "dprintf info" {
# Test that force-disabling the BreakpointCommands RSP feature works
# as expected. dprintf relies on support for target-side breakpoint
# commands --- use it as proxy.
-if [gdb_protocol_is_remote] {
+if {[gdb_protocol_is_remote]} {
gdb_test \
"set remote breakpoint-commands-packet off" \
"Support for the 'BreakpointCommands' packet on the current remote target is set to \"off\"."
global testfile hex srcfile binfile
standard_testfile
-
+
if {[dtrace_build_usdt_test_program] == -1} {
untested "failed to compile"
return -1
clean_restart
gdb_load $binfile
-
- if ![runto_main] {
+
+ if {![runto_main]} {
return -1
}
# test:progress-counter probe. Set a breakpoint on it and see
# that it gets reached.
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# Expected output of "p ${pointer}" is like "$7 = (int (*)[32]) 0x804a0e0",
# and we want to extract "(int (*)[32]) 0x804a0e0" from it via
# following regexp.
- if [regexp " \\(.*\\).* 0x\[0-9a-fA-F\]+" $expect_out(0,string) output_string] {
+ if {[regexp " \\(.*\\).* 0x\[0-9a-fA-F\]+" $expect_out(0,string) output_string]} {
# OUTPUT_STRING is expected to be like "(int (*)[32]) 0x804a0e0".
pass "$test"
} else {
proc test_restore_saved_value { restore_args msg oldval newval } {
global gdb_prompt
-
+
gdb_test "restore $restore_args" \
"Restoring .*" \
"$msg; file restored ok"
if { ![string compare $oldval \
- [capture_value $newval "$msg"]] } then {
+ [capture_value $newval "$msg"]] } then {
pass "$msg; value restored ok"
} else {
fail "$msg; value restored ok"
#
# test restore with start/stop addresses.
#
-# For this purpose, we will restore just the third element of the array,
+# For this purpose, we will restore just the third element of the array,
# and check to see that adjacent elements are not modified.
#
# We will need the address and offset of the third and fourth elements.
if {![string compare $is64bitonly "no"]} {
print_zero_all
- # restore with expressions
+ # restore with expressions
test_restore_saved_value \
"[set intarr3.srec] (char*)${array2_start}-(char*)${array_start} &intarray\[3\] &intarray\[4\]" \
"array partial with expressions" 4 "intarray2\[3\]"
# Now fix the endianness at the correct state.
gdb_test_multiple "set endian $endian" "set endianness" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
+ -re ".* (big|little) endian.*$gdb_prompt $" {
pass "setting $endian endianness"
}
}
proc test_reload_saved_value { filename msg oldval newval } {
global gdb_prompt
-
+
gdb_file_cmd $filename
if { ![string compare $oldval \
- [capture_value $newval "$msg"]] } then {
+ [capture_value $newval "$msg"]] } then {
pass "$msg; value restored ok"
} else {
fail "$msg; value restored ok"
set test "rename section"
set objcopy_program [gdb_find_objcopy]
-set result [catch "exec $objcopy_program --rename-section sect2=sect1 $binfile" output]
+set result [catch {exec $objcopy_program --rename-section sect2=sect1 $binfile} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
# in $binfile.
set test "strip"
set strip_program [transform strip]
-set result [catch "exec $strip_program $binfile" output]
+set result [catch {exec $strip_program $binfile} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
incr count
}
-# See the comments in condbreak.exp for "run until breakpoint at marker1"
+# See the comments in condbreak.exp for "run until breakpoint at marker1"
# for an explanation of the xfail below.
set test "continue to break marker1, 2nd time"
gdb_test_multiple "continue" "$test" {
standard_testfile .c
set test_sso [expr \
- [supports_scalar_storage_order_attribute] \
- && [supports_gnuc]]
+ {[supports_scalar_storage_order_attribute] \
+ && [supports_gnuc]}]
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
[list debug additional_flags=-DTEST_SSO=$test_sso]] } {
gdb_test_multiple "i b" "all set to continue" {
-re ".* breakpoint .* breakpoint .*$gdb_prompt $" {
- fail "all set to continue (didn't clear bps)"
+ fail "all set to continue (didn't clear bps)"
}
-re ".*2.*main.*$break2_line.*$gdb_prompt $" {
pass "all set to continue"
# See if we can step out with control. The "1 2 3" stuff
# is output from the program.
#
-if ![gdb_skip_stdio_test "cont"] {
+if {![gdb_skip_stdio_test "cont"]} {
gdb_test_stdio "cont" \
"1 2 7 14 23 34 47 62 79" \
"Breakpoint.*$break2_line.*"
gdb_test "cont" ".*Breakpoint.*$break2_line.*"
}
-if ![gdb_skip_stdio_test "Step to return"] {
+if {![gdb_skip_stdio_test "Step to return"]} {
gdb_test_stdio "next" \
"Goodbye!" \
"[expr {$break2_line + 1}].*" \
fail "step out of main"
gdb_test "n" ".*" ""
}
- -re ".*in.*start.*$gdb_prompt $" {
+ -re ".*in.*start.*$gdb_prompt $" {
pass "step out of main"
}
- -re ".*in.*bsp_trap.*$gdb_prompt $" {
+ -re ".*in.*bsp_trap.*$gdb_prompt $" {
pass "step out of main"
}
- -re ".*in.*init.*$gdb_prompt $" {
+ -re ".*in.*init.*$gdb_prompt $" {
# This is what happens on sparc64-elf ultra.
pass "step out of main"
}
# This is what happens on the ARM RVDS runtime
pass "step out of main"
}
- -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" {
+ -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" {
pass "step out of main"
}
-re ".*in __wrap__?main ().*$gdb_prompt $" {
# another `next' is necessary.
gdb_test "next" ".*in start_l ().*" "step out of main"
}
- -re ".*in.*currently asm.*$gdb_prompt $" {
+ -re ".*in.*currently asm.*$gdb_prompt $" {
pass "step out of main"
}
-re "_*start\[0-9\]* \\(\[^)\]*\\).*$gdb_prompt $" {
set program_exited_normally 1
}
-re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" {
- pass "step to end of run"
+ pass "step to end of run"
set program_in_exit 1
}
-re ".*Single.*_int_reset.*$gdb_prompt $" {
set program_exited_normally 1
}
}
- }
+ }
}
if {$program_in_exit} {
set exec_output [remote_exec host "ls core"]
- if [ regexp "core not found" $exec_output] {
+ if {[ regexp "core not found" $exec_output]} {
pass "no core dumped on quit"
} else {
- if [ regexp "No such file or directory" $exec_output] {
+ if {[ regexp "No such file or directory" $exec_output]} {
pass "ls: core (No core dumped on quit)"
} else {
remote_exec build "rm -f core"
proc do_tests {{do_xfail_cast 0} {do_xfail 0} {do_xfail_core_test 0}} {
clean_restart
gdb_load $::binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
}
- if $do_xfail {
+ if {$do_xfail} {
setup_xfail *-*-*
}
gdb_test "print errno" ".* = 42"
- if $do_xfail_cast {
+ if {$do_xfail_cast} {
setup_xfail *-*-*
}
gdb_test "print (int) errno" ".* = 42"
gdb_test "print errno" ".* = 36" "print masking errno"
# Finish test early if no core file was made.
- if !$core_supported {
+ if {!$core_supported} {
return
}
if { $core_loaded == -1 } {
return
}
- if $do_xfail_core_test {
+ if {$do_xfail_core_test} {
setup_xfail *-*-*
}
gdb_test "print errno" ".* = 42" "check errno value from corefile"
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# operators, or in the non returned part of a (x ? y: z) expression.
# the part that is not evaluated is parsed and evaluated anyway, but with
# the EVAL_SKIP flag set
-#
+#
# source file "int-type.c"
#
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
lappend disassmbly $instructions
}
for {set i 0} {$i < [llength $length_to_examine]} {incr i} {
- set idx [expr [llength $length_to_examine] - $i - 1]
+ set idx [expr {[llength $length_to_examine] - $i - 1}]
set len [lindex $length_to_examine $idx]
set actual [capture_command_output "x/-${len}i" ""]
set expected [lindex $disassmbly $idx]
proc test { prefix body } {
with_test_prefix $prefix {
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
uplevel 1 $body
}
test "infcall" {
- if ![target_info exists gdb,cannot_call_functions] {
+ if {![target_info exists gdb,cannot_call_functions]} {
gdb_test "print func ()" " = 1" "termios ok"
} else {
unsupported "cannot call functions"
#
# This test is meant to verify that, even with lazy partial symtab
# reading in effect, GDB can set breakpoints by line number
-# successfully in either compilation unit.
+# successfully in either compilation unit.
standard_testfile
if { [llength $args] % 2 } {
warning "an even # of arguments should be passed to test_expr"
}
- set last_ent [expr [llength $args] - 1]
+ set last_ent [expr {[llength $args] - 1}]
set testname [lindex $args $last_ent]
gdb_test [lindex $args 0] ".*" "$testname, setup"
- for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} {
- gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname, [lindex $args $x]"
+ for {set x 1} {$x < $last_ent} {set x [expr {$x + 2}]} {
+ gdb_test [lindex $args $x] [lindex $args [expr {$x + 1}]] "$testname, [lindex $args $x]"
}
}
#
pass "sizeof (long long) > sizeof (long) (false)"
}
}
-if [expr ! $ok] { setup_xfail "*-*-*" }
+if {!$ok} { setup_xfail "*-*-*" }
gdb_test "print (void*) ((long long) (unsigned long) -1 + 1)" \
"warning: value truncated.*" "truncate (void*) 0x00000000ffffffff + 1"
-if [expr ! $ok] { setup_xfail "*-*-*" }
+if {!$ok} { setup_xfail "*-*-*" }
gdb_test "print (void*) (~((long long)(unsigned long) -1) - 1)" \
"warning: value truncated.*" "truncate (void*) 0xffffffff00000000 - 1"
system "rm -rf [standard_output_file *.fileio.test]"
set oldtimeout $timeout
-set timeout [expr "$timeout + 60"]
+set timeout [expr {$timeout + 60}]
clean_restart
gdb_load $binfile
return
}
-gdb_test "break stop" "Breakpoint .*$srcfile.*"
+gdb_test "break stop" "Breakpoint .*$srcfile.*"
set stop_msg ".*Breakpoint .* stop \\(\\) at.*$srcfile:.*static void stop \\(void\\) {}.*"
gdb_test "continue" ".*" ""
-catch "system \"chmod -f -w [standard_output_file nowrt.fileio.test]\""
+catch {system "chmod -f -w [standard_output_file nowrt.fileio.test]"}
# If the user is root, we will always have write permission.
if { [root_user] } {
# This test fails on Cygwin because unlink() succeeds on Win32 systems
# in that situation.
-if [ishost *cygwin*] {
+if {[ishost *cygwin*]} {
setup_xfail "*-*-*"
}
# If the user is root, we will always have write permission.
[join [list \
[string range $input_line 0 end-$back_count] \
${add_completed_line} \
- [string range $input_line end-[expr $back_count - 1] end]] \
+ [string range $input_line end-[expr {$back_count - 1}] end]] \
""]
set expanded_line_re [string_to_regexp $expanded_line]
set after_tab_re "^$input_line_re"
set after_tab_re "$after_tab_re\\\x08{$back_count}"
set after_tab_re "$after_tab_re${completion::bell_re}"
- set tail [string range $input_line end-[expr $back_count - 1] end]
+ set tail [string range $input_line end-[expr {$back_count - 1}] end]
set after_tab_re "$after_tab_re$add_completed_line_re"
set after_tab_re "$after_tab_re[string_to_regexp $tail]"
set after_tab_re "$after_tab_re\\\x08{$back_count}"
set re [string_to_regexp $input_line]
set re $re\\\x08{$back_count}
set re $re[string_to_regexp $insert_str]
- set tail [string range $input_line end-[expr $back_count - 1] end]
+ set tail [string range $input_line end-[expr {$back_count - 1}] end]
set re $re[string_to_regexp $tail]
set re $re\\\x08{$back_count}
return -1
}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
# For native targets, test a pattern straddling a chunk boundary.
-if [isnative] {
+if {[isnative]} {
gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531" ""
gdb_test "find /w search_buf, +search_buf_size, 0xfdb97531" \
"${hex_number}${one_pattern_found}" \
}
proc finish_pretty { } {
- if ![runto foo] {
+ if {![runto foo]} {
return
}
gdb_test_no_output "set print pretty" \
# the followed process stops where it is expected to stop, that processes
# are detached (or not) as expected, and that the inferior list has the
# expected contents after following the fork. WHO is the argument to
-# the 'set follow-fork-mode' command, DETACH is the argument to the
-# 'set detach-on-fork' command, and CMD is the GDB command used to
+# the 'set follow-fork-mode' command, DETACH is the argument to the
+# 'set detach-on-fork' command, and CMD is the GDB command used to
# execute the program past the fork. If the value of WHO or DETACH is
# 'default', the corresponding GDB command is skipped for that test.
# The value of CMD must be either 'next 2' or 'continue'.
proc setup_gdb { binfile srcfile } {
clean_restart $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -code return
}
# Always add the "Starting program..." string so that we
# match exactly the lines we want.
set output "Starting program: $binfile\\s*\r\n${thread_db_re}${output}${thread_db_re}${exited_normally_re}"
- set i [expr $i + 1]
+ set i [expr {$i + 1}]
gdb_test "run" $output
}
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set elem [lindex [lsort -integer -decreasing $addresses] 0]
# Return a new address as a hex formatted string.
- return [format "%#x" [expr $elem + 0x10]]
+ return [format "%#x" [expr {$elem + 0x10}]]
}
return -1
}
-# Unlike most GDB tests, we do not use gdb_reinitialize_dir in this script.
+# Unlike most GDB tests, we do not use gdb_reinitialize_dir in this script.
# We're testing GDB's ability to find files in other ways.
# Get the line number.
}
}
-set result [catch "exec realpath ${srcdir}/${subdir}/${srcfile2}" realsrcfile2]
+set result [catch {exec realpath ${srcdir}/${subdir}/${srcfile2}} realsrcfile2]
if { $result != 0 || $realsrcfile2 == "" } {
untested "invalid realpath of ${srcfile2}: result $result output $realsrcfile2"
return -1
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
set gcc_compiled [is_c_compiler_gcc]
set compile_flags {debug nowarnings quiet}
-if [support_complex_tests] {
+if {[support_complex_tests]} {
lappend compile_flags "additional_flags=-DTEST_COMPLEX"
}
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
- gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
+ gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
gdb_test "print s" ".* = 1" "print s after run to call0a"
gdb_test "print i" ".* = 2" "print i after run to call0a"
gdb_test "print l " ".* = 3" "print l after run to call0a"
gdb_breakpoint call0a
gdb_continue call0a
delete_breakpoints
-
+
# Print each arg as a double check to see if we can print
# them here as well as with backtrace.
"#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
"backtrace in indirectly called function"
- #
+ #
# "finish" brings us back to main. We then will try to step through
- # the second indirect call.
+ # the second indirect call.
# On some targets (e.g. m68k) gdb will stop from the finish in midline
# of the first indirect call. This is due to stack adjustment instructions
# after the indirect call. In these cases we will step till we hit the
}
set prev_timeout $timeout
-if [istarget "mips*tx39-*"] {
+if {[istarget "mips*tx39-*"]} {
set timeout 300
} else {
set timeout 60
}
# Test _Complex type here if supported.
-if [support_complex_tests] {
+if {[support_complex_tests]} {
complex_args
complex_integral_args
# Do the main part of the test: How much is the memory
# usage of GDB going to grow after using the gcore command.
- set diff_k [expr $mem_after - $mem_before]
- set diff [expr $diff_k/1024]
+ set diff_k [expr {$mem_after - $mem_before}]
+ set diff [expr {$diff_k/1024}]
verbose -log "The gcore command used $diff Mb ($diff_k Kb)"
gdb_assert {$diff <= $max_mem} "gdb did not use too much memory"
set strip_program [transform strip]
remote_file host delete ${stripped_binfile}
-if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] {
+if {[run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"]} {
return -1
}
gdb_load $stripped_binfile
# The binary is stripped of debug info, but not minsyms.
-if ![runto break_here] {
+if {![runto break_here]} {
return -1
}
gdb_load $binfile
gdb_load_shlib ${binfile_lib}
- if ![runto lib] {
+ if {![runto lib]} {
return -1
}
set strip_program [transform strip]
remote_file host delete ${stripped_binfile}
-if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] {
+if {[run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"]} {
return -1
}
gdb_load $stripped_binfile
# The binary is stripped of debug info, but not minsyms.
-if ![runto break_here] {
+if {![runto break_here]} {
return -1
}
set post_corefile_extern_array \
[capture_command_output "print extern_array" "$print_prefix"]
-if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] {
+if {![string compare $pre_corefile_extern_array $post_corefile_extern_array]} {
pass "corefile restored extern array"
} else {
fail "corefile restored extern array"
set post_corefile_static_array \
[capture_command_output "print static_array" "$print_prefix"]
-if ![string compare $pre_corefile_static_array $post_corefile_static_array] {
+if {![string compare $pre_corefile_static_array $post_corefile_static_array]} {
pass "corefile restored static array"
} else {
fail "corefile restored static array"
set post_corefile_uninit_array \
[capture_command_output "print un_initialized_array" "$print_prefix"]
-if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] {
+if {![string compare $pre_corefile_uninit_array $post_corefile_uninit_array]} {
pass "corefile restored un-initialized array"
} else {
fail "corefile restored un-initialized array"
set post_corefile_heap_string \
[capture_command_output "print heap_string" "$print_prefix"]
-if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] {
+if {![string compare $pre_corefile_heap_string $post_corefile_heap_string]} {
pass "corefile restored heap array"
} else {
fail "corefile restored heap array"
set post_corefile_local_array \
[capture_command_output "print array_func::local_array" "$print_prefix"]
-if ![string compare $pre_corefile_local_array $post_corefile_local_array] {
+if {![string compare $pre_corefile_local_array $post_corefile_local_array]} {
pass "corefile restored stack array"
} else {
fail "corefile restored stack array"
}
set post_corefile_backtrace [capture_command_output "backtrace" ""]
-if ![string compare $pre_corefile_backtrace $post_corefile_backtrace] {
+if {![string compare $pre_corefile_backtrace $post_corefile_backtrace]} {
pass "corefile restored backtrace"
} else {
fail "corefile restored backtrace"
proc do_test { pass } {
global testfile gdb_prompt binfile pf_prefix
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
set abort 0
}
}
- if $abort {
+ if {$abort} {
verbose -log "$pf_prefix $test: did not run"
return $abort
}
-re "hithere2 \\(\\) at.*${libfile}.c:\[0-9\]+\r\n\[0-9\]+.*a = 21;.*$gdb_prompt $" {
pass $name
}
- -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" {
- kfail "gdb/1555" $name
+ -re "0x\[0-9a-f\]+ in .* \\(\\) from /lib/ld.so.1.*$gdb_prompt $" {
+ kfail "gdb/1555" $name
}
}
-re "\[0-9\]+.*return a;.*$gdb_prompt $" {
pass $name
}
- -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" {
- kfail "gdb/1555" $name
+ -re "Single stepping until exit from function .*, \r\nwhich has no line number information.\r\n\r\n$inferior_exited_re normally.*$gdb_prompt $" {
+ kfail "gdb/1555" $name
}
}
if {![runto_main]} {
return
-}
-gdb_test "print /x bar" "{x__0 = 0x0, y__0 = 0x0, z__1 = 0x0}"
+}
+gdb_test "print /x bar" "{x__0 = 0x0, y__0 = 0x0, z__1 = 0x0}"
standard_testfile
-if [build_executable ${testfile}.exp $testfile] {
+if {[build_executable ${testfile}.exp $testfile]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
delete_breakpoints
- if [istarget "mips*tx39-*"] {
+ if {[istarget "mips*tx39-*"]} {
set timeout 60
}
# We used to set timeout here for all other targets as well. This
standard_testfile .c
-set max [expr 2 * 1024 * 1024]
+set max [expr {2 * 1024 * 1024}]
set min 16
set opts {}
lappend opts debug
set compilation_succeeded 0
-for { set size $max } { $size >= $min } { set size [expr $size / 2] } {
+for { set size $max } { $size >= $min } { set size [expr {$size / 2}] } {
set try_opts [concat $opts [list additional_flags=-DCRASH_GDB=$size]]
if { [build_executable $testfile.exp $testfile $srcfile $try_opts] == -1 } {
continue
unsupported $test
} else {
# At 56 passes with and without the fix, so use 55.
- gdb_assert {$space_used < [expr 55 * 4 * $size] } $test
+ gdb_assert {$space_used < [expr {55 * 4 * $size}] } $test
}
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "list -q main" ".*"
get_debug_format
-set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]]
+set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}]
# We should be able to find the source file containing the definition,
# even though it was an included header.
# - the binary already has an index section
# - we use the -readnow switch
set has_index_section [exec_has_index_section $binfile]
-set uses_readnow [expr [string first "-readnow" $GDBFLAGS] != -1]
-set expecting_index_cache_use [expr !$has_index_section && !$uses_readnow]
+set uses_readnow [expr {[string first "-readnow" $GDBFLAGS] != -1}]
+set expecting_index_cache_use [expr {!$has_index_section && !$uses_readnow}]
# List the files in DIR on the host (where GDB-under-test runs).
# Return a list of two elements:
# Some targets can't call functions, so don't even bother with this
# test.
-if [target_info exists gdb,cannot_call_functions] {
+if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
continue
}
set complex_types { tfc tdc tldc }
set compile_flags {debug}
-if [support_complex_tests] {
+if {[support_complex_tests]} {
lappend compile_flags "additional_flags=-DTEST_COMPLEX"
lappend compile_flags "additional_flags=-Wno-psabi"
}
start_gdb_and_run_tests $lang $ta
}
-if [support_complex_tests] {
+if {[support_complex_tests]} {
foreach ta $complex_types {
start_gdb_and_run_tests $lang $ta
}
error "invalid method $method"
}
- set argc [expr [llength $expected_results] + 1]
+ set argc [expr {[llength $expected_results] + 1}]
# Now that we are stopped at main, inspect argc/argv.
gdb_test "print argc" " = $argc"
gdb_test "print argv\[0\]" " = $hex \"\[^\r\n\]+\""
for { set i 1 } { $i < $argc } { incr i } {
- set idx [expr $i - 1]
+ set idx [expr {$i - 1}]
gdb_test "print argv\[$i\]" " = [lindex $expected_results $idx]"
}
}
gdb_test_no_output "set detach-on-fork off"
-if ![runto_main] {
+if {![runto_main]} {
return
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
exp_continue
}
-re "^$gdb_prompt $" {
- if $found {
+ if {$found} {
set ok 1
}
# Exit the loop.
# Start the inferior, and check neither of the libraries are loaded at
# the start.
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
check_info_shared "info sharedlibrary #1" 0 0
}
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set solib_name [gdb_load_shlib $solib_name]
-if ![runto foo] {
+if {![runto foo]} {
untested "failed to run to function foo"
return -1
}
# Make sure we handle the case where there are no source files
# associated with a particular objfile.
set source_list {}
- if [info exists info_sources($objfile)] {
+ if {[info exists info_sources($objfile)]} {
set source_list $info_sources($objfile)
}
"add symbol table from file \".*\" at.*\\(y or n\\) " "y"
# Check if we are able to read offset adjusted line information of main
-
+
gdb_test "info line main" \
"Line.*starts at address 0xffff0000.*and ends at.*"
gdb_test "set follow-fork-mode child" ".*"
- if ![runto "daemon_main"] {
+ if {![runto "daemon_main"]} {
return
}
standard_testfile
-if [prepare_for_testing "failed to prepare for testing" \
- ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare for testing" \
+ ${testfile} ${srcfile} {debug}]} {
return -1
}
# Pretend there's no terminal.
gdb_test_no_output "set interactive-mode off"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Poke desired values directly into inferior instead of using "set
# args" because "set args" does not work under gdbserver.
-set count [expr [llength $jit_solibs_target] + 1]
+set count [expr {[llength $jit_solibs_target] + 1}]
gdb_test_no_output "set var argc=$count" "forging argc"
gdb_test_no_output "set var argv=fake_argv" "forging argv"
for {set i 1} {$i < $count} {incr i} {
- set jit_solib_target [lindex $jit_solibs_target [expr $i-1]]
+ set jit_solib_target [lindex $jit_solibs_target [expr {$i-1}]]
gdb_test_no_output "set var argv\[$i\]=\"${jit_solib_target}\"" \
"forging argv\[$i\]"
}
foreach addr $symfile_addrs len $symfile_lengths {
incr count
set output [standard_output_file "dump-elf-solib.${count}.so"]
- set end [expr $addr + $len]
+ set end [expr {$addr + $len}]
gdb_test_no_output "dump binary memory $output $addr $end" \
"dump jit solib $count"
set start [format 0x%x $addr]
# Calculate the end address.
- set end [format 0x%x [expr $addr + $len]]
+ set end [format 0x%x [expr {$addr + $len}]]
# This is what we expect the address range to look like in the BFD
# filename.
# Poke desired values directly into inferior instead of using "set args"
# because "set args" does not work under gdbserver.
- gdb_test_no_output "set var argc=[expr $count + 1]" "forging argc"
+ gdb_test_no_output "set var argc=[expr {$count + 1}]" "forging argc"
gdb_test_no_output "set var argv=fake_argv" "forging argv"
for {set i 1} {$i <= $count} {incr i} {
- set binfile_target [lindex $solib_binfiles_target [expr $i-1]]
+ set binfile_target [lindex $solib_binfiles_target [expr {$i-1}]]
gdb_test_no_output "set var argv\[$i\]=\"${binfile_target}\"" \
"forging argv\[$i\]"
}
gdb_test_no_output "set var argc=$count" "forging argc"
gdb_test_no_output "set var argv=fake_argv" "forging argv"
for {set i 1} {$i < $count} {incr i} {
- set jit_solib_target [lindex $jit_solibs_target [expr $i-1]]
+ set jit_solib_target [lindex $jit_solibs_target [expr {$i-1}]]
gdb_test_no_output "set var argv\[$i\]=\"${jit_solib_target}\"" \
"forging argv\[$i\]"
}
# second, gdb might not reload the executable automatically.
sleep 1
- if ${change_addr} {
+ if {${change_addr}} {
set options "additional_flags=-DSPACER"
if {$standalone} {
gdb_rename_execfile $binfile ${binfile}x
"maint info breakpoints shows jit breakpoint"
}
- if ${change_addr} {
+ if {${change_addr}} {
gdb_assert {$addr_before != $addr_after} "address changed"
} else {
gdb_assert {$addr_before == $addr_after} "address didn't change"
}
foreach standalone {1 0} {
- with_test_prefix [expr ($standalone)?"standalone":"shared"] {
+ with_test_prefix [expr {($standalone)?"standalone":"shared"}] {
with_test_prefix "change addr" {
jit_test_reread $standalone 1
}
require {!target_info exists gdb,nosignals}
-if [prepare_for_testing "failed to prepare" ${testfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile}]} {
return -1
}
gdb_test "handle SIGUSR1 stop print pass" "SIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+.*"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile
set executable $testfile
-if [prepare_for_testing "failed to prepare" $executable] {
+if {[prepare_for_testing "failed to prepare" $executable]} {
return -1
}
clean_restart
gdb_load $binfile
- if ![runto done] {
+ if {![runto done]} {
return
}
standard_testfile langs0.c langs1.c langs2.c
-if [is_remote host] {
+if {[is_remote host]} {
remote_download host ${srcdir}/${subdir}/langs1.f
remote_download host ${srcdir}/${subdir}/langs2.cxx
}
gdb_test "show language" "currently $lang\".*" \
"show language at main"
- if [target_info exists gdb,noresults] { return }
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "first session"
}
# Also test warn-language-frame-mismatch.
gdb_test_no_output "set warn-language-frame-mismatch off"
gdb_test_no_output "set lang minimal" "set lang to minimal"
-
+
gdb_test "print x" " = 5000" "print parameter value"
# Ensure this at least does not crash.
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Set the max-value-size so we can only print 51 elements.
set elements 51
set int_size [get_valueof "/d" "sizeof(large_1d_array\[0\])" "*unknown*"]
-gdb_test_no_output "set max-value-size [expr $int_size * $elements]"
+gdb_test_no_output "set max-value-size [expr {$int_size * $elements}]"
with_test_prefix "with reduced max-value size" {
gdb_test "print large_1d_array" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
#
# Compiling lineinc.c with Dwarf 2 macro information will produce
# something like this:
-#
+#
# $ gcc -g3 lineinc.c -o lineinc
# $ readelf -wml lineinc
# ...
# 4 0 0 0 lineinc3.h
# ...
# Contents of the .debug_macinfo section:
-#
+#
# DW_MACINFO_start_file - lineno: 0 filenum: 1
# DW_MACINFO_define - lineno : 1 macro : __VERSION__ "3.2 20020903 (Red Hat Linux 8.0 3.2-7)"
-# DW_MACINFO_define - lineno : 2 macro : __USER_LABEL_PREFIX__
+# DW_MACINFO_define - lineno : 2 macro : __USER_LABEL_PREFIX__
# ...
# DW_MACINFO_define - lineno : 1 macro : __i386__ 1
# DW_MACINFO_define - lineno : 1 macro : __tune_i386__ 1
# DW_MACINFO_define - lineno : 2 macro : FOO 3
# DW_MACINFO_end_file
# DW_MACINFO_end_file
-# $
+# $
#
# Note how the inclusions of lineinc1.h and lineinc2.h are both
# attributed to line 10 of lineinc.c, and the #inclusion of lineinc3.h
exp_continue
}
-re "$gdb_prompt" {
- }
+ }
timeout {
fail "$test_name (timeout)"
}
set lineno0 [gdb_get_line_number $symbol_line $srcfile]
set lineno1 [gdb_get_line_number $symbol_line $srcfile2]
- set lines0_re [line_range_pattern [expr $lineno0 - 5] [expr $lineno0 + 4]]
- set lines1_re [line_range_pattern [expr $lineno1 - 5] [expr $lineno1 + 4]]
+ set lines0_re [line_range_pattern [expr {$lineno0 - 5}] [expr {$lineno0 + 4}]]
+ set lines1_re [line_range_pattern [expr {$lineno1 - 5}] [expr {$lineno1 + 4}]]
set any "\[^\r\n\]*"
set h0_re "file: \"${any}list-ambiguous0.c\", line number: $lineno0, symbol: \"$symbol\""
global set_listsize_count
incr set_listsize_count
- if [gdb_test_no_output "set listsize $arg" "setting listsize to $arg #$set_listsize_count"] {
+ if {[gdb_test_no_output "set listsize $arg" "setting listsize to $arg #$set_listsize_count"]} {
return 0
}
if { $arg == 0 } {
set arg "unlimited"
}
- if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"] {
+ if {[gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"]} {
return 0
}
return 1
# Show default size
gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
-
+
# Show the default lines
gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
# Ensure we can limit printouts to one line
- if [set_listsize 1] {
+ if {[set_listsize 1]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1"
gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1"
- }
+ }
# Try just two lines
-
- if [ set_listsize 2 ] {
+
+ if {[ set_listsize 2 ]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 2"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2"
# Try small listsize > 1 that is an odd number
- if [ set_listsize 3 ] {
+ if {[ set_listsize 3 ]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 1 with listsize 3"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3"
gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"
if {[set_listsize 4]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 1 with listsize 4"
gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 2 with listsize 4"
-
+
gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4"
gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4"
}
if {[set_listsize 100]} {
gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 1 with listsize 100"
-
+
gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 10 with listsize 100"
}
# Test that repeating the list linenum command doesn't print the same
# lines over again. Note that this test makes sure that the argument
# linenum is dropped, when we repeat the previous command. 'x/5i $pc'
-# works the same way.
+# works the same way.
proc_with_prefix test_repeat_list_command {} {
global last_line_re
# gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"
- set past_end [expr ${last_line} + 10]
- set much_past_end [expr ${past_end} + 10]
+ set past_end [expr {${last_line} + 10}]
+ set much_past_end [expr {${past_end} + 10}]
gdb_test "list 30,${past_end}" "30\[ \t\]+foo \(.*\);.*${last_line_re}" "list range; upper bound past EOF"
# Test some invalid specs
# The following test takes the FIXME result on most systems using
# DWARF. It fails to notice that main() is not in the file requested.
-
+
setup_xfail "*-*-*"
# Does this actually work ANYWHERE? I believe not, as this is an `aspect' of
# Test that GDB won't crash if the line being searched is extremely long.
set oldtimeout $timeout
- set timeout [expr "$timeout + 300"]
+ set timeout [expr {$timeout + 300}]
verbose "Timeout is now $timeout seconds" 2
gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)"
set timeout $oldtimeout
standard_testfile
-if [gdb_protocol_is_native] {
+if {[gdb_protocol_is_native]} {
unsupported "the native target does not support the load command"
return
}
set opts {debug nopie}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set var [lindex $vars $vari]
for {set opi 0} {$opi < [llength $ops]} {incr opi} {
set op [lindex [lindex $ops $opi] 0]
- set val [lindex [lindex $ops $opi] [expr $vari + 1]]
+ set val [lindex [lindex $ops $opi] [expr {$vari + 1}]]
gdb_test "print $var, $op" " = $val" "evaluate $op; variables $var; expecting $val"
}
}
standard_testfile
-if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile {} {debug}]} {
return -1
}
gdb_load $binfile
if {![runto known_types]} {
- return
+ return
}
# Detect the size of the target's basic types.
proc pat2 { n pats } {
set i 0
while { $n > 1 } {
- set n [expr $n / 2]
+ set n [expr {$n / 2}]
incr i
}
return [lindex $pats $i]
#
# If GDB complains that it doesn't have any information about
# preprocessor macro definitions, return the string `no-macro-info'.
-#
+#
# If expect times out waiting for GDB, we return the string `timeout'.
#
# If GDB's output doesn't otherwise match what we're expecting, we
unsupported "skipping test because debug information does not include macro information."
return 0
}
-
+
list_and_check_macro main WHERE {macscp1.c {before macscp1_3}}
list_and_check_macro macscp2_2 WHERE {macscp2.h macscp1.c {before macscp2_2}}
list_and_check_macro macscp3_2 WHERE {macscp3.h macscp1.c {before macscp3_2}}
pass "info macro WHERE after `list macscp_4_2_from_macscp2'"
}
{macscp4.h macscp3.h macscp1.c {before macscp4_2_..., from macscp3.h}} {
- setup_kfail "gdb/7660" *-*-*
+ setup_kfail "gdb/7660" *-*-*
fail "info macro WHERE after `list macscp_4_2_from_macscp2' (gdb/7660)"
}
- timeout {
+ timeout {
fail "info macro WHERE after `list macscp_4_2_from_macscp2' (timeout)"
}
default { fail "info macro WHERE after `list macscp_4_2_from_macscp2'" }
pass "info macro WHERE after `list macscp_4_2_from_macscp3'"
}
{macscp4.h macscp2.h macscp1.c {before macscp4_2_..., from macscp2.h}} {
- setup_kfail "gdb/7660" *-*-*
+ setup_kfail "gdb/7660" *-*-*
fail "info macro WHERE after `list macscp_4_2_from_macscp3' (gdb/7660)"
}
timeout {
if {[string compare $result $expected] == 0} {
pass "info macro WHERE stopped in $func"
} elseif {[string compare $result $kfail_expected] == 0} {
- setup_kfail "gdb/7660" *-*-*
+ setup_kfail "gdb/7660" *-*-*
fail "info macro WHERE stopped in $func (gdb/7660)"
} elseif {[string compare $result timeout] == 0} {
fail "info macro WHERE stopped in $func (timeout)"
switch -- [lindex $result end] {
undefined { pass $test_name }
timeout { fail "$test_name (timeout)" }
- default {
+ default {
maybe_kfail $func "$test_name"
}
}
switch -- [lindex $result end] {
undefined { pass $test_name }
timeout { fail "$test_name (timeout)" }
- default {
+ default {
maybe_kfail $func "$test_name"
}
}
set have_gdb_index 1
}
-set have_psyms [expr ! ( $have_gdb_index || $readnow_p )]
+set have_psyms [expr {! ( $have_gdb_index || $readnow_p )}]
#
# this command does not produce any output
# The timeout value is raised, because printing all the symbols and
# statistical information about Cygwin and Windows libraries takes a lot
# of time.
-if [istarget "*-*-cygwin*"] {
+if {[istarget "*-*-cygwin*"]} {
set oldtimeout $timeout
- set timeout [expr $timeout + 500]
+ set timeout [expr {$timeout + 500}]
}
set re \
}
proc maint_pass_if {val name} {
- if $val { pass $name } else { fail $name }
+ if {$val} { pass $name } else { fail $name }
}
maint_pass_if $header "maint print objfiles: header"
}
}
-if [istarget "hppa*-*-11*"] {
+if {[istarget "hppa*-*-11*"]} {
setup_xfail hppa*-*-*11* CLLbs14860
gdb_test_multiple "maint print unwind &main" "maint print unwind" {
-re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $" {
}
set oldtimeout $timeout
-set timeout [expr $timeout + 300]
+set timeout [expr {$timeout + 300}]
set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
gdb_test "maint print" \
"List.*unambiguous\\..*" \
- "maint print w/o args"
+ "maint print w/o args"
gdb_test "maint info" \
"List.*unambiguous\\..*" \
}
#set oldtimeout $timeout
-#set timeout [expr $timeout + 300]
+#set timeout [expr {$timeout + 300}]
gdb_test_multiple "maint dump-me" "maint dump-me" {
-re "Should GDB dump core.*\\(y or n\\) $" {
gdb_expect {
-re "A problem internal to GDB has been detected" {
pass "maint internal-error"
- if [gdb_internal_error_resync] {
+ if {[gdb_internal_error_resync]} {
pass "internal-error resync"
} else {
fail "internal-error resync"
}
set linespec ${srcfile}:[gdb_get_line_number "Break here"]
-if ![runto ${linespec}] {
+if {![runto ${linespec}]} {
return -1
}
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
#
# tests for expressions with struct/array elements and mixed operator types
# with elementary types
-#
+#
# By default, the datastructures are allocated on the stack. For targets
# with very small stack, that will not work. In that case, just set
# storage to `-DSTORAGE=static' which changes the datastructures to be
# allocated in data segment.
set storage "-DSTORAGE="
-if [target_info exists gdb,small_stack_section] {
+if {[target_info exists gdb,small_stack_section]} {
set storage "-DSTORAGE=static"
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
}
}
- if ![runto_main] {
+ if {![runto_main]} {
return
}
test_break "before run"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
gdb_test_no_output "set detach off" "set detach off"
#
-# We will now run every fork up to the exit bp,
+# We will now run every fork up to the exit bp,
# eventually winding up with 16 inferiors.
#
# Now we should examine all the pids.
#
-#
+#
# Test detach inferior
-#
+#
# [assumes we're at #1]
gdb_test "detach inferior 2" "Detaching .*" "detach 2"
gdb_test "detach inferior 4" "Detaching .*" "detach 4"
gdb_test "detach inferior 5" "Detaching .*" "detach 5"
-#
+#
# Test kill inferior
#
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set testcase "nested-subp1"
-if ![support_nested_function_tests] {
+if {![support_nested_function_tests]} {
untested "compiler does not support nested functions"
return -1
}
# Run until the variables we are interested in are visible.
clean_restart "${testcase}"
-if ![runto_main] {
+if {![runto_main]} {
return
}
set testcase "nested-subp2"
-if ![support_nested_function_tests] {
+if {![support_nested_function_tests]} {
untested "compiler does not support nested functions"
return -1
}
# Run until the variables we are interested in are visible.
clean_restart "${testcase}"
-if ![runto_main] {
+if {![runto_main]} {
return
}
set testcase "nested-subp3"
-if ![support_nested_function_tests] {
+if {![support_nested_function_tests]} {
untested "compiler does not support nested functions"
return -1
}
# Run until the variables we are interested in are visible.
clean_restart "${testcase}"
-if ![runto_main] {
+if {![runto_main]} {
return
}
clean_restart $testfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
"new-ui with bad interpreter name"
# Test that the TUI cannot be used for a new UI.
- if [allow_tui_tests] {
+ if {[allow_tui_tests]} {
gdb_test "new-ui tui $extra_tty_name" \
"interpreter 'tui' cannot be used with a new UI" \
"new-ui with tui"
}
# Test that we can continue working normally.
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
standard_testfile .c
-if [test_compiler_info "xlc-*"] {
+if {[test_compiler_info "xlc-*"]} {
# By default, IBM'x xlc compiler doesn't add static variables into the symtab.
- # Use "-qstatsym" to do so.
+ # Use "-qstatsym" to do so.
set exec_opts additional_flags=-qstatsym
} else {
set exec_opts ""
proc nodebug_runto {func} {
with_test_prefix $func {
- if ![runto $func] {
+ if {![runto $func]} {
return false
}
gdb_test_no_output "nosharedlibrary" \
# require coercion/promotion, both prototyped and unprototyped, both
# return-type-cast style, and function-pointer-cast styles.
proc test_call_promotion {} {
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
return
}
}
if {[nodebug_runto inner]} {
-
+
# Expect to find global/local symbols in each of text/data/bss.
-
+
# The exact format for some of this output is not necessarily
# ideal, particularly interpreting "p top" requires a fair bit of
# savvy about gdb's workings and the meaning of the "{}"
# to detect that gdb does not know the type, rather than just
# being told they are ints or functions returning int like old
# versions of gdb used to do.
-
+
# On alpha (and other ecoff systems) the native compilers put
# out debugging info for non-aggregate return values of functions
# even without -g, which should be accepted.
# Check that pointer arithmetic works as expected.
set addr1 [get_hexadecimal_valueof "&dataglobal" "*UNKNOWN*"]
set addr2 [get_hexadecimal_valueof "(int *) &dataglobal + 1" "*UNKNOWN*"]
- set offset [expr $addr2 - $addr1]
+ set offset [expr {$addr2 - $addr1}]
set int_size [get_integer_valueof "sizeof (int)" "*UNKNOWN*"]
gdb_assert { $offset == $int_size }
# ever, why bother with a weaker test?
#gdb_test "backtrace 10" "#0.*inner.*#1.*#2.*top.*#3.*main.*" \
# "backtrace from inner for externals"
-
+
# This test is not as obscure as it might look. `p getenv ("TERM")'
# is a real-world example, at least on many systems.
foreach cmd {"p/c" "ptype" "whatis"} {
gdb_test "$cmd array_index(\"abcdef\",2)" \
"'array_index' has unknown return type; cast the call to its declared return type"
}
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "p/c (int) array_index(\"abcdef\",2)"
} else {
# We need to up this because this can be really slow on some boards.
standard_testfile
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
return -1
}
standard_testfile
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
return -1
}
set binfile [standard_output_file $testfile-$pie]
set board [target_info name]
- if [board_info $board exists mathlib] {
+ if {[board_info $board exists mathlib]} {
set mathlib [board_info $dest mathlib]
set_board_info mathlib ""
+ # tclint-disable-next-line command-args
set err [eval $compile]
set_board_info mathlib $mathlib
} else {
set_board_info mathlib ""
+ # tclint-disable-next-line command-args
set err [eval $compile]
unset_board_info mathlib
}
-re "\\$\[0-9\]* = .* (0x\[0-9a-fA-F\]*) .*\[\r\n\]*$gdb_prompt $" {
set addr2 $expect_out(1,string)
- if {[expr $addr2 - $addr1] == [expr 0x10000000 + 16]} {
+ if {[expr {$addr2 - $addr1}] == [expr {0x10000000 + 16}]} {
pass "big offsets"
} else {
fail "big offsets"
gdb_load ${binfile}
# Run to main, where struct foo is incomplete.
-if ![runto_main] {
+if {![runto_main]} {
return
}
gdb_load ${binfile}
# Run to getfoo, where struct foo is complete.
-if ![runto getfoo] {
+if {![runto getfoo]} {
perror "cannot run to breakpoint at getfoo"
}
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
# Same for "compile print". Not really a wrapper prefix command like
# "frame apply", but similar enough that we test pretty much the same
# things.
-if ![skip_compile_feature_tests] {
+if {![skip_compile_feature_tests]} {
test-print "compile "
}
# Copyright 1997-2025 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
global hexx
set func_addr 0
- send_gdb "print $func\n"
+ send_gdb "print $func\n"
gdb_expect {
-re "\\$\[0-9\]+ = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" {
set func_addr $expect_out(1,string)
# map each overlay successively, and
# capture the VMA addresses of [foo bar baz grbx foox barx bazx grbxx]
-gdb_test "overlay map .ovly0" ""
+gdb_test "overlay map .ovly0" ""
gdb_test "overlay list" "Section .ovly0, loaded at.*, mapped at.*" "list ovly0"
set foo_vma [get_func_address "foo" "foo" "foo runtime address"]
-gdb_test "overlay map .ovly1" ""
+gdb_test "overlay map .ovly1" ""
gdb_test "overlay list" "Section .ovly1, loaded at.*, mapped at.*" "list ovly1"
set bar_vma [get_func_address "bar" "bar" "bar runtime address"]
-gdb_test "overlay map .ovly2" ""
+gdb_test "overlay map .ovly2" ""
gdb_test "overlay list" "Section .ovly2, loaded at.*, mapped at.*" "list ovly2"
set baz_vma [get_func_address "baz" "baz" "baz runtime address"]
-gdb_test "overlay map .ovly3" ""
+gdb_test "overlay map .ovly3" ""
gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "list ovly3"
set grbx_vma [get_func_address "grbx" "grbx" "grbx runtime address"]
if {$data_overlays} {
- gdb_test "overlay map .data00" ""
+ gdb_test "overlay map .data00" ""
gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "list data00"
gdb_test "print \$foox_vma = &foox" \
".* $iptrcast 0x.*" "foox runtime addr"
- gdb_test "overlay map .data01" ""
+ gdb_test "overlay map .data01" ""
gdb_test "overlay list" "Section .data01, loaded .*, mapped .*" "list data01"
gdb_test "print \$barx_vma = &barx" \
".* $iptrcast 0x.*" "barx runtime addr"
- gdb_test "overlay map .data02" ""
+ gdb_test "overlay map .data02" ""
gdb_test "overlay list" "Section .data02, loaded .*, mapped .*" "list data02"
gdb_test "print \$bazx_vma = &bazx" \
".* $iptrcast 0x.*" "bazx runtime addr"
- gdb_test "overlay map .data03" ""
+ gdb_test "overlay map .data03" ""
gdb_test "overlay list" "Section .data03, loaded .*, mapped .*" "list data03"
gdb_test "print \$grbxx_vma = &grbxx" \
".* $iptrcast 0x.*" "grbxx runtime addr"
gdb_test "print \$grbxx_lma != \$grbxx_vma" ".* = 1" "grbxx's LMA != VMA"
}
-# Verify that early-mapped overlays have been bumped out
+# Verify that early-mapped overlays have been bumped out
# by later-mapped overlays laid over in the same VMA range.
send_gdb "overlay list\n"
}
set file_arg $binfile
-if [is_remote host] {
+if {[is_remote host]} {
set file_arg [remote_download host $file_arg]
}
if {[probe_can_run_cmdline] > 0} {
test_fg_execution_pagination_return
- if ![target_info exists gdb,nointerrupts] {
+ if {![target_info exists gdb,nointerrupts]} {
test_fg_execution_pagination_cancel "ctrl-c"
}
test_fg_execution_pagination_cancel "quit"
if { $n < 0} {
set n_sign -1
- set n [expr -$n]
+ set n [expr {-$n}]
} else {
set n_sign 1
}
- set smax [expr 1 << ($type_bits - 1)];
+ set smax [expr {1 << ($type_bits - 1)}];
if { $n_sign == -1 } {
# Negative number, signed type.
- return [expr ($n <= $smax)]
+ return [expr {($n <= $smax)}]
} elseif { $n_sign == 1 && $type_signed_p } {
# Positive number, signed type.
- return [expr ($n < $smax)]
+ return [expr {($n < $smax)}]
} elseif { $n_sign == 1 && !$type_signed_p } {
# Positive number, unsigned type.
- return [expr ($n >> $type_bits) == 0]
+ return [expr {($n >> $type_bits) == 0}]
} else {
error "unreachable"
}
}
global sizeof_long_long sizeof_long sizeof_int
- set long_long_bits [expr $sizeof_long_long * 8]
- set long_bits [expr $sizeof_long * 8]
- set int_bits [expr $sizeof_int * 8]
+ set long_long_bits [expr {$sizeof_long_long * 8}]
+ set long_bits [expr {$sizeof_long * 8}]
+ set int_bits [expr {$sizeof_int * 8}]
if { $lang == "rust" } {
if { [fits_in_type $n 32 s] } {
foreach_with_prefix prefix $prefixes {
foreach baseval $basevals {
foreach offset { -2 -1 0 1 2 } {
- set dec_val [expr $baseval + $offset]
+ set dec_val [expr {$baseval + $offset}]
set hex_val [format "0x%llx" $dec_val]
if { $dec_val < 0 } {
continue
"pending plus real breakpoint info"
-#
-# Test not setting a pending breakpoint
+#
+# Test not setting a pending breakpoint
#
gdb_test "break pendfunc2" \
"" \
"n"
#
-# Add condition to pending breakpoint
+# Add condition to pending breakpoint
#
gdb_test_no_output "condition 1 k == 1"
gdb_test_no_output "set args ${binfile2}" "set args ${binfile2_test_msg}"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Ensure we cannot get a false PASS and the inferior has really changed.
set test "pie_execl_marker address has changed"
-if [string equal $addr1 $addr2] {
+if {[string equal $addr1 $addr2]} {
fail $test
} else {
pass $test
set opts [list debug pie]
-if [build_executable "failed to prepare" $testfile $srcfile $opts] {
+if {[build_executable "failed to prepare" $testfile $srcfile $opts]} {
return
}
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
#
# tests for pointer arithmetic and pointer dereferencing
# with integer type variables and pointers to integers
-#
+#
#
# test running programs
# pass "illegal pointer assignment rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" }
-# timeout { fail "(timeout) illegal pointer assignment rejected" }
+# timeout { fail "(timeout) illegal pointer assignment rejected" }
# }
# pass "illegal pointer assignment rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" }
-# timeout { fail "(timeout) ilegal pointer assignment rejected" }
+# timeout { fail "(timeout) ilegal pointer assignment rejected" }
# }
#send_gdb "print v_unsigned_int_pointer == v_double_pointer\n"
# pass "illegal pointer operation (+) rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer operation (+) rejected" }
-# timeout { fail "(timeout) illegal pointer operation (+) rejected" }
+# timeout { fail "(timeout) illegal pointer operation (+) rejected" }
# }
# pass "illegal pointer operation (*) rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer operation (*) rejected" }
-# timeout { fail "(timeout) illegal pointer operation (*) rejected" }
+# timeout { fail "(timeout) illegal pointer operation (*) rejected" }
# }
# pass "ilegal pointer assignment rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" }
-# timeout { fail "(timeout) illegal pointer assignment rejected" }
+# timeout { fail "(timeout) illegal pointer assignment rejected" }
# }
# pass "illegal pointer assignment rejected"
# }
# -re ".*$gdb_prompt $" { fail "illegal pointer assignment rejected" }
-# timeout { fail "(timeout) illegal pointer assignment rejected" }
+# timeout { fail "(timeout) illegal pointer assignment rejected" }
# }
gdb_test_no_output "set variable v_int_pointer=&v_int_array\[0\]" \
gdb_test "print **ptr_to_ptr_to_float" " = 100" \
"print through ptr to ptr"
-# tests for pointers
+# tests for pointers
# with elementary type variables and pointers.
-#
+#
gdb_test "break marker1" ".*" ""
gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" \
gdb_test_multiple "ptype pS" "ptype pS" {
-re "type = short \\*.*$gdb_prompt $" { pass "ptype pS" }
-re "type = short int \\*.*$gdb_prompt $" { pass "ptype pS" }
-}
+}
gdb_test "print *pUS" " = 7" "print value of *pUS"
clean_restart ${testname}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
set test "split debug of executable"
-if [gdb_gnu_strip_debug $binfile] {
+if {[gdb_gnu_strip_debug $binfile]} {
fail $test
} else {
pass $test
}
-if ![prelink_yes $prelink_args] {
+if {![prelink_yes $prelink_args]} {
# Maybe we don't have prelink.
return -1
}
set found 0
set coredir "[standard_output_file coredir.[getpid]]"
file mkdir $coredir
-catch "system \"(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
+catch {system "(cd ${coredir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1"}
foreach i "${coredir}/core ${coredir}/core.coremaker.c ${binfile}.core" {
- if [remote_file build exists $i] {
+ if {[remote_file build exists $i]} {
remote_exec build "mv $i [standard_output_file prelink.core]"
set found 1
}
}
# Relink $libfile to a different address.
-if ![prelink_yes $prelink_args] {
+if {![prelink_yes $prelink_args]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_load_shlib $libobj1
gdb_locate_shlib $libobj2
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
}
}
- if $version_id_main {
+ if {$version_id_main} {
compare "'print-file-var-main.c'::this_version_id" "vm"
compare "this_version_id" "vm"
}
return 0
}
-if [allow_python_tests] {
+if {[allow_python_tests]} {
# The $_as_string convenience function is implemented in Python.
gdb_test {printf "%s\n", $_as_string("aabbcc")} "\"aabbcc\""
gdb_load $binfile
gdb_load_shlib ${binfile_lib}
-if ![runto lib] {
+if {![runto lib]} {
return -1
}
with_test_prefix "shlib ${print_symbol_loading}" {
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# Test various octal values.
- test_print_reject "p 09"
- test_print_reject "p 079"
+ test_print_reject "p 09"
+ test_print_reject "p 079"
# Test various hexadecimal values.
- test_print_reject "p 0xG"
- test_print_reject "p 0xAG"
+ test_print_reject "p 0xG"
+ test_print_reject "p 0xAG"
# Test various binary values.
- test_print_reject "p 0b2"
- test_print_reject "p 0b12"
+ test_print_reject "p 0b2"
+ test_print_reject "p 0b12"
}
proc test_float_accepted {} {
for { set x 1 } { $x <= 16 } { incr x } {
gdb_test_no_output "set print $setting $x" "$setting $x repeats"
for { set e 1 } { $e <= 16 } {incr e } {
- set v [expr $e - 1]
+ set v [expr {$e - 1}]
set command "p &ctable2\[${v}*16\]"
if { $x < $e } {
set aval $x
} else {
set aval $e
}
- set xval [expr $x - $e]
+ set xval [expr {$x - $e}]
if { $xval < 0 } {
set xval 0
}
# for the test because that character isn't recognized as an
# escape character.
set ctrlv "\026"
- if [ishost *-*-mingw*] {
+ if {[ishost *-*-mingw*]} {
set ctrlv ""
}
gdb_test_escape_braces "p int1dim\[0\]${ctrlv}@2" " = {0, 1}" {p int1dim[0]@2}
gdb_test_no_output "set print elements 50"
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
proc test_print_array_constants {} {
global hex
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
gdb_test_no_output "set print symbol off"
}
-# Escape a left curly brace to prevent it from being interpreted as
+# Escape a left curly brace to prevent it from being interpreted as
# the beginning of a bound
proc gdb_test_escape_braces { args } {
clean_restart
gdb_load $binfile
-if ![runto marker1] {
+if {![runto marker1]} {
untested "couldn't run to marker1"
}
# Here and elsewhere, we accept
# "long", "long int", or "int" for long variables (whatis.exp already
# has an XFAIL for "int" (Sun cc bug), so no need to fail it here).
-gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure"
+gdb_test "ptype struct t_struct" "type = struct t_struct \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype structure"
# Test the equivalence between '.' and '->' for struct member references.
# IBM's xlc puts out bogus stabs--the stuff field is type 42,
# which isn't defined.
-gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure"
+gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure"
#
# test ptype command with unions
#
-gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union"
+gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned |)char v_char_member;.*\[\r\n\] (short|short int) v_short_member;.*\[\r\n\] int v_int_member;.*\[\r\n\] (long|long int|int) v_long_member;.*\[\r\n\] float v_float_member;.*\[\r\n\] double v_double_member;.*\[\r\n\]\}.*" "ptype union"
# IBM's xlc puts out bogus stabs--the stuff field is type 42,
# which isn't defined.
-gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union"
+gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union"
#
# test ptype command with enums
#
-gdb_test "ptype primary" "type = enum .red, green, blue.*" "ptype unnamed enumeration"
+gdb_test "ptype primary" "type = enum .red, green, blue.*" "ptype unnamed enumeration"
-gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "ptype named enumeration"
+gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "ptype named enumeration"
#
# test ptype command with enums as typedef
#
-gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration"
+gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration"
# And check that whatis shows the name, not "enum {...}".
# This probably fails for all DWARF 1 cases, so assume so for now. -fnf
#
# test ptype command with out-of-order enum values
#
-gdb_test "ptype enum misordered" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype misordered enumeration"
+gdb_test "ptype enum misordered" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype misordered enumeration"
#
# test ptype command with a named enum's value
#
-gdb_test "ptype three" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype named enumeration member"
+gdb_test "ptype three" "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*" "ptype named enumeration member"
-gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumeration member #2"
+gdb_test "ptype red" "type = enum \{red, green, blue\}.*" "ptype unnamed enumeration member #2"
#
# test ptype command with basic C types
#
# I've commented most of this out because it duplicates tests in whatis.exp.
-# I've just left in a token test or 2 which is designed to test that ptype
+# I've just left in a token test or 2 which is designed to test that ptype
# acts like whatis for basic types. If it is thought to be necessary to
# test both whatis and ptype for all the types, the tests should be
# merged into whatis.exp, or else maintenance will be a royal pain -kingdon
# timeout { fail "(timeout) ptype unsigned char" }
#}
-gdb_test "ptype v_short" "type = short(| int).*" "ptype short"
+gdb_test "ptype v_short" "type = short(| int).*" "ptype short"
#send "ptype v_signed_short\n"
#gdb_expect {
#}
-gdb_test "ptype v_int" "type = int.*" "ptype int"
+gdb_test "ptype v_int" "type = int.*" "ptype int"
#send "ptype v_signed_int\n"
#gdb_expect {
#
#send "ptype v_long_array\n"
#gdb_expect {
-# -re "type = (long|int|long int) .2..*$gdb_prompt $" {
+# -re "type = (long|int|long int) .2..*$gdb_prompt $" {
# pass "ptype long array" }
# -re ".*$gdb_prompt $" { fail "ptype long array" }
# timeout { fail "(timeout) ptype long array" }
#
#send "ptype v_signed_long_array\n"
#gdb_expect {
-# -re "type = (long|int|long int) .2..*$gdb_prompt $" {
+# -re "type = (long|int|long int) .2..*$gdb_prompt $" {
# pass "ptype signed long array" }
# -re ".*$gdb_prompt $" { fail "ptype signed long array" }
# timeout { fail "(timeout) ptype signed long array" }
if {[runto_main]} {
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return
}
test_one_input $iradix "-1" "-1"
# test simple two-digit constants
- test_one_input $iradix "10" [expr $iradix]
- test_one_input $iradix "11" [expr $iradix + 1]
- test_one_input $iradix "-10" [expr 0 - $iradix]
- test_one_input $iradix "-11" [expr 0 - $iradix - 1]
+ test_one_input $iradix "10" [expr {$iradix}]
+ test_one_input $iradix "11" [expr {$iradix + 1}]
+ test_one_input $iradix "-10" [expr {0 - $iradix}]
+ test_one_input $iradix "-11" [expr {0 - $iradix - 1}]
# test simple three-digit constants
- test_one_input $iradix "100" [expr $iradix * $iradix]
- test_one_input $iradix "101" [expr $iradix * $iradix + 1]
- test_one_input $iradix "-100" [expr 0 - $iradix * $iradix]
- test_one_input $iradix "-101" [expr 0 - $iradix * $iradix - 1]
+ test_one_input $iradix "100" [expr {$iradix * $iradix}]
+ test_one_input $iradix "101" [expr {$iradix * $iradix + 1}]
+ test_one_input $iradix "-100" [expr {0 - $iradix * $iradix}]
+ test_one_input $iradix "-101" [expr {0 - $iradix * $iradix - 1}]
# test a five-digit constant
test_one_input $iradix "10101" \
- [expr $iradix * $iradix * $iradix * $iradix + $iradix * $iradix + 1]
+ [expr {$iradix * $iradix * $iradix * $iradix + $iradix * $iradix + 1}]
}
test_input_radix 2 "2" "2"
set addr1 [address_get "randomized first address"]
set addr2 [address_get "randomized second address"]
set test "randomized addresses should not match"
-if [string equal $addr1 $addr2] {
+if {[string equal $addr1 $addr2]} {
untested "no randomization detected on this system"
return -1
} else {
set addr1 [address_get "fixed first address"]
set addr2 [address_get "fixed second address"]
set test "fixed addresses should match"
-if [string equal $addr1 $addr2] {
+if {[string equal $addr1 $addr2]} {
pass $test
} else {
fail $test
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_range_stepping_enabled] {
+if {![gdb_range_stepping_enabled]} {
unsupported "range stepping not supported by the target"
return -1
}
# Check that range stepping works well even when it is interrupted by
# ctrl-c.
-if ![target_info exists gdb,nointerrupts] {
+if {![target_info exists gdb,nointerrupts]} {
with_test_prefix "interrupt" {
gdb_test_no_output "set debug remote 1"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# The former version expected the test to return to main().
# Now it expects the test to return to main or to stop in the
# function's epilogue.
- #
+ #
# The problem is that gdb needs to (but doesn't) understand
# function epilogues in the same way as for prologues.
- #
+ #
# If there is no hardware watchpoint (such as a x86 debug register),
# then watchpoints are done "the hard way" by single-stepping the
# target until the value of the watched variable changes. If you
# When you do that, the "top" stack frame may become partially
# deconstructed (as when you pop the frame pointer, for instance),
# and from that point on, GDB can no longer make sense of the stack.
- #
+ #
# A test which stops in the epilogue is trying to determine when GDB
# leaves the stack frame in which the watchpoint was created. It does
# this basically by watching for the frame pointer to change. When
# Preserve the old timeout, and set a new one that should be
# sufficient to avoid timing out during this test.
set oldtimeout $timeout
-set timeout [expr "$timeout + 60"]
+set timeout [expr {$timeout + 60}]
verbose "Timeout is now $timeout seconds" 2
recurse_tests
set regcount 0
foreach reggroup $reggroups {
set regs [fetch_reggroup_regs $reggroup "fetch reggroup regs $reggroup"]
- set regcount [expr $regcount + [llength $regs]]
+ set regcount [expr {$regcount + [llength $regs]}]
}
gdb_assert "[llength $regcount] != 0" "system has reggroup registers"
#
# tests for correctenss of relational operators, associativity and precedence
# with integer type variables
-#
+#
#
# test running programs
#Check that invalid options are rejected.
foreach x {"-raednow" "readnow" "foo" "-readnow s"} {
- set word [lindex $x [expr [llength $x]-1]]
+ set word [lindex $x [expr {[llength $x]-1}]]
gdb_test "add-symbol-file ${binfile} 0 $x" \
"Unrecognized argument \"$word\"" \
"add-symbol-file: unknown option $word"
# Re-load the object giving an explicit address for .text
-set text [ format "0x%x" [expr ${function_foo_addr} + 0x20000] ]
+set text [ format "0x%x" [expr {${function_foo_addr} + 0x20000}] ]
clean_restart
gdb_test "add-symbol-file $binfile -o $offset $text" \
"Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \
# Re-load the object giving an explicit address for .data
-set data [ format "0x%x" [expr ${global_foo_addr} + 0x20000] ]
+set data [ format "0x%x" [expr {${global_foo_addr} + 0x20000}] ]
clean_restart
gdb_test "add-symbol-file $binfile -o $offset -s .data $data" \
"Reading symbols from ${binfile}\.\.\.(\r\n$readnow_re)?" \
fail "$test - loading executable"
return
}
- verbose "$test - time [expr ($load_end_time - $load_begin_time) / 1000] ms"
+ verbose "$test - time [expr {($load_end_time - $load_begin_time) / 1000}] ms"
pass $test
}
# Should see "Breakpoint 1, foo () at reread2.c:9"
set test "run to foo() second time"
- if [is_remote target] {
+ if {[is_remote target]} {
unsupported $test
} else {
gdb_run_cmd
### Second pass: verify that GDB checks the executable file's
### timestamp when the program is *restarted*, not just when it exits.
- if [is_remote target] {
+ if {[is_remote target]} {
unsupported "second pass: GDB should check for changes before running"
} else {
gdb_test "tbreak callee$e" "Temporary breakpoint.*\[0-9\]*\\." \
"caller$c calls callee$e; tbreak callee"
-
+
gdb_test "continue" " callee$e prologue .*/" \
"caller$c calls callee$e; continue to callee"
-
+
# Do a forced return from the callee.
set test "caller$c calls callee$e; return callee now"
# Check that the values of the local variables are what
# they should be.
for {set var 1} {$var <= $c} {incr var} {
- set expected [expr 0x7eeb + $var]
+ set expected [expr {0x7eeb + $var}]
set test "caller$c calls callee$e; return restored l$var to $expected"
set pass_pattern " = $expected"
set unsupported_pattern " = <optimized out>"
send_gdb "step\n"
exp_continue
}
- -re ".*in main after func1.*$gdb_prompt $" {
- pass "simple return"
+ -re ".*in main after func1.*$gdb_prompt $" {
+ pass "simple return"
}
}
# the flags -static-pie -fPIE were needed for Fedora 35 through Fedora
# 38. The source file rtld-step-rtld.c didn't need the _start()
# function either. And, better still, it was possible to call
-# printf() to output progress messages in the pretend/fake RTLD.
+# printf() to output progress messages in the pretend/fake RTLD.
# Sadly, these output statements had to be removed in order to obtain
# code which would work on other Linux distributions / releases.
#
standard_testfile
set executable $testfile
-if [prepare_for_testing "failed to prepare" $executable] {
+if {[prepare_for_testing "failed to prepare" $executable]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
# Now start a new debugger session...
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
}
incr level
}
-
+
# Now iterate through the list of OUTER frames checking that the
# "info frame" output from each still matches what was captured
# during an early query. To avoid cascading failures, checking is
foreach func $outer {
set test [concat "Check $func info frame; stack contains" \
$current $inner $outer]
- if $ok {
+ if {$ok} {
set ok 0
set pat [string_to_regexp "$saved_regs($func)"]
gdb_test_multiple "info frame $level" "$test" {
set count 0
while {$count < 100} {
gdb_test "print i$count" ".* = $count" ""
- set count [expr $count+1]
+ set count [expr {$count+1}]
}
clear_xfail "*-*-*"
pass "$count auto variables correctly initialized"
gdb_file_cmd $binfile
# Test that variables in various segments print out correctly before
-# the program is run.
+# the program is run.
# AIX--sections get mapped to the same address so we can't get the right one.
setup_xfail "rs6000-*-*"
# the name of a debuginfo only file. This file will be stored in the
# gdb.base/ subdirectory.
-if [gdb_gnu_strip_debug $binfile$EXEEXT] {
+if {[gdb_gnu_strip_debug $binfile$EXEEXT]} {
# check that you have a recent version of strip and objcopy installed
unsupported "cannot produce separate debug info files"
return -1
# Verify that GDB responds gracefully to a request to "finish" from
# the outermost frame. On a stub that never exits, this will just
-# run to the stubs routine, so we don't get this error... Thus the
+# run to the stubs routine, so we don't get this error... Thus the
# second condition.
#
# Test "next" over recursive function call.
#
-proc test_next_with_recursion {} {
+proc test_next_with_recursion {} {
global gdb_prompt
global decimal
global binfile
delete_breakpoints
- if [istarget "mips*tx39-*"] {
+ if {[istarget "mips*tx39-*"]} {
set timeout 60
}
# We used to set timeout here for all other targets as well. This
#
# Add a second pass pattern. The behavior differs here between stabs
# and dwarf for one-line functions. Stabs preserves two line symbols
- # (one before the prologue and one after) with the same line number,
+ # (one before the prologue and one after) with the same line number,
# but dwarf regards these as duplicates and discards one of them.
# Therefore the address after the prologue (where the breakpoint is)
# has no exactly matching line symbol, and GDB reports the breakpoint
return -1
}
-if [gdb_gnu_strip_debug $binfile no-main] {
+if {[gdb_gnu_strip_debug $binfile no-main]} {
# check that you have a recent version of strip and objcopy installed
unsupported "cannot produce separate debug info files"
return -1
proc_with_prefix test_setshow_prompt {} {
clean_restart
- if [board_info target exists gdb_prompt] {
+ if {[board_info target exists gdb_prompt]} {
return
}
#
# set it up at a breakpoint so we canplay with the variable values
#
-gdb_test_no_output "set print sevenbit-strings"
+gdb_test_no_output "set print sevenbit-strings"
if {![runto_main]} {
return
set ulong_minus_1 18446744073709551615
set ulong_minus_456 18446744073709551160
}
-}
+}
proc test_set { args } {
global gdb_prompt
- set length [expr [llength $args] - 1]
+ set length [expr {[llength $args] - 1}]
set message "[lindex $args $length]"
- set final [expr $length - 2]
+ set final [expr {$length - 2}]
set count 1
# Set up the variables.
for {set x 0} {$x < $length} {incr x} {
if { "[lindex $args $x]" != "" } {
set arg [lindex $args $x]
- if { ($x == $final) || ([string first ".*" [lindex $args [expr $x + 1]]] >= 0) } {
- set match [lindex $args [expr $x + 1]]
+ if { ($x == $final) || ([string first ".*" [lindex $args [expr {$x + 1}]]] >= 0) } {
+ set match [lindex $args [expr {$x + 1}]]
set mess "$message -- $match"
if { $count != 1 } {
append mess " (#$count)"
set mess "$message -- $match"
}
verbose "doing $arg $match"
- if [gdb_test -nopass "$arg" "$match" "$mess"] {
+ if {[gdb_test -nopass "$arg" "$match" "$mess"]} {
return 1
}
}
#
# Because bare char types can be either signed or unsigned, we just test the
# range of values that are common to both (0-127).
-#
+#
-test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'" "set variable char=0"
-test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1"
-test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)"
-test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
-test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')"
-test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'" "set variable char=97 ('a')"
-test_set "set variable v_char=126" "print v_char" ".\[0-9\]* = 126 \'~\'" "set variable char=126 ('~')"
-test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'" "set variable char=127 (8-bit)"
+test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'" "set variable char=0"
+test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'" "set variable char=1"
+test_set "set variable v_char=7" "print v_char" ".\[0-9\]* = 7 \'.a\'" "set variable char=7 (Bel)"
+test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'" "set variable char=32 (SPC)"
+test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'" "set variable char=65 ('A')"
+test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'" "set variable char=97 ('a')"
+test_set "set variable v_char=126" "print v_char" ".\[0-9\]* = 126 \'~\'" "set variable char=126 ('~')"
+test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'" "set variable char=127 (8-bit)"
#
# test "set variable" for type "signed char"
-#
-test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'" "set variable signed char=0"
-test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1"
-test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)"
-test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
-test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')"
-test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'" "set variable signed char=97 ('a')"
-test_set "set variable v_signed_char=126" "print v_signed_char" ".\[0-9\]* = 126 \'~\'" "set variable signed char=126 ('~')"
-test_set "set variable v_signed_char=127" "print v_signed_char" ".\[0-9\]* = 127 \'.177\'" "set variable signed char=127 (8-bit)"
+#
+test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'" "set variable signed char=0"
+test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'" "set variable signed char=1"
+test_set "set variable v_signed_char=7" "print v_signed_char" ".\[0-9\]* = 7 \'.a\'" "set variable signed char=7 (Bel)"
+test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'" "set variable signed char=32 (SPC)"
+test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'" "set variable signed char=65 ('A')"
+test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'" "set variable signed char=97 ('a')"
+test_set "set variable v_signed_char=126" "print v_signed_char" ".\[0-9\]* = 126 \'~\'" "set variable signed char=126 ('~')"
+test_set "set variable v_signed_char=127" "print v_signed_char" ".\[0-9\]* = 127 \'.177\'" "set variable signed char=127 (8-bit)"
gdb_test_no_output "set variable v_signed_char=-1"
with_target_charset "ASCII" {
#
# test "set variable" for type "unsigned char"
#
-test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'" "set variable unsigned char=0"
-test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1"
-test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)"
-test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
-test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')"
-test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'" "set variable unsigned char=97 ('a')"
-test_set "set variable v_unsigned_char=126" "print v_unsigned_char" ".\[0-9\]* = 126 \'~\'" "set variable unsigned char=126 ('~')"
+test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'" "set variable unsigned char=0"
+test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'" "set variable unsigned char=1"
+test_set "set variable v_unsigned_char=7" "print v_unsigned_char" ".\[0-9\]* = 7 \'.a\'" "set variable unsigned char=7 (Bel)"
+test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'" "set variable unsigned char=32 (SPC)"
+test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'" "set variable unsigned char=65 ('A')"
+test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'" "set variable unsigned char=97 ('a')"
+test_set "set variable v_unsigned_char=126" "print v_unsigned_char" ".\[0-9\]* = 126 \'~\'" "set variable unsigned char=126 ('~')"
with_target_charset "ASCII" {
- test_set "set variable v_unsigned_char=~0" "print v_unsigned_char" ".\[0-9\]* = 255 \'.377\'" "set variable unsigned char=255 (8-bit)"
+ test_set "set variable v_unsigned_char=~0" "print v_unsigned_char" ".\[0-9\]* = 255 \'.377\'" "set variable unsigned char=255 (8-bit)"
}
#
# test "set variable" for type "short"
#
-test_set "set variable v_short=0" "print v_short" ".\[0-9\]* = 0" "set variable short=0"
-test_set "set variable v_short=1" "print v_short" ".\[0-9\]* = 1" "set variable short=1"
-test_set "set variable v_short=-1" "print v_short" ".\[0-9\]* = -1" "set variable short=-1 (minus)"
+test_set "set variable v_short=0" "print v_short" ".\[0-9\]* = 0" "set variable short=0"
+test_set "set variable v_short=1" "print v_short" ".\[0-9\]* = 1" "set variable short=1"
+test_set "set variable v_short=-1" "print v_short" ".\[0-9\]* = -1" "set variable short=-1 (minus)"
#
# test "set variable" for type "signed short"
#
-test_set "set variable v_signed_short=0" "print v_signed_short" ".\[0-9\]* = 0" "set variable signed short=0"
-test_set "set variable v_signed_short=1" "print v_signed_short" ".\[0-9\]* = 1" "set variable signed short=1"
-test_set "set variable v_signed_short=-1" "print v_signed_short" ".\[0-9\]* = -1" "set variable signed short=-1 (minus)"
+test_set "set variable v_signed_short=0" "print v_signed_short" ".\[0-9\]* = 0" "set variable signed short=0"
+test_set "set variable v_signed_short=1" "print v_signed_short" ".\[0-9\]* = 1" "set variable signed short=1"
+test_set "set variable v_signed_short=-1" "print v_signed_short" ".\[0-9\]* = -1" "set variable signed short=-1 (minus)"
#
# test "set variable" for type "unsigned short"
#
-test_set "set variable v_unsigned_short=0" "print v_unsigned_short" ".\[0-9\]* = 0" "set variable unsigned short=0"
-test_set "set variable v_unsigned_short=1" "print v_unsigned_short" ".\[0-9\]* = 1" "set variable unsigned short=1"
-test_set "set variable v_unsigned_short=~0" "print v_unsigned_short" ".\[0-9\]* = 65535" "set variable unsigned short=~0 (minus)"
+test_set "set variable v_unsigned_short=0" "print v_unsigned_short" ".\[0-9\]* = 0" "set variable unsigned short=0"
+test_set "set variable v_unsigned_short=1" "print v_unsigned_short" ".\[0-9\]* = 1" "set variable unsigned short=1"
+test_set "set variable v_unsigned_short=~0" "print v_unsigned_short" ".\[0-9\]* = 65535" "set variable unsigned short=~0 (minus)"
#
# test "set variable" for type "int"
#
-test_set "set variable v_int=0" "print v_int" ".\[0-9\]* = 0" "set variable int=0"
-test_set "set variable v_int=1" "print v_int" ".\[0-9\]* = 1" "set variable int=1"
-test_set "set variable v_int=-1" "print v_int" ".\[0-9\]* = -1" "set variable int=-1 (minus)"
+test_set "set variable v_int=0" "print v_int" ".\[0-9\]* = 0" "set variable int=0"
+test_set "set variable v_int=1" "print v_int" ".\[0-9\]* = 1" "set variable int=1"
+test_set "set variable v_int=-1" "print v_int" ".\[0-9\]* = -1" "set variable int=-1 (minus)"
#
# test "set variable" for type "signed int"
#
-test_set "set variable v_signed_int=0" "print v_signed_int" ".\[0-9\]* = 0" "set variable signed int=0"
-test_set "set variable v_signed_int=1" "print v_signed_int" ".\[0-9\]* = 1" "set variable signed int=1"
-test_set "set variable v_signed_int=-1" "print v_signed_int" ".\[0-9\]* = -1" "set variable signed int=-1 (minus)"
+test_set "set variable v_signed_int=0" "print v_signed_int" ".\[0-9\]* = 0" "set variable signed int=0"
+test_set "set variable v_signed_int=1" "print v_signed_int" ".\[0-9\]* = 1" "set variable signed int=1"
+test_set "set variable v_signed_int=-1" "print v_signed_int" ".\[0-9\]* = -1" "set variable signed int=-1 (minus)"
#
# test "set variable" for type "unsigned int"
#
-test_set "set variable v_unsigned_int=0" "print v_unsigned_int" ".\[0-9\]* = 0" "set variable unsigned int=0"
-test_set "set variable v_unsigned_int=1" "print v_unsigned_int" ".\[0-9\]* = 1" "set variable unsigned int=1"
-test_set "set variable v_unsigned_int=~0" "print v_unsigned_int" ".\[0-9\]* = (4294967295|65535)" "set variable unsigned int=~0 (minus)"
-#test_set ".\[0-9\]* = 65535" "set variable unsigned int=~0 (minus)"
+test_set "set variable v_unsigned_int=0" "print v_unsigned_int" ".\[0-9\]* = 0" "set variable unsigned int=0"
+test_set "set variable v_unsigned_int=1" "print v_unsigned_int" ".\[0-9\]* = 1" "set variable unsigned int=1"
+test_set "set variable v_unsigned_int=~0" "print v_unsigned_int" ".\[0-9\]* = (4294967295|65535)" "set variable unsigned int=~0 (minus)"
+#test_set ".\[0-9\]* = 65535" "set variable unsigned int=~0 (minus)"
#
# test "set variable" for type "long"
#
-test_set "set variable v_long=0" "print v_long" ".\[0-9\]* = 0" "set variable long=0"
-test_set "set variable v_long=1" "print v_long" ".\[0-9\]* = 1" "set variable long=1"
-test_set "set variable v_long=-1" "print v_long" ".\[0-9\]* = -1" "set variable long=-1 (minus)"
+test_set "set variable v_long=0" "print v_long" ".\[0-9\]* = 0" "set variable long=0"
+test_set "set variable v_long=1" "print v_long" ".\[0-9\]* = 1" "set variable long=1"
+test_set "set variable v_long=-1" "print v_long" ".\[0-9\]* = -1" "set variable long=-1 (minus)"
#
# test "set variable" for type "signed long"
#
-test_set "set variable v_signed_long=0" "print v_signed_long" ".\[0-9\]* = 0" "set variable signed long=0"
-test_set "set variable v_signed_long=1" "print v_signed_long" ".\[0-9\]* = 1" "set variable signed long=1"
-test_set "set variable v_signed_long=-1" "print v_signed_long" ".\[0-9\]* = -1" "set variable signed long=-1 (minus)"
+test_set "set variable v_signed_long=0" "print v_signed_long" ".\[0-9\]* = 0" "set variable signed long=0"
+test_set "set variable v_signed_long=1" "print v_signed_long" ".\[0-9\]* = 1" "set variable signed long=1"
+test_set "set variable v_signed_long=-1" "print v_signed_long" ".\[0-9\]* = -1" "set variable signed long=-1 (minus)"
#
# test "set variable" for type "unsigned long"
#
-test_set "set variable v_unsigned_long=0" "print v_unsigned_long" ".\[0-9\]* = 0" "set variable unsigned long=0"
-test_set "set variable v_unsigned_long=1" "print v_unsigned_long" ".\[0-9\]* = 1" "set variable unsigned long=1"
-test_set "set variable v_unsigned_long=~0" "print v_unsigned_long" ".\[0-9\]* = $ulong_minus_1" "set variable unsigned long=~0 (minus)"
+test_set "set variable v_unsigned_long=0" "print v_unsigned_long" ".\[0-9\]* = 0" "set variable unsigned long=0"
+test_set "set variable v_unsigned_long=1" "print v_unsigned_long" ".\[0-9\]* = 1" "set variable unsigned long=1"
+test_set "set variable v_unsigned_long=~0" "print v_unsigned_long" ".\[0-9\]* = $ulong_minus_1" "set variable unsigned long=~0 (minus)"
#
# test "set variable" for type "float"
#
-test_set "set variable v_float=0.0" "print v_float" ".\[0-9\]* = 0" "set variable float=0"
-test_set "set variable v_float=1.0" "print v_float" ".\[0-9\]* = 1" "set variable float=1"
-test_set "set variable v_float=-1.0" "print v_float" ".\[0-9\]* = -1" "set variable float=-1 (minus)"
+test_set "set variable v_float=0.0" "print v_float" ".\[0-9\]* = 0" "set variable float=0"
+test_set "set variable v_float=1.0" "print v_float" ".\[0-9\]* = 1" "set variable float=1"
+test_set "set variable v_float=-1.0" "print v_float" ".\[0-9\]* = -1" "set variable float=-1 (minus)"
#
# test "set variable" for type "double"
#
-test_set "set variable v_double=0.0" "print v_double" ".\[0-9\]* = 0" "set variable double=0"
-test_set "set variable v_double=1.0" "print v_double" ".\[0-9\]* = 1" "set variable double=1"
-test_set "set variable v_double=-1.0" "print v_double" ".*.\[0-9\]* = -1" "set variable double=-1 (minus)"
+test_set "set variable v_double=0.0" "print v_double" ".\[0-9\]* = 0" "set variable double=0"
+test_set "set variable v_double=1.0" "print v_double" ".\[0-9\]* = 1" "set variable double=1"
+test_set "set variable v_double=-1.0" "print v_double" ".*.\[0-9\]* = -1" "set variable double=-1 (minus)"
#
# test "set variable" for "char array[2]"
#
-test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable char array=\"hi\" (string)"
+test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable char array=\"hi\" (string)"
#
# test "set variable" for "signed char array[2]"
#
-test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable signed char array=\"hi\" (string)"
+test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable signed char array=\"hi\" (string)"
#
# test "set variable" for "unsigned char array[2]"
#
-test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable unsigned char array=\"hi\" (string)"
+test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "set variable unsigned char array=\"hi\" (string)"
#
# test "set variable" for "short array[2]"
#
-test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable short array"
+test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable short array"
#
# test "set variable" for "signed short array[2]"
#
-test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed short array"
+test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed short array"
#
# test "set variable" for "unsigned short array[2]"
#
-test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" ".*.\[0-9\]* =.*\\{123,.*65080\\}" "set variable unsigned short array"
+test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" ".*.\[0-9\]* =.*\\{123,.*65080\\}" "set variable unsigned short array"
#
# test "set variable" for "int array[2]"
#
-test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable int array"
+test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable int array"
#
# test "set variable" for "signed int array[2]"
#
-test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed int array"
+test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed int array"
#
# test "set variable" for "unsigned int array[2]"
#
-test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\\{123,.*(4294966840|65080)\\}" "set variable unsigned int array"
+test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" ".*.\[0-9\]* =.*\\{123,.*(4294966840|65080)\\}" "set variable unsigned int array"
#
# test "set variable" for "long array[2]"
#
-test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable long array"
+test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable long array"
#
# test "set variable" for "signed long array[2]"
#
-test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed long array"
+test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable signed long array"
#
# test "set variable" for "unsigned long array[2]"
#
-test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "set variable unsigned long array"
+test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "set variable unsigned long array"
#
# test "set variable" for "float array[2]"
#
-test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable float array"
+test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable float array"
#
# test "set variable" for "double array[2]"
#
-test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable double array"
+test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "set variable double array"
#
# test "set variable" for type "char *"
#
-test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" "set variable *(v_char_pointer+1)='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable char pointer=\"hi\" (string)"
+test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" "set variable *(v_char_pointer+1)='i'" "print v_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable char pointer=\"hi\" (string)"
#
# test "set variable" for type "signed char *"
#
-test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_signed_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)"
+test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_signed_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable signed char pointer=\"hi\" (string)"
#
# test "set variable" for type "unsigned char *"
#
-test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_unsigned_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)"
+test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" ".*.\[0-9\]* =.*\"hi\"" "print *(v_unsigned_char_pointer+1)" ".*.\[0-9\]* = 105 \'i\'" "set variable unsigned char pointer=\"hi\" (string)"
#
# test "set variable" for type "short *"
#
-test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_short_pointer+1)" ".*.\[0-9\]* = -456" "set variable short pointer"
+test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_short_pointer+1)" ".*.\[0-9\]* = -456" "set variable short pointer"
#
# test "set variable" for type "signed short *"
#
#
# test "set variable" for type "int *"
#
-test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable int pointer"
+test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable int pointer"
#
# test "set variable" for type "signed int *"
#
-test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed int pointer"
+test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_int_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed int pointer"
#
# test "set variable" for type "unsigned int *"
#
#
# test "set variable" for type "long *"
#
-test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable long pointer"
+test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable long pointer"
#
# test "set variable" for type "signed long *"
#
-test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed long pointer"
+test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_signed_long_pointer+1)" ".*.\[0-9\]* = -456" "set variable signed long pointer"
#
# test "set variable" for type "unsigned long *"
#
-test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "print *(v_unsigned_long_pointer+1)" ".*.\[0-9\]* = $ulong_minus_456" "set variable unsigned long pointer"
+test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" ".*.\[0-9\]* =.*\\{123,.*$ulong_minus_456\\}" "print *(v_unsigned_long_pointer+1)" ".*.\[0-9\]* = $ulong_minus_456" "set variable unsigned long pointer"
#
# test "set variable" for type "float *"
#
-test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_float_pointer+1)" ".*.\[0-9\]* = -456" "set variable float pointer"
+test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_float_pointer+1)" ".*.\[0-9\]* = -456" "set variable float pointer"
#
# test "set variable" for type "double *"
#
-test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_double_pointer+1)" ".*.\[0-9\]* = -456" "set variable double pointer"
+test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" ".*.\[0-9\]* =.*\\{123,.*-456\\}" "print *(v_double_pointer+1)" ".*.\[0-9\]* = -456" "set variable double pointer"
#
# test "set variable" for struct members
#
-test_set "set variable v_struct1.v_char_member='h'" "print v_struct1.v_char_member" ".*.\[0-9\]* = 104 \'h\'" "set variable structure char member"
-test_set "set variable v_struct1.v_short_member=1" "print v_struct1.v_short_member" ".*.\[0-9\]* = 1" "set variable structure short member"
-test_set "set variable v_struct1.v_int_member=2" "print v_struct1.v_int_member" ".*.\[0-9\]* = 2" "set variable structure int member"
-test_set "set variable v_struct1.v_long_member=3" "print v_struct1.v_long_member" ".*.\[0-9\]* = 3" "set variable structure long member"
-test_set "set variable v_struct1.v_float_member=4.0" "print v_struct1.v_float_member" ".*.\[0-9\]* = 4" "set variable structure float member"
-test_set "set variable v_struct1.v_double_member=5.0" "print v_struct1.v_double_member" ".*.\[0-9\]* = 5" "set variable structure double member"
+test_set "set variable v_struct1.v_char_member='h'" "print v_struct1.v_char_member" ".*.\[0-9\]* = 104 \'h\'" "set variable structure char member"
+test_set "set variable v_struct1.v_short_member=1" "print v_struct1.v_short_member" ".*.\[0-9\]* = 1" "set variable structure short member"
+test_set "set variable v_struct1.v_int_member=2" "print v_struct1.v_int_member" ".*.\[0-9\]* = 2" "set variable structure int member"
+test_set "set variable v_struct1.v_long_member=3" "print v_struct1.v_long_member" ".*.\[0-9\]* = 3" "set variable structure long member"
+test_set "set variable v_struct1.v_float_member=4.0" "print v_struct1.v_float_member" ".*.\[0-9\]* = 4" "set variable structure float member"
+test_set "set variable v_struct1.v_double_member=5.0" "print v_struct1.v_double_member" ".*.\[0-9\]* = 5" "set variable structure double member"
gdb_test "print v_struct1" \
".*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\
gdb_test "print g" "\[0-9\]* = 1"
#step -over
-if ![gdb_skip_stdio_test "next over shr1"] {
+if {![gdb_skip_stdio_test "next over shr1"]} {
gdb_test_stdio "next" \
"address of sgs is $hex" \
"g = shr2\\(g\\);" \
gdb_test "print g" "\[0-9\]* = 2" "print g two"
#print shr1(1)
-if ![gdb_skip_stdio_test "print shr1(1)"] {
+if {![gdb_skip_stdio_test "print shr1(1)"]} {
gdb_test_stdio "print shr1(1)" \
"address of sgs is $hex" \
"\[0-9\]* = 2" \
}
#print shr1(g)
-if ![gdb_skip_stdio_test "print shr1(g)"] {
+if {![gdb_skip_stdio_test "print shr1(g)"]} {
gdb_test_stdio "print shr1(g)" \
"address of sgs is $hex" \
"\[0-9\]* = 4" \
#print shr1(1)
-if ![gdb_skip_stdio_test "print shr1(1) 2nd time"] {
+if {![gdb_skip_stdio_test "print shr1(1) 2nd time"]} {
gdb_test_stdio "print shr1(1)" \
"address of sgs is $hex" \
"\[0-9\]* = 2" \
# assuming that GDB has disabled some breakpoints.
set stop_after_bp_re [multi_line \
"^$::bp_disabled_re" \
- "[expr $::bp_line + 1]\\s+assert \\(res == 0\\);"]
+ "[expr {$::bp_line + 1}]\\s+assert \\(res == 0\\);"]
# Checking that a breakpoint with multiple locations in a shared
# library only triggers a single breakpoint modified event from
lappend lib_opts "ldflags=-Wl,--image-base,0x04000000"
}
-if [test_compiler_info "xlc-*"] {
+if {[test_compiler_info "xlc-*"]} {
- # IBM's xlc compiler does not add static variables to the ELF symbol
- # table by default. We need this option to make the variables show
- # up in "maint print msymbols".
+ # IBM's xlc compiler does not add static variables to the ELF symbol
+ # table by default. We need this option to make the variables show
+ # up in "maint print msymbols".
lappend lib_opts "additional_flags=-qstatsym"
return 1
}
-if [is_remote host] {
+if {[is_remote host]} {
set msymfile shreloc.txt
} else {
set msymfile [standard_output_file shreloc.txt]
}
-if [send_gdb_discard "maint print msymbols ${msymfile}"] {
+if {[send_gdb_discard "maint print msymbols ${msymfile}"]} {
if {[check_different "static_var_\[12\]" "${msymfile}"]} {
pass "(msymbol) relocated static vars have different addresses"
} else {
# Now single step the faulted instrction at that breakpoint.
gdb_test "stepi" \
"Program received signal ${signame}.*pc(\r\n| *)=> [at_segv] .*" \
- "${name}; stepi fault"
+ "${name}; stepi fault"
# Clear any breakpoints
for {set i 0} {$i < [llength $args]} {incr i} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
set wait_status [remote_wait target 60]
-set have_standalone [expr [lindex $wait_status 0] == 0]
+set have_standalone [expr {[lindex $wait_status 0] == 0}]
gdb_assert { $have_standalone } "collect standalone signals state"
remote_close target
# Increase timeout and expect input buffer for large output from gdb.
# Allow blank or TAB as whitespace characters.
set oldtimeout $timeout
- set timeout [expr "$timeout + 60"]
+ set timeout [expr {$timeout + 60}]
verbose "Timeout is now $timeout seconds" 2
if { ![istarget "*-*-linux*"]
&& ( [istarget "*-*-gnu*"]
gdb_test "signal" \
"Argument required .signal number..*" \
"signal without arguments disallowed"
-
+
# Verify that we can successfully send a signal other than 0 to
# the inferior. (This probably causes the inferior to run away.
# Be prepared to rerun to main for further testing.)
require {!target_info exists gdb,nosignals}
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
return -1
}
gdb_expect {
-re ".*dump" {
#pass "maint print arch $ok"
- #set ok [expr $ok + 1]
+ #set ok [expr {$ok + 1}]
}
-re "$gdb_prompt $" {
pass "maint print arch"
set srcfile1 skip1.c
proc_with_prefix single_step { } {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
proc_with_prefix double_step { } {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
proc_with_prefix triple_step { } {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
proc_with_prefix skip_current_frame { } {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
"Num\\s+Enb\\s+Glob\\s+File\\s+RE\\s+Function\\s*" \
"1\\s+y\\s+n\\s+${srcfile_lib}\\s+n\\s+<none>\\s*"]
- if ![runto_main] {
+ if {![runto_main]} {
return
}
"Function multiply will be skipped when stepping\\." \
"skip function"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
gdb_test "skip -x" "Invalid skip option: -x"
gdb_test "skip -rfu foo.* xyzzy" "Invalid argument: xyzzy"
-if ![runto_main] {
+if {![runto_main]} {
return
}
# files, so when we step into the first line in main(), we should step
# right over it and go to the second line of main().
-if ![runto_main] {
+if {![runto_main]} {
return
}
"4\\s+y\\s+n\\s+<none>\\s+n\\s+baz"] \
"info skip (delete 1)"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
"3\\s+n\\s+n\\s+$srcfile1\\s+n\\s+<none>\\s*" \
"info skip shows entry as disabled"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
"3\\s+y\\s+n\\s+$srcfile1\\s+n\\s+<none>\\s*" \
"info skip shows entry as enabled"
- if ![runto_main] {
+ if {![runto_main]} {
return
}
gdb_test "skip -rfu ^b.z$" "Function\\(s\\) \\^b\\.z\\$ will be skipped when stepping."
with_test_prefix "step using -fi" {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
with_test_prefix "step using -gfi" {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
with_test_prefix "step using -fu for baz" {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
with_test_prefix "step using -rfu for baz" {
- if ![runto_main] {
+ if {![runto_main]} {
return
}
with_test_prefix "step using -fi + -fu" {
gdb_test_no_output "skip delete"
- if ![runto test_skip_file_and_function] {
+ if {![runto test_skip_file_and_function]} {
return
}
global binfile
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
# corruption cannot be tested. Disable the probes interface.
gdb_test "maint ignore-probes rtld"
-if ![runto_main] {
+if {![runto_main]} {
return
}
"set cwd OBJDIR/${subdir}"
set test "library loaded"
-if [runto_main] {
+if {[runto_main]} {
pass $test
} else {
fail $test
# Prelink first lib1 at 0x40000000 and lib2 at 0x41000000.
# During second pass try lib1 at 0x50000000 and lib2 at 0x51000000.
foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1" {
- set prelink_lib2 [format "0x%x" [expr $prelink_lib1 + 0x01000000]]
+ set prelink_lib2 [format "0x%x" [expr {$prelink_lib1 + 0x01000000}]]
# Library file.
set binfile_lib1 [standard_output_file ${libname}1-${prelink_lib1}.so]
return -1
}
- if {[catch "exec prelink -N -r ${prelink_lib1} ${binfile_lib1}" output] != 0
- || [catch "exec prelink -N -r ${prelink_lib2} ${binfile_lib2}" output] != 0} {
+ if {[catch {exec prelink -N -r ${prelink_lib1} ${binfile_lib1}} output] != 0
+ || [catch {exec prelink -N -r ${prelink_lib2} ${binfile_lib2}} output] != 0} {
# Maybe we don't have prelink.
verbose -log "prelink failed: $output"
untested "could not prelink ${binfile_lib1_test_msg} or ${binfile_lib2_test_msg}."
set lib1 [standard_output_file ${libfile1}.sl]
set lib2 [standard_output_file ${libfile2}.sl]
- if $lib1first {
+ if {$lib1first} {
set exec_opts [list debug shlib=${lib1} shlib=${lib2}]
set expected_file ${libfile1}
} else {
# All of these pathname and directory manipulations assume
# host == build, so do not attempt this set of tests on remote host.
- if [is_remote host] {
+ if {[is_remote host]} {
return
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
set disasm_after [disassemble "after"]
set test "before/after disassembly matches"
-if ![string compare $disasm_before $disasm_after] {
+if {![string compare $disasm_before $disasm_after]} {
pass $test
} else {
fail $test
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
- if { [expr $no_probes_line && $probe_count > 0] \
- || [expr !$no_probes_line && $probe_count == 0] } {
+ if { ($no_probes_line && $probe_count > 0) \
+ || (!$no_probes_line && $probe_count == 0) } {
perror "Mismatch between no probes found line, and probes count"
return -1
}
set binfile [standard_output_file $binfile]
set command "exec $readelf_program -n $binfile"
verbose -log "command is $command"
- set result [catch $command output]
+ set result [catch {{*}$command} output]
verbose -log "result is $result"
verbose -log "output is $output"
# First, look for the xmmreg probe, and if we find it, grab the
# argument string.
- if ![regexp {\n\s+Provider: test\n\s+Name: xmmreg\n[^\n]+\n\s+Arguments: ([^\n]+)\n} $output ignore arguments] {
+ if {![regexp {\n\s+Provider: test\n\s+Name: xmmreg\n[^\n]+\n\s+Arguments: ([^\n]+)\n} $output ignore arguments]} {
verbose -log "APB: Couldn't find probe at all"
return false
}
verbose -log "APB: arguments: '$arguments'"
# Check the the argument string mentions xmm0.
- if ![regexp {@%?xmm0} $arguments] {
+ if {![regexp {@%?xmm0} $arguments]} {
verbose -log "APB: Prove doesn't use xmm0 register"
return false
}
"get original address of relocation_marker"]
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
[get_hexadecimal_valueof "&relocation_marker" \
"0" "get revised relocation_marker address"]
set relocation_base \
- [expr $updated_semaphore_addr_var - $semaphore_addr_var]
+ [expr {$updated_semaphore_addr_var - $semaphore_addr_var}]
if {$relocation_base != 0} {
# Checks that GDB doesn't mistakenly relocate and write to null
# semaphore addresses. If it were to relocate a zero-valued
"print \$_probe_arg1 for probe ps"
# Check the probe is using the xmm0 register.
- if [check_for_usable_xmm0_probe $exec_name] {
+ if {[check_for_usable_xmm0_probe $exec_name]} {
delete_breakpoints
if {[runto "-pstap test:xmmreg"]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
lappend options "pthreads"
}
- if [build_executable ${testfile}.exp ${testfile} ${testfile}.c $options] {
+ if {[build_executable ${testfile}.exp ${testfile} ${testfile}.c $options]} {
untested "failed to compile"
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "up" " call-func .*"
gdb_test_no_output {set $b=$pc}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile
-if [build_executable "failed to build" ${testfile} ${srcfile} {debug}] {
+if {[build_executable "failed to build" ${testfile} ${srcfile} {debug}]} {
return -1
}
gdb_test_no_output "set displaced-stepping $displaced"
gdb_test_no_output "set breakpoint always-inserted $always_inserted"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# We need those symbols global to access them from the .S file.
set test "strip stub symbols"
set objcopy_program [gdb_find_objcopy]
-set result [catch "exec $objcopy_program -N symless ${binfile}" output]
+set result [catch {exec $objcopy_program -N symless ${binfile}} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
clean_restart $testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Set a breakpoint at line 45, if stepi then finish fails, we would
# run to the end of the program, which would mess up the rest of the tests.
-
+
# Vanilla step/next
#
gdb_test "next" ".*${decimal}.*x = 1;.*" "next 1"
###
### The exact regexps used are "$HERE.*$gdb_prompt $"
### and "$THERE.*$gdb_prompt $"
-###
+###
proc test_i {name command here there} {
global gdb_prompt
-
+
set i 0
gdb_test_multiple "$command" "$name" {
-re "$here.*$gdb_prompt $" {
# if this passes through a (useless) PLT entry.
test_i "stepi into function" "stepi" \
"(.*${decimal}.*callee.*STEPI|.* in callee@plt)" \
- ".*callee \\(\\) at .*step-test\\.c"
+ ".*callee \\(\\) at .*step-test\\.c"
# Continue to step until we reach the function's body. This makes it
# more likely that we've actually completed the prologue, so "finish"
"(${decimal}.*int callee|$pic_thunk_re)" \
".*${decimal}.*myglob.*; return 0;"
-# Have to be careful here, if the finish does not work,
+# Have to be careful here, if the finish does not work,
# then we may run to the end of the program, which
# will cause erroneous failures in the rest of the tests
set test "stepi: finish call"
pass "$test"
}
-re ".*(Program received|$inferior_exited_re).*$gdb_prompt $" {
- # Oops... We ran to the end of the program... Better reset
+ # Oops... We ran to the end of the program... Better reset
if {![runto_main]} {
return 0
}
get_debug_format
# Limit the slow $anychar_re{256} matching for better performance.
- if $first {
+ if {$first} {
set first 0
# Verify $anychar_re can match all the values of `char' type.
# Check that GDB can always extract a struct-return value from an
# inferior function call. Since GDB always knows the location of an
# inferior function call's return value these should never fail
-
+
# Implemented by calling the parameterless function "fun$N" and then
# examining the return value printed by GDB.
pass "${test}"
}
-re " = [any $n].*${gdb_prompt} $" {
- if $return_value_known {
+ if {$return_value_known} {
# This contradicts the above claim that GDB knew
# the location of the return value.
fail "${test}"
}
}
-re ".*${gdb_prompt} $" {
- if $return_value_unimplemented {
+ if {$return_value_unimplemented} {
# What a surprise. The architecture hasn't implemented
# return_value, and hence has to fail.
kfail "$test" gdb/1444
fail "$test"
}
}
- }
-
+ }
+
# Check that a "finish" works.
# This is almost but not quite the same as "call struct funcs".
set test "value foo<n> finished; ${tests}"
gdb_test_multiple "p/c" "${test}" {
-re "[foo ${n}]\[\r\n\]+${gdb_prompt} $" {
- if $finish_value_known {
+ if {$finish_value_known} {
pass "${test}"
} else {
# This contradicts the above claim that GDB didn't
}
-re "[zed ${n}]\[\r\n\]+${gdb_prompt} $" {
# The value didn't get found. This is "expected".
- if $finish_value_known {
+ if {$finish_value_known} {
# This contradicts the above claim that GDB did
# know the location of the return-value.
fail "${test}"
"Breakpoint .* at .*" \
"structs2 breakpoint set"
-if [test_compiler_info gcc-3-*] {
+if {[test_compiler_info gcc-3-*]} {
setup_xfail hppa*-* gcc/15860
}
gdb_test "continue" \
".*pr_char=120.*pr_uchar=130.*pr_short=32000.*pr_ushort=33000.*bkpt = 1.*" \
"structs2 continue1"
-if [test_compiler_info gcc-3-*] {
+if {[test_compiler_info gcc-3-*]} {
setup_xfail hppa*-* gcc/15860
}
gdb_test "continue" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# - 4 leading spaces
# - argv string
# - closing parenthesis
- set line_len [expr 4 + $argv_len + 1]
+ set line_len [expr {4 + $argv_len + 1}]
if { $argv == "argv=0x0" && $width >= 27 } {
# Embedded target with no argv support.
# Then compare string lengths to get a count of the '\033'
# charactes present in STR.
regsub -all "\033" $str {} stripped
- set count [expr [string length $str] - [string length $stripped]]
+ set count [expr {[string length $str] - [string length $stripped]}]
# If STR switched styles, then it _must_ switch back again,
# otherwise the pagination prompt will be in the wrong style.
# This means that there _must_ be an even number of '\033'
# characters in STR. If there is not then we switched style, but
# failed to switch back.
- if { [expr $count % 2] != 0 } {
+ if {$count % 2 != 0} {
return false
}
standard_testfile symbol-alias.c symbol-alias2.c
# Clang versions prior to v15 do not emit debug info for aliases.
-set old_clang [expr [test_compiler_info {clang-1[0-4]-*-*}] \
- || [test_compiler_info {clang-[1-9]-*}]]
+set old_clang [expr {[test_compiler_info {clang-1[0-4]-*-*}] \
+ || [test_compiler_info {clang-[1-9]-*}]}]
if { [prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile2]] } {
return -1
gdb_load $binfile
gdb_load_shlib $lib1
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
if {[string match "$varname=*" $var]} {
- set from [expr [string first "=" $var] + 1]
+ set from [expr {[string first "=" $var] + 1}]
set to [string length $var]
return [string range $var $from $to]
}
# First test with no TEST_GDB_VAR.
with_test_prefix "test1" {
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
test_num_test_vars 0 "no TEST_GDB vars"
gdb_test_no_output "set env TEST_GDB_VAR1 test1" \
"set TEST_GDB_VAR1"
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
test_num_test_vars 1 "one TEST_GDB var"
gdb_test_no_output "set env TEST_GDB_VAR2 test2" \
"set TEST_GDB_VAR2"
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
gdb_test_no_output "unset env TEST_GDB_VAR1" \
"unset TEST_GDB_VAR1"
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
# This test assumes that the build's environ (where dejagnu runs)
# is the same as the host's (where gdb runs) environ.
- if [is_remote host] {
+ if {[is_remote host]} {
return
}
# First test with only inherited TEST_GDB_GLOBAL.
with_test_prefix "test1" {
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
gdb_test_no_output "unset env TEST_GDB_GLOBAL" \
"unset TEST_GDB_GLOBAL"
- if ![run_and_count_vars] {
+ if {![run_and_count_vars]} {
return
}
# use of internal TLS support for architectures which don't support
# it.
-if [is_any_target {*}$internal_tls_linux_targets] {
+if {[is_any_target {*}$internal_tls_linux_targets]} {
set internal_tls_iters { false true }
} else {
set internal_tls_iters { false }
# issue gdb_test with command CMD and regular expression RE.
proc gdb_test_with_kfail {cmd re kfail_cond kfail_msg} {
- if [uplevel 1 [list expr $kfail_cond]] {
+ if {[uplevel 1 [list expr $kfail_cond]]} {
setup_kfail $kfail_msg *-*-*
}
gdb_test $cmd $re
pass $gdb_test_name
}
-re -wrap "The inferior has not yet allocated storage for thread-local variables.*" {
- if [ uplevel 1 [list expr $cond]] {
+ if {[ uplevel 1 [list expr $cond]]} {
xfail $gdb_test_name
} else {
fail $gdb_test_name
proc do_tests {force_internal_tls} {
clean_restart
gdb_load $::binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
- if $force_internal_tls {
+ if {$force_internal_tls} {
gdb_test_no_output "maint set force-internal-tls-address-lookup on"
}
}
# Finish test early if no core file was made.
- if !$core_supported {
+ if {!$core_supported} {
return
}
}
with_test_prefix "core file" {
- if $force_internal_tls {
+ if {$force_internal_tls} {
gdb_test_no_output "maint set force-internal-tls-address-lookup on"
}
proc do_tests {force_internal_tls {do_kfail_tls_access 0}} {
clean_restart
gdb_load $::binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
- if $force_internal_tls {
+ if {$force_internal_tls} {
gdb_test_no_output "maint set force-internal-tls-address-lookup on"
}
# Also turn off do_kfail_tls_access when connected to a
# gdbserver and we observe that accessing a TLS variable
# works.
- if [target_is_gdbserver] {
+ if {[target_is_gdbserver]} {
gdb_test_multiple "print tls_main_tbss_1" \
"Check TLS accessibility when connected to a gdbserver" {
-re -wrap "= 0" {
}
# Finish test early if no core file was made.
- if !$core_supported {
+ if {!$core_supported} {
return
}
}
with_test_prefix "core file" {
- if $force_internal_tls {
+ if {$force_internal_tls} {
gdb_test_no_output "maint set force-internal-tls-address-lookup on"
}
proc do_tests {force_internal_tls {do_kfail_tls_access 0}} {
clean_restart
gdb_load $::binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
- if $force_internal_tls {
+ if {$force_internal_tls} {
gdb_test_no_output "maint set force-internal-tls-address-lookup on"
}
# Also turn off do_kfail_tls_access when connected to a
# gdbserver and we observe that accessing a TLS variable
# works.
- if [target_is_gdbserver] {
+ if {[target_is_gdbserver]} {
gdb_test_multiple "print tls_tbss_1" "Check TLS accessibility when connected to a gdbserver" {
-re -wrap "= 0" {
set do_kfail_tls_access 0
set binfile_stripped "${::binfile}.stripped"
set objcopy [gdb_find_objcopy]
set cmd "$objcopy --strip-debug ${::binfile} $binfile_stripped"
- if ![catch "exec $cmd" cmd_output] {
+ if {![catch {exec {*}$cmd} cmd_output]} {
clean_restart
gdb_load $binfile_stripped
- if ![runto_main] {
+ if {![runto_main]} {
return
}
- if $force_internal_tls {
+ if {$force_internal_tls} {
gdb_test_no_output "maint set force-internal-tls-address-lookup on"
}
}
# Finish test early if no core file was made.
- if !$core_supported {
+ if {!$core_supported} {
return
}
}
with_test_prefix "core file" {
- if $force_internal_tls {
+ if {$force_internal_tls} {
gdb_test_no_output "maint set force-internal-tls-address-lookup on"
}
gdb_test "step" "nothing \\(\\) at.*"
}
-remote_exec build "rm -f twice.c"
+remote_exec build "rm -f twice.c"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set ldflags $srcfile_flags
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# Make sure that we use .eh_frame info, by generating it
# using -fasynchronous-unwind-tables.
if { [gdb_can_simple_compile fasynchronous-unwind-tables \
set srcfile2_flags $srcfile_flags
set ldflags $srcfile_flags
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
standard_testfile unwind-on-each-insn.c unwind-on-each-insn-foo.c
# When updating the .s file, use these flags to generate the file:
#lappend srcfile2_flags additional_flags=-save-temps
set srcfile2_flags $srcfile_flags
set ldflags $srcfile_flags
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
standard_testfile unwind-on-each-insn.c unwind-on-each-insn-foo.c
# When updating the .s file, use these flags to generate the file:
#lappend srcfile2_flags additional_flags=-save-temps
return -1
}
-if ![runto done] {
+if {![runto done]} {
return
}
pass "$test (false warning)"
}
}
- set continue_count [expr $continue_count + 1]
+ set continue_count [expr {$continue_count + 1}]
}
set test "p gdb_test_infcall ()"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set target_char_mask [get_valueof "/u" "a.x\[0]" "255" "get target char mask"]
set target_char_bit 0
-for {set i $target_char_mask} {$i > 0} {set i [expr $i >> 1]} {
+for {set i $target_char_mask} {$i > 0} {set i [expr {$i >> 1}]} {
incr target_char_bit
}
set target_char_rank -1
-for {set i $target_char_bit} {$i > 0} {set i [expr $i >> 1]} {
+for {set i $target_char_bit} {$i > 0} {set i [expr {$i >> 1}]} {
incr target_char_rank
}
set flags {}
lappend flags debug
lappend_include_file flags $srcdir/lib/unbuffer_output.c
-if [support_complex_tests] {
+if {[support_complex_tests]} {
lappend flags "additional_flags=-DTEST_COMPLEX"
}
gdb_test_no_output "set width 0"
-if [gdb_skip_stdio_test "varargs.exp"] {
+if {[gdb_skip_stdio_test "varargs.exp"]} {
# Nothing in this module is testable without printf.
return
}
# Test _Complex type here if supported.
-if [support_complex_tests] {
+if {[support_complex_tests]} {
global gdb_prompt
set test "print find_max_float_real(4, fc1, fc2, fc3, fc4)"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
- if ![runto f1] {
+ if {![runto f1]} {
return
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Check side effects for sizeof argument.
set sizeof_int [get_sizeof "int" 4]
-set sizeof_vla [ expr "10" * "$sizeof_int" ]
+
+set sizeof_vla [expr {10 * $sizeof_int}]
gdb_test "print sizeof (vla1\[i++\])" " = ${sizeof_int}"
gdb_test "print i" " = 0" \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# const volatile pointers to const vars
# const volatile pointers to volatile vars
# ... etc. (you get the idea)
-# Mostly with char and unsigned char.
+# Mostly with char and unsigned char.
#
# test running programs
if {[test_compiler_info gcc-2-*]} {
if { ![test_debug_format "HP"] \
&& ![test_debug_format "DWARF \[0-9\]"] } then {
- setup_xfail "*-*-*"
+ setup_xfail "*-*-*"
}
}
}
# Problem does not occur otherwise.
gdb_test_no_output "set can-use-hw-watchpoints 0"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# It is more compatible this way.
gdb_test_no_output "set can-use-hw-watchpoints 0"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# registers to represent the whole unaligned region. Breakpoint
# addresses must still be aligned though.
if {$cmd == "hbreak" } {
- if { [expr ($offset) % 4] != 0 } {
+ if {$offset % 4 != 0} {
return 0
}
}
}
} else {
# Watchpoints can be of length 1, 2, 4 or 8 bytes.
- if { [expr $width % 2] != 0 } {
+ if { $width % 2 != 0 } {
return 0
}
}
- if { [expr ($offset) % 8] == 0 && $width == 8 } {
+ if {$offset % 8 == 0 && $width == 8} {
# If WIDTH is 8 byte, the address should be 8-byte aligned.
return 1
- } elseif { [expr ($offset) % 4] == 0 } {
+ } elseif {$offset % 4 == 0} {
return 1
- } elseif { [expr ($offset) % 4] == 2 && $width == 2 } {
+ } elseif {$offset % 4 == 2 && $width == 2} {
# Halfword watchpoints and breakpoints.
return 1
- } elseif { [expr ($offset) % 4] == 1 && $width == 1 && $cmd != "hbreak" } {
+ } elseif {$offset % 4 == 1 && $width == 1 && $cmd != "hbreak"} {
# Single byte watchpoints.
return 1
} else {
for {set x 0} {$x < 4} {incr x} {
if { ![valid_addr_p $cmd1 $x $width]
- || ![valid_addr_p $cmd2 $x+1 $width] } {
+ || ![valid_addr_p $cmd2 [expr {$x+1}] $width] } {
# Skip tests if requested address or length
# of breakpoint or watchpoint don't meet
# target or kernel requirements.
standard_testfile
-if [build_executable "failed to prepare" $testfile $srcfile {debug}] {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug}]} {
return -1
}
# sufficient time to ever wrap around.)
gdb_assert {$val1 != $val2} "values are different"
- set wp_str [expr ($hw)?"Hardware watchpoint":"Watchpoint"]
+ set wp_str [expr {($hw)?"Hardware watchpoint":"Watchpoint"}]
# Now set a watchpoint, while the inferior is running. Since
# we're watching a global, and we can read global memory while the
continue
}
foreach stop_mode {all-stop non-stop} {
- set wp_type [expr ($hw)?"hardware":"software"]
+ set wp_type [expr {($hw)?"hardware":"software"}]
with_test_prefix "$stop_mode: $wp_type" {
test $stop_mode $hw
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
foreach wpsize $sizes {
for {set wpoffset 0} {$wpoffset < 8 / $wpsize} {incr wpoffset} {
- set wpstart [expr $wpoffset * $wpsize]
- set wpend [expr ($wpoffset + 1) * $wpsize]
+ set wpstart [expr {$wpoffset * $wpsize}]
+ set wpend [expr {($wpoffset + 1) * $wpsize}]
set wpendaligned $alignedend($wpend)
foreach rdsize $sizes {
for {set rdoffset 0} {$rdoffset < 8 / $rdsize} {incr rdoffset} {
- set rdstart [expr $rdoffset * $rdsize]
- set rdend [expr ($rdoffset + 1) * $rdsize]
- set expect_hit [expr max ($wpstart, $rdstart) < min ($wpend, $rdend)]
+ set rdstart [expr {$rdoffset * $rdsize}]
+ set rdend [expr {($rdoffset + 1) * $rdsize}]
+ set expect_hit [expr {max ($wpstart, $rdstart) < min ($wpend, $rdend)}]
set test "$rwatch data.u.size$wpsize\[$wpoffset\]"
set wpnum ""
gdb_test_multiple $test $test {
if {$expect_hit == 0 && $rdstart < $wpendaligned} {
setup_xfail external/20207 "aarch64*-*-linux*"
}
- if {!$expect_hit && [expr max ($wpstart / 8, $rdstart / 8) < min (($wpend + 7) / 8, ($rdend + 7) / 8)]} {
+ if {!$expect_hit && max ($wpstart / 8, $rdstart / 8) < min (($wpend + 7) / 8, ($rdend + 7) / 8)} {
setup_xfail breakpoints/23131 "powerpc*-*-*"
}
fail $test
}
}
set test "wpcount($wpcount)"
- if {!$wpoffset_to_wpnum([expr $wpcount - 1])} {
+ if {!$wpoffset_to_wpnum([expr {$wpcount - 1}])} {
untested $test
continue
}
"Breakpoint $::decimal at $::hex" "$bp_src_string"
# Set a hardware watchpoint.
- set watch_index [expr $offset + $index]
+ set watch_index [expr {$offset + $index}]
set test "$cmd data.u.size8twice\[$watch_index\]"
set wpnum 0
gdb_test_multiple $test "" {
global decimal
global srcfile
- if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] {
+ if {[gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ]} {
return 0
}
- if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ] {
+ if {[gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ]} {
return 0
}
- if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break" ] {
+ if {[gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break" ]} {
return 0
}
gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3.*" "set watchpoint on ival3"
- if [gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] {
+ if {[gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ]} {
return 0
}
# to use it. This allows the test program to run at full speed until
# we get to the first marker function.
- if [gdb_test_no_output "disable 3" "disable watchpoint" ] {
+ if {[gdb_test_no_output "disable 3" "disable watchpoint" ]} {
return 0
}
# Ensure that the watchpoint is disabled when we startup.
- if [gdb_test_no_output "disable 3" \
- "disable watchpoint in test_simple_watchpoint" ] {
+ if {[gdb_test_no_output "disable 3" \
+ "disable watchpoint in test_simple_watchpoint" ]} {
return 0
}
# After reaching the marker function, enable the watchpoint.
- if [gdb_test_no_output "enable 3" "enable watchpoint" ] {
+ if {[gdb_test_no_output "enable 3" "enable watchpoint" ]} {
return
}
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint hit count is 3"
-
+
# Continue until the next change, from 2 to 3.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
# Disable the watchpoint so we run at full speed until we exit.
- if [gdb_test_no_output "disable 3" "watchpoint disabled" ] {
+ if {[gdb_test_no_output "disable 3" "watchpoint disabled" ]} {
return
}
# Run until process exits.
- if [target_info exists gdb,noresults] { return }
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "continue to exit in test_simple_watchpoint"
}
# Ensure that the watchpoint is disabled when we startup.
- if [gdb_test_no_output "disable 3" \
- "disable watchpoint in test_disabling_watchpoints" ] {
+ if {[gdb_test_no_output "disable 3" \
+ "disable watchpoint in test_disabling_watchpoints" ]} {
return 0
}
# After reaching the marker function, enable the watchpoint.
- if [gdb_test_no_output "enable 3" "watchpoint enabled" ] {
+ if {[gdb_test_no_output "enable 3" "watchpoint enabled" ]} {
return
}
# Don't check the old value, because on VxWorks the variable value
# will not have been reinitialized.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, first time"
-
+
# Continue until the next change, from 0 to 1.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, second time"
-
+
# Disable the watchpoint but leave breakpoints
- if [gdb_test_no_output "disable 3" \
- "disable watchpoint #2 in test_disabling_watchpoints" ] {
+ if {[gdb_test_no_output "disable 3" \
+ "disable watchpoint #2 in test_disabling_watchpoints" ]} {
return 0
}
# Make sure we hit no more watchpoints.
gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \
"disabled watchpoint skipped"
-
- if [target_info exists gdb,noresults] { return }
+
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "continue to exit in test_disabling_watchpoints"
}
gdb_test "p func1 ()" "= 73" \
"calling function with watchpoint enabled"
- #
+ #
# "finish" brings us back to main.
# On some targets (e.g. alpha) gdb will stop from the finish in midline
# of the marker1 call. This is due to register restoring code on
global gdb_prompt
# These tests won't work without printf support.
- if [gdb_skip_stdio_test "watchpoints triggered in syscall"] {
+ if {[gdb_skip_stdio_test "watchpoints triggered in syscall"]} {
return
}
# Run until we get to the first marker function.
set test "sent 123"
gdb_test_multiple "123" $test {
- -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
- -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
- -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
- -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
+ -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue }
+ -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue }
+ -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue }
+ -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr {$x+1}] ; exp_continue }
-re ".*$gdb_prompt $" { pass $test }
}
# should have printed.
set test "print buf\[0\]"
gdb_test_multiple $test $test {
- -re ".*= 49.*$gdb_prompt $" { set y [expr $y+1]; pass $test }
+ -re ".*= 49.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test }
-re ".*= 0.*$gdb_prompt $" { $test }
}
set test "print buf\[1\]"
gdb_test_multiple $test $test {
- -re ".*= 50.*$gdb_prompt $" { set y [expr $y+1]; pass $test }
+ -re ".*= 50.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test }
-re ".*= 0.*$gdb_prompt $" { pass $test }
}
set test "print buf\[2\]"
gdb_test_multiple $test $test {
- -re ".*= 51.*$gdb_prompt $" { set y [expr $y+1]; pass $test }
+ -re ".*= 51.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test }
-re ".*= 0.*$gdb_prompt $" { pass $test }
}
set test "print buf\[3\]"
gdb_test_multiple $test $test {
- -re ".*= 10.*$gdb_prompt $" { set y [expr $y+1]; pass $test }
+ -re ".*= 10.*$gdb_prompt $" { set y [expr {$y+1}]; pass $test }
-re ".*= 0.*$gdb_prompt $" { pass $test }
}
# Did we find what we were looking for? If not, flunk it.
- if {[expr $x==$y]} { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"}
+ if {$x==$y} { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"}
# Continue until we hit the finishing marker function.
# Make sure we hit no more watchpoints.
# Disable everything so we can finish the program at full speed
gdb_test_no_output "disable" "disable in test_watchpoint_triggered_in_syscall"
- if [target_info exists gdb,noresults] { return }
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "continue to exit in test_watchpoint_triggered_in_syscall"
}
# Disable everything so we can finish the program at full speed
gdb_test_no_output "disable" "disable in test_complex_watchpoint, second time"
- if [target_info exists gdb,noresults] { return }
+ if {[target_info exists gdb,noresults]} { return }
gdb_continue_to_end "continue to exit in test_complex_watchpoint"
}
# Start with a fresh gdb.
set prev_timeout $timeout
-set timeout 600
+set timeout 600
verbose "Timeout now 600 sec.\n"
test_no_hw_watchpoints
test_disabling_watchpoints
- if ![target_info exists gdb,cannot_call_functions] {
+ if {![target_info exists gdb,cannot_call_functions]} {
test_stepping
}
}
"disable fast watches, 2"
}
- # Only enabled for some targets merely because it has not been tested
+ # Only enabled for some targets merely because it has not been tested
# elsewhere.
- # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4
+ # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4
# breakpoint before stopping for the watchpoint. I don't know why.
if {[istarget "hppa*-*-*"]} {
test_watchpoint_triggered_in_syscall
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival1\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint ival1 hit count is 3"
# Disable ival1 watchpoint
gdb_test_no_output "disable 2" ""
-
+
# Continue until the next change, from 1 to 2.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time"
# Check that the hit count is reported correctly
gdb_test "info break" ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+ival3\r\n\[ \t]+breakpoint already hit 3 times.*" "watchpoint hit count is 3"
-
+
# Continue until the next change, from 2 to 3.
gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
# computing the value, but just the type
# of the result. It goes through the evaluate_subexp_standard
# with the EVAL_AVOID_SIDE_EFFECTS flag rather than EVAL_NORMAL
-#
+#
#
# test running programs
proc prepare {lang} {
global srcfile testfile
- if [target_info exists no_long_long] {
+ if {[target_info exists no_long_long]} {
set options [list debug additional_flags=-DNO_LONG_LONG]
} else {
set options [list debug]
# test running programs
#
-if [target_info exists no_long_long] {
+if {[target_info exists no_long_long]} {
set exec_opts [list debug additional_flags=-DNO_LONG_LONG]
} else {
set exec_opts [list debug]
"whatis unsigned long"
- if ![target_info exists no_long_long] {
+ if {![target_info exists no_long_long]} {
gdb_test "whatis v_unsigned_long_long" \
"type = (unsigned long long|long long unsigned int)" \
"whatis unsigned long long"
"type = (unsigned (int|long|long int)|long unsigned int) \\\[2\\\]" \
"whatis unsigned long array"
- if ![target_info exists no_long_long] {
+ if {![target_info exists no_long_long]} {
gdb_test "whatis v_unsigned_long_long_array" \
"type = (unsigned long long|long long unsigned int) \\\[2\\\]" \
"whatis unsigned long long array"
"type = (unsigned (int|long|long int)|long unsigned int) \\*" \
"whatis unsigned long pointer"
- if ![target_info exists no_long_long] {
+ if {![target_info exists no_long_long]} {
gdb_test "whatis v_long_long_pointer" \
"type = long long(| int) \\*" \
"whatis long long pointer"
"type = (unsigned (int|long|long int)|long unsigned int) \\($void\\)" \
"whatis unsigned long function"
- if ![target_info exists no_long_long] {
+ if {![target_info exists no_long_long]} {
gdb_test "whatis v_long_long_func" \
"type = long long(| int) \\($void\\)" \
"whatis long long function"
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
# Take into account that the prompt also takes space.
set prefix [string length "(gdb) "]
- set start [expr $prefix + 1]
+ set start [expr {$prefix + 1}]
# Print chars.
for { set i $start } { $i <= $width } { incr i } {
- set c [expr $i % 10]
+ set c [expr {$i % 10}]
send_gdb $c
append res $c
}
if { $wrap_mode == $wrap_mode_terminal } {
gdb_assert { $gdb_width == $readline_width }
} elseif { $wrap_mode == $wrap_mode_readline } {
- gdb_assert { $gdb_width == [expr $readline_width + 1] }
+ gdb_assert { $gdb_width == [expr {$readline_width + 1}] }
} else {
set have_wrap 0
}
clean_restart ${main_testfile}
-if ![runto opaque_routine] {
+if {![runto opaque_routine]} {
untested "could not run to opaque_routine"
return -1
}