Running tclint on the test-cases in gdb.arch shows a few problems.
Fix these.
"gdb/testsuite/boards",
"gdb/testsuite/config",
"gdb/testsuite/lib",
-"gdb/testsuite/gdb.arch",
"gdb/testsuite/gdb.base",
# IGNORE (document reason in trailing comment):
"gdb/testsuite/gdb.stabs", # To be removed.
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set linespec ${srcfile}:[gdb_get_line_number "Break here"]
-if ![runto $linespec] {
+if {![runto $linespec]} {
return
}
global decimal hex
# Load the core file.
- if [gdb_test "core $core_filename" \
- [multi_line \
- "Core was generated by .*\\." \
- "Program terminated with signal SIGSEGV, Segmentation fault" \
- "Guarded Control Stack error\\." \
- "#0 function \\(gcspr=$hex\\) at .*aarch64-gcs-core.c:$decimal" \
- "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \
- "load core file"] {
+ if {[gdb_test "core $core_filename" \
+ [multi_line \
+ "Core was generated by .*\\." \
+ "Program terminated with signal SIGSEGV, Segmentation fault" \
+ "Guarded Control Stack error\\." \
+ "#0 function \\(gcspr=$hex\\) at .*aarch64-gcs-core.c:$decimal" \
+ "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \
+ "load core file"]} {
return -1
}
}
}
-if ![gcore_cmd_available] {
+if {![gcore_cmd_available]} {
unsupported "target does not support gcore command."
return
}
clean_restart
gdb_load $binfile
-if ![runto $linespec] {
+if {![runto $linespec]} {
return
}
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
set call1_line [gdb_get_line_number "Break call1"]
set call2_line [gdb_get_line_number "Break call2"]
-if ![runto ${begin_line}] {
+if {![runto ${begin_line}]} {
return
}
global binfile call2_line
clean_restart
gdb_load $binfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
set inside_infcall_str "The program being debugged stopped while in a function called from GDB"
clean_restart
gdb_load $binfile
-if ![runto ${begin_line}] {
+if {![runto ${begin_line}]} {
return
}
clean_restart
gdb_load $binfile
-if ![runto_main] {
+if {![runto_main]} {
return
}
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
set linespec ${srcfile}:[gdb_get_line_number "Break here"]
-if ![runto ${linespec}] {
+if {![runto ${linespec}]} {
return
}
# Test writing to GCSPR.
clean_restart
gdb_load $binfile
-if ![runto normal_function0] {
+if {![runto normal_function0]} {
return
}
return 0
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
set linespec ${srcfile}:[gdb_get_line_number "Break here"]
-if ![runto ${linespec}] {
+if {![runto ${linespec}]} {
return -1
}
# has the expected value, that means the core file was generated correctly
# and that GDB read the contents correctly.
for {set i 0} {$i < $nmaps} {incr i} {
- for {set offset 0} {$offset < $page_size} {set offset [expr $offset + 16]} {
+ for {set offset 0} {$offset < $page_size} {set offset [expr {$offset + 16}]} {
set hex_tag [format "%x" $tag]
gdb_test "memory-tag print-allocation-tag mmap_pointers\[$i\] + $offset" \
"= 0x$hex_tag" \
"mmap_ponters\[$i\] + $offset contains expected tag"
# Update the expected tag. The test writes tags in sequential
# order.
- set tag [expr ($tag + 1) % 16]
+ set tag [expr {($tag + 1) % 16}]
}
}
}
}
set binfile [standard_output_file ${executable}]
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_breakpoint "access_memory"
-if [gdb_continue "access_memory"] {
+if {[gdb_continue "access_memory"]} {
return -1
}
set addr_tagged [get_tagged_ptr $i ${tagged_ptr_addr}]
}
- set tag_hexnz [get_hex_tag [expr $i % 16]]
+ set tag_hexnz [get_hex_tag [expr {$i % 16}]]
gdb_test "memory-tag print-logical-tag ${addr_tagged}" \
" = 0x${tag_hexnz}" \
"print-logical-tag with tag ${i}"
$atag_msg \
"set-allocation-tag with tag ${i}"
- set tag_hexnz [get_hex_tag [expr $i % 16]]
+ set tag_hexnz [get_hex_tag [expr {$i % 16}]]
gdb_test "memory-tag print-allocation-tag ${tagged_ptr_addr}" " = 0x${tag_hexnz}" \
"print-allocation-tag with tag ${i}"
}
$atag_msg \
"set-allocation-tag with tag ${i}"
- set atag_hexnz [get_hex_tag [expr $i % 16]]
+ set atag_hexnz [get_hex_tag [expr {$i % 16}]]
# Validate that the logical tag matches the allocation tag.
with_test_prefix "tag ${i}" {
# Get a pointer with the logical tag that does not match the
# allocation tag.
- set ltag [expr $i + 1]
+ set ltag [expr {$i + 1}]
with_test_prefix "fetch mismatch tag ${i}" {
set addr_tagged [get_tagged_ptr $ltag ${tagged_ptr_addr}]
}
# Validate that the logical tag does not match the allocation
# tag.
- set ltag_hexnz [get_hex_tag [expr [expr $i + 1]% 16]]
+ set ltag_hexnz [get_hex_tag [expr {($i + 1) % 16}]]
gdb_test "memory-tag check ${addr_tagged}" \
"Logical tag \\(0x${ltag_hexnz}\\) does not match the allocation tag \\(0x${atag_hexnz}\\) for address $hex\." \
"check mismatch with tag ${i}"
"update value of symbol ${tagged_ptr_symbol}"
}
- set tag_hexnz [get_hex_tag [expr $i % 16]]
+ set tag_hexnz [get_hex_tag [expr {$i % 16}]]
gdb_test "memory-tag print-logical-tag ${tagged_ptr_symbol}" \
" = 0x${tag_hexnz}" \
"print-logical-tag with tag ${i}"
$atag_msg \
"set-allocation-tag with tag ${i}"
- set tag_hexnz [get_hex_tag [expr $i % 16]]
+ set tag_hexnz [get_hex_tag [expr {$i % 16}]]
gdb_test "memory-tag print-allocation-tag ${tagged_ptr_symbol}" \
" = 0x${tag_hexnz}" \
"print-allocation-tag with tag ${i}"
$atag_msg \
"set-allocation-tag with tag ${i}"
- set atag_hexnz [get_hex_tag [expr $i % 16]]
+ set atag_hexnz [get_hex_tag [expr {$i % 16}]]
# Validate that the logical tag matches the allocation tag.
with_test_prefix "tag ${i}" {
# Get a pointer with the logical tag that does not match the
# allocation tag.
- set ltag [expr $i + 1]
+ set ltag [expr {$i + 1}]
with_test_prefix "fetch mismatch tag ${i}" {
set addr_tagged [get_tagged_ptr $ltag ${tagged_ptr_addr}]
}
# Validate that the logical tag does not match the allocation
# tag.
- set ltag_hexnz [get_hex_tag [expr [expr $i + 1]% 16]]
+ set ltag_hexnz [get_hex_tag [expr {($i + 1) % 16}]]
gdb_test "memory-tag check ${tagged_ptr_symbol}" \
"Logical tag \\(0x${ltag_hexnz}\\) does not match the allocation tag \\(0x${atag_hexnz}\\) for address $hex\." \
"check mismatch with tag ${i}"
return -1
}
- set atag [expr [expr $ltag + 1] % 16]
+ set atag [expr {($ltag + 1) % 16}]
set atag_hexnn [get_tag_nn $atag]
gdb_test "memory-tag set-allocation-tag ${tagged_ptr_symbol} 1 ${atag_hexnn}" \
# Restart to execute the async tag fault test.
with_test_prefix "async" {
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
gdb_breakpoint "access_memory"
- if [gdb_continue "access_memory"] {
+ if {[gdb_continue "access_memory"]} {
fail "could not run to tagged memory test function"
return -1
}
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
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_continue_to_breakpoint "exit" ".*exit.*"
set handlerframe [get_current_frame_number]
-set mainframe [expr $handlerframe + 2]
+set mainframe [expr {$handlerframe + 2}]
# Check register values
#
proc check_sme_core_file { core_filename state vl svl } {
# Load the core file.
- if [gdb_test "core $core_filename" \
- [multi_line \
- "Core was generated by.*\." \
- "Program terminated with signal SIGSEGV, Segmentation fault\." \
- "#0 ${::hex} in main \\(.*\\) at .*" \
+ if {[gdb_test "core $core_filename" \
+ [multi_line \
+ "Core was generated by.*\." \
+ "Program terminated with signal SIGSEGV, Segmentation fault\." \
+ "#0 ${::hex} in main \\(.*\\) at .*" \
".*p = 0xff;.* crash point .*"] \
- "load core file"] {
+ "load core file"]} {
untested "failed to generate core file"
return -1
}
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
#
proc check_regs { mode vl svl } {
# Check VG to make sure it is correct
- set expected_vg [expr $vl / 8]
+ set expected_vg [expr {$vl / 8}]
gdb_test "print \$vg" "= ${expected_vg}"
# Check SVG to make sure it is correct
- set expected_svg [expr $svl / 8]
+ set expected_svg [expr {$svl / 8}]
gdb_test "print \$svg" "= ${expected_svg}"
# If svl is adjusted by prctl, we will have ZA enabled. If gdb is
}
# Check SVCR.
- if [gdb_test "print \$svcr" $za_state "svcr before assignments" ] {
+ if {[gdb_test "print \$svcr" $za_state "svcr before assignments" ]} {
fail "incorrect za state"
return -1
}
# Check the size of ZA.
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
gdb_test "print sizeof \$za" " = $expected_za_size"
# Check the size of Z0.
# Exercise reading/writing from/to the tile pseudo-registers.
set last_tile 1
- set expected_size [expr $svl * $svl]
+ set expected_size [expr {$svl * $svl}]
set tile_svl $svl
set za_state "= \\\[ ZA \\\]"
foreach_with_prefix granularity {"b" "h" "s" "d" "q"} {
initialize_2d_array $register_name 255 $tile_svl $tile_svl
# Make sure we have ZA state.
- if [gdb_test "print \$svcr" $za_state "svcr after assignment to ${register_name}" ] {
+ if {[gdb_test "print \$svcr" $za_state "svcr after assignment to ${register_name}" ]} {
fail "incorrect za state"
return -1
}
set pattern [string_to_regexp [2d_array_value_pattern 255 $tile_svl $tile_svl]]
gdb_test "print $register_name" " = $pattern" "read back from $register_name"
}
- set last_tile [expr $last_tile * 2]
- set expected_size [expr $expected_size / 2]
- set tile_svl [expr $tile_svl / 2]
+ set last_tile [expr {$last_tile * 2}]
+ set expected_size [expr {$expected_size / 2}]
+ set tile_svl [expr {$tile_svl / 2}]
}
# Exercise reading/writing from/to the tile slice pseudo-registers.
initialize_1d_array $register_name 255 $num_elements
# Make sure we have ZA state.
- if [gdb_test "print \$svcr" $za_state "svcr after assignment of ${register_name}" ] {
+ if {[gdb_test "print \$svcr" $za_state "svcr after assignment of ${register_name}" ]} {
fail "incorrect za state"
return -1
}
}
}
}
- set last_tile [expr $last_tile * 2]
- set last_slice [expr ($last_slice / 2)]
- set num_elements [expr $num_elements / 2]
+ set last_tile [expr {$last_tile * 2}]
+ set last_slice [expr {($last_slice / 2)}]
+ set num_elements [expr {$num_elements / 2}]
}
# Exercise reading/writing from/to SME2 registers.
- if [is_sme2_available] {
+ if {[is_sme2_available]} {
# The target supports SME2.
set zt_size 64
gdb_test "print sizeof \$zt0" " = $zt_size"
}
set binfile [standard_output_file ${executable}]
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
gdb_continue_to_breakpoint $non_prctl_breakpoint
# Adjust svl via gdb.
- set vg_value [expr $vl / 8]
- set svg_value [expr $svl / 8]
+ set vg_value [expr {$vl / 8}]
+ set svg_value [expr {$svl / 8}]
gdb_test_no_output "set \$vg = ${vg_value}"
gdb_test_no_output "set \$svg = ${svg_value}"
}
set binfile [standard_output_file ${executable}]
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
}
# Run the program until it has adjusted the svl.
- if [gdb_continue_to_breakpoint $sigill_breakpoint] {
+ if {[gdb_continue_to_breakpoint $sigill_breakpoint]} {
return -1
}
# Check SVG to make sure it is correct
- set expected_svg [expr $svl / 8]
+ set expected_svg [expr {$svl / 8}]
gdb_test "print \$svg" "= ${expected_svg}"
# Check the size of ZA.
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
gdb_test "print sizeof \$za" " = $expected_za_size"
# Check the value of SVCR.
gdb_test_no_output "set \$tpidr2=0x0102030405060708"
# Run to the illegal instruction.
- if [gdb_test "continue" "Continuing\.\r\n\r\nProgram received signal SIGILL, Illegal instruction\..*in main.*"] {
+ if {[gdb_test "continue" "Continuing\.\r\n\r\nProgram received signal SIGILL, Illegal instruction\..*in main.*"]} {
return
}
# Skip the illegal instruction. The signal handler will be called after we continue.
gdb_test_no_output "set \$pc=\$pc+4"
# Continue to the signal handler.
- if [gdb_continue_to_breakpoint $handler_breakpoint] {
+ if {[gdb_continue_to_breakpoint $handler_breakpoint]} {
return -1
}
}
# Check the size of ZA in the signal frame.
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
gdb_test "print sizeof \$za" " = $expected_za_size" "size of za in signal frame"
# Check the value of SVCR in the signal frame.
gdb_test "print/x \$tpidr2" " = 0x102030405060708" "tpidr2 contents from signal frame"
# Check the value of SME2 ZT0 in the signal frame.
- if [is_sme2_available] {
+ if {[is_sme2_available]} {
# The target supports SME2.
set zt_size 64
gdb_test "print sizeof \$zt0" " = $zt_size"
#
proc_with_prefix check_regs { vl svl } {
# Check VG to make sure it is correct
- set expected_vg [expr $vl / 8]
+ set expected_vg [expr {$vl / 8}]
gdb_test "print \$vg" "= ${expected_vg}"
# Check SVG to make sure it is correct
- set expected_svg [expr $svl / 8]
+ set expected_svg [expr {$svl / 8}]
gdb_test "print \$svg" "= ${expected_svg}"
# Make sure there is no SM or ZA state.
- if [gdb_test "print \$svcr" "= \\\[ \\\]"] {
+ if {[gdb_test "print \$svcr" "= \\\[ \\\]"]} {
fail "incorrect ZA state"
return -1
}
# Check the size of ZA.
- set expected_za_size [expr $svl * $svl]
+ set expected_za_size [expr {$svl * $svl}]
gdb_test "print sizeof \$za" " = $expected_za_size"
# Check the size of Z0.
}
}
}
- set last_tile [expr $last_tile * 2]
- set last_slice [expr ($last_slice / 2)]
- set elements [expr ($elements / 2)]
+ set last_tile [expr {$last_tile * 2}]
+ set last_slice [expr {($last_slice / 2)}]
+ set elements [expr {($elements / 2)}]
}
# Exercise reading/writing the tile pseudo-registers.
set last_tile 1
set elements $svl
- set expected_size [expr $svl * $svl]
+ set expected_size [expr {$svl * $svl}]
foreach_with_prefix granularity {"b" "h" "s" "d" "q"} {
set pattern [string_to_regexp [2d_array_value_pattern 0 $elements $elements]]
for {set tile 0} {$tile < $last_tile} {incr tile} {
gdb_test "print sizeof ${register_name}" " = ${expected_size}"
gdb_test "print ${register_name}" $pattern
}
- set last_tile [expr $last_tile * 2]
- set expected_size [expr $expected_size / 2]
- set elements [expr ($elements / 2)]
+ set last_tile [expr {$last_tile * 2}]
+ set expected_size [expr {$expected_size / 2}]
+ set elements [expr {($elements / 2)}]
}
# Exercise reading from SME2 registers.
- if [is_sme2_available] {
+ if {[is_sme2_available]} {
# The target supports SME2.
set zt_size 64
gdb_test "print sizeof \$zt0" " = $zt_size"
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
untested "could not run to main"
return -1
}
}
# Adjust vg and svg.
- set vg_value [expr $vl / 8]
- set svg_value [expr $svl / 8]
+ set vg_value [expr {$vl / 8}]
+ set svg_value [expr {$svl / 8}]
gdb_test_no_output "set \$vg = ${vg_value}"
gdb_test_no_output "set \$svg = ${svg_value}"
# Fetch both the vector length and the streaming vector length the target
# system is using. We do not force any vector lengths and do not change
# it mid-execution.
-set vl [expr [get_valueof "" "\$vg" "0" "fetch value of vl"] * 8]
-set svl [expr [get_valueof "" "\$svg" "0" "fetch value of svl"] * 8]
+set vl [expr {[get_valueof "" "\$vg" "0" "fetch value of vl"] * 8}]
+set svl [expr {[get_valueof "" "\$svg" "0" "fetch value of svl"] * 8}]
# Now we are at the point where we can start checking state and moving the
# testcase forward.
set linespec ${srcfile}:[gdb_get_line_number "Break here."]
gdb_test_no_output "set args $first_vl $second_vl"
-if ![runto ${linespec}] {
+if {![runto ${linespec}]} {
return
}
-set first_vg [expr $first_vl/8]
-set second_vg [expr $second_vl/8]
+set first_vg [expr {$first_vl/8}]
+set second_vg [expr {$second_vl/8}]
gdb_test "print \$vg" ". = $second_vg" "vg was changed"
for {set row 0} {$row < 16} {incr row} {
set register_name "\$p${row}"
- gdb_test "print $register_name" ". = \\{(0, ){[expr $second_vl/8 - 1]}0\\}" \
+ gdb_test "print $register_name" ". = \\{(0, ){[expr {$second_vl/8 - 1}]}0\\}" \
"$register_name contents in signal handler"
}
-gdb_test "print \$ffr" ". = \\{(255, ){[expr $second_vl/8 - 1]}255\\}" \
+gdb_test "print \$ffr" ". = \\{(255, ){[expr {$second_vl/8 - 1}]}255\\}" \
"ffr contents in signal handler"
gdb_test "frame function main" \
for {set row 0} {$row < 16} {incr row} {
set register_name "\$p${row}"
- gdb_test "print $register_name" ". = \\{(1, ){[expr $first_vl/8 - 1]}1\\}" \
+ gdb_test "print $register_name" ". = \\{(1, ){[expr {$first_vl/8 - 1}]}1\\}" \
"$register_name contents were correctly unwound"
}
-gdb_test "print \$ffr" ". = \\{(255, ){[expr $first_vl/8 - 1]}255\\}" \
+gdb_test "print \$ffr" ". = \\{(255, ){[expr {$first_vl/8 - 1}]}255\\}" \
"ffr contents were correctly unwound"
set linespec ${srcfile}:[gdb_get_line_number "break here"]
-if ![runto ${linespec}] {
+if {![runto ${linespec}]} {
return
}
# The test executable halves the vector length in a loop, so loop along
# to check it.
-for {set i [get_register_value "vg"]} {$i > 1} {set i [expr $i / 2]} {
+for {set i [get_register_value "vg"]} {$i > 1} {set i [expr {$i / 2}]} {
set lines_before [count_info_registers]
gdb_test "next" ".*if .res < 0." "step over prctl vg = ${i}"
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]} {
untested "could not run to main"
return -1
}
gdb_test "break *$function+4" \
"Breakpoint .* at .*" \
"breakpoint on fb$function instruction"
-
+
gdb_test "continue" \
"Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
"continue to fb$function instruction (first call)"
-
+
# Extra check to make sure we stopped on the FP branch instruction.
-
+
gdb_test "x /i \$pc" \
"0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
"Check breakpoint on fb$function instruction (first call)"
-
+
# Step test, followed by the check that we landed on the expected
# instruction (the testcase should be written in such a way that
# the branch is taken on the first call to this function.
-
+
gdb_test "stepi" \
"0x\[0-9a-fA-F\]+.*" \
"stepi on fb$function (first call)"
-
+
gdb_test "x /i \$pc" \
"0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+ret.*" \
"Check stepi over fb$function stopped on ret"
-
+
# Continue again. FUNCTION should be called a second time, this time
# with an argument such that the FP branch will not be taken.
-
+
gdb_test "continue" \
"Breakpoint .*, 0x\[0-9a-fA-F\]+ in $function\(\).*" \
"continue to fb$function instruction (second call)"
-
+
# Extra check to make sure we stopped on the FP branch instruction.
-
+
gdb_test "x /i \$pc" \
"0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fb$function.*" \
"Check breakpoint on fb$function instruction (second call)"
-
+
# Step test, branch should not be taken.
-
+
gdb_test "stepi" \
"0x\[0-9a-fA-F\]+.*" \
"stepi on fb$function (branch not taken)"
-
+
# Extra check to verify that we landed on the instruction we expected.
-
+
gdb_test "x /i \$pc" \
"0x\[0-9a-fA-F\]+ <.*>:\[ \t\]+fneg.*" \
"check stepi over fb$function stopped on fneg instruction"
if { "$force_abi" == "auto" } {
# If the toolchain does not record attributes, skip auto-ABI tests.
set readelf_program [gdb_find_readelf]
- set result [catch "exec $readelf_program -A $binfile" output]
+ set result [catch {exec $readelf_program -A $binfile} output]
if {$result == 0 && ![regexp Tag_GNU_Power_ABI_Vector $output]} {
untested "ABI not marked"
gdb_test "p matrix\[3\]" ".*= .31, 32, 33, 34, 35, 36, 37, 38." "print fourth vector"
}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set binprefix ${binfile}
with_test_prefix "default ABI, auto" {
altivec_abi_tests "additional_flags=-maltivec additional_flags=-mabi=altivec" "auto"
}
}
-} elseif [test_compiler_info xlc*] {
+} elseif {[test_compiler_info xlc*]} {
altivec_abi_tests "additional_flags=-qaltivec" "auto"
} else {
warning "unknown compiler"
# Copyright (C) 2002-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
standard_testfile
set compile_flags {debug nowarnings}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
-} elseif [test_compiler_info xlc*] {
+} elseif {[test_compiler_info xlc*]} {
set compile_flags "$compile_flags additional_flags=-qaltivec"
} else {
warning "unknown compiler"
"Breakpoint $decimal, vector_fun .a=.0xfefefefe, 0xfefefefe, 0xfefefefe, 0xfefefefe., b=.0x1010101, 0x1010101, 0x1010101, 0x1010101.*altivec-regs.c.*vec_splat_u8.2..;" \
"continue to vector_fun"
-# Do a next over the assignment to vector 'a'.
+# Do a next over the assignment to vector 'a'.
gdb_test "next" ".*b = \\(\\(vector unsigned int\\) vec_splat_u8\\(3\\)\\);" \
"next (1)"
-# Do a next over the assignment to vector 'b'.
+# Do a next over the assignment to vector 'b'.
gdb_test "next" "c = vec_add \\(a, b\\);" \
"next (2)"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
for { set r 1 } { $r <= 4 } { incr r } {
- set h [expr $r + 14]
+ set h [expr {$r + 14}]
gdb_test "print/x \$$byte_regs($h)" \
".. = 0x[format %x $r]2" \
"check contents of %$byte_regs($h)"
}
for { set r 1 } { $r <= 4 } { incr r } {
- set h [expr $r + 14]
+ set h [expr {$r + 14}]
gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
}
}
}
for { set r 1 } { $r <= 4 } { incr r } {
- set h [expr $r + 14]
+ set h [expr {$r + 14}]
gdb_test "print \$$byte_regs($h)" \
".. = $h" \
"check contents of %$byte_regs($h)"
}
# Clear the slot on the stack and confirm it was set to zero.
-set sp [expr $sp - 0x8]
+set sp [expr {$sp - 0x8}]
gdb_test_no_output "set {unsigned long long} $sp = 0" \
"clear stack slot"
set zero_val 0x[format %016x 0]
# Check stack pointer was updated to the expected value.
set new_sp [get_hexadecimal_valueof "\$sp" "*UNKNOWN*" \
"get stack pointer after step"]
-gdb_assert {[expr $sp == $new_sp]} \
+gdb_assert {[expr {$sp == $new_sp}]} \
"check stack pointer was updated as expected"
# Check the contents of the stack were updated to the expected value.
# Use send_gdb/gdb_expect so that these aren't logged as pass/fail.
send_gdb "set \$${reg} = ${val}\n"
gdb_expect 10 {
- -re "$gdb_prompt $" {
+ -re "$gdb_prompt $" {
verbose "Setting ${reg} to ${val}." 2
}
timeout {
# the displaced step, but instead just delivers the signal.
set inferior_pid [get_inferior_pid]
# Ensure that $inferior_pid refers to a single process.
- gdb_assert {[expr $inferior_pid > 0]} \
+ gdb_assert {[expr {$inferior_pid > 0}]} \
"check for a sane inferior pid"
if {$inferior_pid > 0} {
remote_exec target "kill -ALRM $inferior_pid"
set opts {}
standard_testfile .S .c
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1"
standard_testfile .c .c
lappend opts debug optimize=-O2
}
# Make .c available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
gdb_remote_download host $srcdir/$subdir/$srcfile2
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile .S .c
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1"
standard_testfile .c .c
lappend opts optimize=-O2 dwarf5
}
# Make .c available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
gdb_remote_download host $srcdir/$subdir/$srcfile2
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile .S .c
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param.exp COMPILE=1"
standard_testfile .c .c
lappend opts debug optimize=-O2
}
# Make .c available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
remote_download host $srcdir/$subdir/$srcfile2
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
require is_x86_64_m64_target
# Make .cc available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
gdb_remote_download host $srcdir/$subdir/$srcfile2
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile .s
set opts {nopie}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value.exp COMPILE=1"
set srcfile ${testfile}.cc
lappend opts debug
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set main_r12 [get_integer_valueof "\$r12" "null"]
gdb_assert { $main_r12 ne "null" }
- set foo_r12 [expr "$main_r12 + 2"]
+ set foo_r12 [expr {$main_r12 + 2}]
gdb_test "print \$r12=$foo_r12" "$foo_r12" "Set foo's %r12=$foo_r12"
gdb_test "up" ".*main.*" "Go up a frame from foo"
gdb_test "print \$r12" "$main_r12" "foo's %r12 unwound"
set old_reg_val [get_integer_valueof "\$r12" "null"]
gdb_assert { $old_reg_val ne "null" }
- set new_reg_val [expr "$old_reg_val + 3"]
+ set new_reg_val [expr {$old_reg_val + 3}]
gdb_test "print \$r14=$new_reg_val" "$new_reg_val" "Set %r14=$new_reg_val"
gdb_test "print \$r13=$new_reg_val" "$new_reg_val" "Set %r13=$new_reg_val"
gdb_test "print \$r12=$new_reg_val" "$new_reg_val" "Set %r12=$new_reg_val"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
require {is_any_target "x86_64-*-*" "i?86-*-*"} is_lp64_target
require {!istarget "*-*-openbsd*"}
-if [prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]] {
+if {[prepare_for_testing "failed to prepare" amd64-i386-address amd64-i386-address.S [list debug "additional_flags=-m32 -nostdlib"]]} {
return -1
}
return -1
}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
clean_restart ${::testfile}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
clean_restart ${::testfile}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
return -1
}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
clean_restart ${::testfile}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
clean_restart ${::testfile}
-if ![runto breakpt] {
+if {![runto breakpt]} {
return -1
}
standard_testfile .S .c
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-optimout-repeat.exp COMPILE=1"
set srcfile ${srcfile2}
lappend opts debug optimize=-O2
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set csrcfile ${testfile}.c
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS='gdb.arch/amd64-prologue-xmm.exp COMPILE=1'
set srcfile ${csrcfile}
lappend opts debug optimize=-O0
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
global decimal
# Load the core file.
- if [gdb_test "core $core_filename" \
- [multi_line \
- "Core was generated by .*\\." \
- "Program terminated with signal SIGSEGV, Segmentation fault.*" \
- "#0 function \\(\\) at .*amd64-shadow-stack-corefile.c:$decimal" \
- "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \
- "load core file"] {
+ if {[gdb_test "core $core_filename" \
+ [multi_line \
+ "Core was generated by .*\\." \
+ "Program terminated with signal SIGSEGV, Segmentation fault.*" \
+ "#0 function \\(\\) at .*amd64-shadow-stack-corefile.c:$decimal" \
+ "$decimal.*__asm__ volatile \\(\"ret\\\\n\"\\);"] \
+ "load core file"]} {
return
}
set linespec ${srcfile}:[gdb_get_line_number "Break here"]
- if ![runto $linespec] {
+ if {![runto $linespec]} {
return
}
}
}
- if ![gcore_cmd_available] {
+ if {![gcore_cmd_available]} {
unsupported "target does not support gcore command."
return
}
clean_restart $::testfile
- if ![runto $linespec] {
+ if {![runto $linespec]} {
return
}
set opts {}
standard_testfile amd64-tailcall-cxx1.S amd64-tailcall-cxx2.S
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-cxx.exp COMPILE=1"
standard_testfile amd64-tailcall-cxx1.cc amd64-tailcall-cxx2.cc
lappend opts debug
return -1
}
-if ![runto g] {
+if {![runto g]} {
return -1
}
set opts {}
standard_testfile .S
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-noret.exp COMPILE=1"
standard_testfile
lappend opts debug optimize=-O2
return -1
}
-if ![runto noret] {
+if {![runto noret]} {
return -1
}
set opts {}
standard_testfile .S .c
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-ret.exp COMPILE=1"
standard_testfile .c .c
lappend opts debug optimize=-O2
}
# Make .c available on the host.
-if [is_remote host] {
+if {[is_remote host]} {
gdb_remote_download host $srcdir/$subdir/$srcfile2
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto b] {
+if {![runto b]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
}
if { $fp_offset != "" } {
set sp [get_integer_valueof \$sp -1 "get value of sp in $funcname"]
- set fp_val [expr $sp + $fp_offset]
+ set fp_val [expr {$sp + $fp_offset}]
set fp_real_val \
[get_integer_valueof \$fp 0 "get value of fp in $funcname"]
if { $fp_real_val != $fp_val } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
# Calculate instruction length, based on ${test_name}_end symbol.
set end_pc [get_hexadecimal_valueof &${test_name}_end -1]
- set length [expr $end_pc - $pc]
+ set length [expr {$end_pc - $pc}]
set target_address [get_hexadecimal_valueof &${test_name}_target -1]
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto [gdb_get_line_number "break here."]] {
+if {![runto [gdb_get_line_number "break here."]]} {
untested "could not run to \"break here.\""
return -1
}
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
-if [prepare_for_testing "failed to prepare" $executable $srcfile \
- [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $executable $srcfile \
+ [list debug $additional_flags]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
global gdb_prompt
global expect_out
global hex
-
+
set address ""
# Insert a breakpoint using the given function name, and extract
# Copyright 2003-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
"Breakpoint 2, vector_fun .a=.-2, -2., b=.1, 1.*e500-regs.c.*ev_create_s32 .2, 2.;" \
"continue to vector_fun"
-# Do a next over the assignment to vector 'a'.
+# Do a next over the assignment to vector 'a'.
gdb_test "next" ".*b = \\(vector int\\) __ev_create_s32 \\(3, 3\\);" \
"next (1)"
-# Do a next over the assignment to vector 'b'.
+# Do a next over the assignment to vector 'b'.
gdb_test "next" "c = __ev_and \\(a, b\\);" \
"next (2)"
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
-if [prepare_for_testing "failed to prepare" $testfile-no-ipa $srcfile \
- [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $testfile-no-ipa $srcfile \
+ [list debug $additional_flags]]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
-if ![gdb_target_supports_trace] {
+if {![gdb_target_supports_trace]} {
unsupported "target does not support trace"
return -1
}
clean_restart $testfile
set remote_libipa [gdb_load_shlib $libipa]
-if ![runto_main] {
+if {![runto_main]} {
return 0
}
"set first breakpoint in main"
gdb_continue_to_breakpoint "continue to first breakpoint in main"
-if [is_amd64_regs_target] {
+if {[is_amd64_regs_target]} {
set nr_regs 16
} else {
set nr_regs 8
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 10}], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \
"check contents of data\[$r\]"
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set nr_regs 7
for { set r 0 } { $r < $nr_regs } { incr r } {
- set val [expr $r + 1]
+ set val [expr {$r + 1}]
gdb_test "print/x k_data\[$r\]" \
".. = 0x$val$val$val$val" \
"check contents of k_data\[$r\]"
"set third breakpoint in main"
gdb_continue_to_breakpoint "continue to third breakpoint in main"
-if [is_amd64_regs_target] {
+if {[is_amd64_regs_target]} {
set nr_regs 32
} else {
set nr_regs 8
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 10], [expr $r.125 + 10], [expr $r.25 + 10], [expr $r.375 + 10], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 10}], [expr {$r + 10.125}], [expr {$r + 10.25}], [expr {$r + 10.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r +10.75}], [expr {$r + 10.875}]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing ZMM regs"
}
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 20], [expr $r.125 + 20], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 20}], [expr {$r + 20.125}], [expr {$r + 20.25}], [expr {$r + 20.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r + 10.75}], [expr {$r + 10.875}]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing YMM regs"
}
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 30], [expr $r.125 + 30], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 30}], [expr {$r + 30.125}], [expr {$r + 20.25}], [expr {$r + 20.375}], [expr {$r + 10.5}], [expr {$r + 10.625}], [expr {$r + 10.75}], [expr {$r + 10.875}]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing XMM regs"
}
# First check if this particular GDB supports i386, otherwise we should not
# expect the i386 core file to be loaded successfully.
set archs [get_set_option_choices "set architecture" "i386"]
-set supports_arch_i386 [expr [lsearch -exact $archs i386] != -1]
+set supports_arch_i386 [expr {[lsearch -exact $archs i386] != -1}]
# Wrongly built GDB complains by:
# "..." is not a core dump: File format not recognized
gdb_test "print/x \$$byte_regs($r)" \
".. = 0x[format %x $r]1" \
"check contents of %$byte_regs($r)"
- set h [expr $r + 4]
+ set h [expr {$r + 4}]
gdb_test "print/x \$$byte_regs($h)" \
".. = 0x[format %x $r]2" \
"check contents of %$byte_regs($h)"
for { set r 1 } { $r <= 4 } { incr r } {
gdb_test "set var \$$byte_regs($r) = $r" "" "set %$byte_regs($r)"
- set h [expr $r + 4]
+ set h [expr {$r + 4}]
gdb_test "set var \$$byte_regs($h) = $h" "" "set %$byte_regs($h)"
}
}
gdb_test "print \$$byte_regs($r)" \
".. = $r" \
"check contents of %$byte_regs($r)"
- set h [expr $r + 4]
+ set h [expr {$r + 4}]
gdb_test "print \$$byte_regs($h)" \
".. = $h" \
"check contents of %$byte_regs($h)"
set testfile "i386-cfi-notcurrent"
set srcfile ${testfile}.S
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nodebug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {nodebug}]} {
return -1
}
-if ![runto f] {
+if {![runto f]} {
return -1
}
}
# Clear the slot on the stack and confirm it was set to zero.
-set sp [expr $sp - 0x4]
+set sp [expr {$sp - 0x4}]
gdb_test_no_output "set {unsigned int} $sp = 0" \
"clear stack slot"
set zero_val 0x[format %08x 0]
# Check stack pointer was updated to the expected value.
set new_sp [get_hexadecimal_valueof "\$sp" "*UNKNOWN*" \
"get stack pointer after step"]
-gdb_assert {[expr $sp == $new_sp]} \
+gdb_assert {[expr {$sp == $new_sp}]} \
"check stack pointer was updated as expected"
# Check the contents of the stack were updated to the expected value.
standard_testfile
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug $additional_flags}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug $additional_flags}]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
if { $v != {} } {
set have_xfail \
[expr \
- [version_compare [list 5 14 0] <= $v] \
- && [version_compare $v < [list 6 2 0]]]
+ {[version_compare [list 5 14 0] <= $v] \
+ && [version_compare $v < [list 6 2 0]]}]
}
# Test pkru register at startup
set bp_addr $expect_out(1,string)
# Convert to decimal.
- set bp_addr [expr $bp_addr]
+ set bp_addr [expr {$bp_addr}]
pass $gdb_test_name
}
set binfile [standard_output_file ${executable}]
set opts {}
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
set srcfile ${csrcfile}
lappend opts debug optimize=-O2 additional_flags=-msse
}
if {$args != ""} {
set args "$args, "
}
- set args "$args[expr $i + 1]"
+ set args "$args[expr {$i + 1}]"
}
"set first breakpoint in main"
gdb_continue_to_breakpoint "continue to first breakpoint in main"
-if [is_amd64_regs_target] {
+if {[is_amd64_regs_target]} {
set nr_regs 16
} else {
set nr_regs 8
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print data\[$r\]" \
- ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \
+ ".. = \\{f = \\{[expr {$r + 10}], $r.25, $r.5, $r.75\\}\\}.*" \
"check contents of data\[$r\]"
}
gdb_load $binfile
# We need to start the inferior to place the breakpoints in the memory at all.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
-if ![info exists bpt2address] {
+if {![info exists bpt2address]} {
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
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
-# Test single-step on bbit.
+# Test single-step on bbit.
require {istarget "*octeon*"}
set insn [current_insn]
set start [timestamp]
while { $insn != "" && [timestamp] - $start < 3*$timeout } {
- if [regexp $match $insn] {
+ if {[regexp $match $insn]} {
return 1
}
if {![single_step]} {
}
pass "$name single-step until bbit"
gdb_test "si" "" "$name single-step on bbit"
- if [regexp "li\\s+\[sv\]0,$taken" [current_insn]] {
+ if {[regexp "li\\s+\[sv\]0,$taken" [current_insn]]} {
pass "$name check insn after bbit"
} else {
send_log "expected: li\\s+\[sv\]0,$taken found [current_insn]\n"
clean_restart
gdb_load $binfile
-# In the first test, we do a "step" on a function whose last instruction
+# In the first test, we do a "step" on a function whose last instruction
# contains a branch-with-nullify. The instruction in the delay slot belongs
# to the next function. We verify that when we step off the first function
# that we end up back at the caller and not at the second instruction.
}
}
-# In the second test, we verify that we can get a proper backtrace
+# In the second test, we verify that we can get a proper backtrace
# even when we are in a nullified instruction that belongs to the next function.
-# We also verify that when stepping over a branch-with-nullify insn that we
+# We also verify that when stepping over a branch-with-nullify insn that we
# stay on the same insn for two steps.
proc get_addr_of_sym { sym } {
}
gdb_breakpoint "*$foo_last"
gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint"
-if [gen_core $test] {
+if {[gen_core $test]} {
test_core_bt $test
}
gdb_breakpoint "*$foo_last"
gdb_test "continue" "Breakpoint \[0-9\]*,.* in foo.*" "$test: continue to breakpoint"
gdb_test "stepi" ".*in foo.*" "$test: step to nullified instruction"
-if [gen_core $test] {
+if {[gen_core $test]} {
test_core_bt $test
}
# addpcis 8,+0x10 # /* set r8 */
# addpcis 9,+0x100 # /* set r9 */
-if [expr $check_r3 + 0x1000000 != $check_r6 - 0xc ] {
+if {$check_r3 + 0x1000000 != $check_r6 - 0xc} {
fail "unexpected value r3 + 0x1,000,000 != r6 + 0xc ; r3: $check_r3 r6: $check_r6 "
}
-if [expr $check_r4 + 0x100000 != $check_r6 - 0x8 ] {
+if {$check_r4 + 0x100000 != $check_r6 - 0x8} {
fail "unexpected value r4 + 0x100,000 != r6 - 0x8 ; r4: $check_r4 r6: $check_r6 "
}
-if [expr $check_r5 + 0x10000 != $check_r6 - 0x4 ] {
+if {$check_r5 + 0x10000 != $check_r6 - 0x4} {
fail "unexpected value r5 + 0x10,000 != r6 , r5: $check_r5 r6: $check_r6 "
}
-if [expr $check_r6 != $check_r6] {
+if {$check_r6 != $check_r6} {
fail "unexpected value r6 != r6 , r6: $check_r6 r6: $check_r6 "
}
-if [expr $check_r7 - 0x10000 != $check_r6 + 0x4] {
+if {$check_r7 - 0x10000 != $check_r6 + 0x4} {
fail "unexpected value r7 - 0x10,000 != r6 + 0x4 , r7: $check_r7 r7: $check_r6 "
}
-if [expr $check_r8 - 0x100000 != $check_r6 + 0x8 ] {
+if {$check_r8 - 0x100000 != $check_r6 + 0x8} {
fail "unexpected value r8 - 0x100,000 != r6 , r8: $check_r8 r8: $check_r6 "
}
-if [expr $check_r9 - 0x1000000 != $check_r6 + 0xc ] {
+if {$check_r9 - 0x1000000 != $check_r6 + 0xc} {
fail "unexpected value r9 - 0x1,000,000 != r6 + 0xc , r9: $check_r9 r6: $check_r6 "
}
global gdb_prompt
global expect_out
global hex
-
+
set address ""
# Insert a breakpoint using the given function name, and extract
set test "found: '$instr'"
set peb [instr_to_patt $instr]
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $peb
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
return
}
-if [gdb_test "show arch" ".*powerpc:common.*" "checking for PPC arch"] {
+if {[gdb_test "show arch" ".*powerpc:common.*" "checking for PPC arch"]} {
return -1
}
"dl$i\[ \]*1\.2345678910\[ \t\]*\\(raw 0x2205800000000000000000049c5de09c\\)" \
"print dl$i register with the info reg command"
-gdb_test "info reg f[expr 2*$i]" \
- "f[expr 2*$i]\[ \]*8\.608957309287334e\-145\[ \t\]*\\(raw 0x2205800000000000\\)" \
+gdb_test "info reg f[expr {2*$i}]" \
+ "f[expr {2*$i}]\[ \]*8\.608957309287334e\-145\[ \t\]*\\(raw 0x2205800000000000\\)" \
"testing lower half of dl$i register"
-gdb_test "info reg f[expr 2*$i+1]" \
- "f[expr 2*$i+1]\[ \]*9\.7841140127686122e\-314\[ \t\]*\\(raw 0x000000049c5de09c\\)" \
+gdb_test "info reg f[expr {2*$i+1}]" \
+ "f[expr {2*$i+1}]\[ \]*9\.7841140127686122e\-314\[ \t\]*\\(raw 0x000000049c5de09c\\)" \
"testing upper half of dl$i register"
}
# FPRs
gdb_test_no_output "set \$f0 = 0.5"
for {set i 1} {$i < 32} {incr i 1} {
- gdb_test_no_output "set \$f$i = \$f[expr $i - 1] + 1.0"
+ gdb_test_no_output "set \$f$i = \$f[expr {$i - 1}] + 1.0"
}
gdb_test_no_output "set \$fpscr = 0x84005000"
# In some infrequent cases CXER doesn't match the
# pre-transactional XER, possibly due to a linux kernel bug.
set should_xfail 0
- if [istarget "powerpc*-*-linux*" && reg_name == "cxer"] {
+ if {[istarget "powerpc*-*-linux*" && reg_name == "cxer"]} {
set should_xfail 1
}
# Support for writing to the checkpointed registers is not
# currently available in the gdbserver stub.
-if [target_is_gdbserver] {
+if {[target_is_gdbserver]} {
unsupported "write to checkpointed registers"
return
}
gdb_test_no_output "set \$cf0 = 0.25"
for {set i 1} {$i < 32} {incr i 1} {
- gdb_test_no_output "set \$cf$i = \$cf[expr $i - 1] + 1.0"
+ gdb_test_no_output "set \$cf$i = \$cf[expr {$i - 1}] + 1.0"
}
for {set i 0} {$i < 32} {incr i 1} {
# Specifically that the values loaded by the lnia instruction
# reflect the value of the PC as if the instruction was
# not displaced.
-if [expr $check_r3 + 4 != $check_r4] {
+if {$check_r3 + 4 != $check_r4} {
fail "unexpected value r3+4 != r4 , r3: $check_r3 r4: $check_r4 "
}
-if [expr $check_r4 + 4 != $check_r5] {
+if {$check_r4 + 4 != $check_r5} {
fail "unexpected value r4+4 != r5 , r4: $check_r4 r5: $check_r5 "
}
-if [expr $check_r5 + 4 != $check_r6] {
+if {$check_r5 + 4 != $check_r6} {
fail "unexpected value r5+4 != r6 , r5: $check_r5 r6: $check_r6 "
}
-if [expr $check_r6 + 4 != $check_r7] {
+if {$check_r6 + 4 != $check_r7} {
fail "unexpected value r6+4 != r7 , r6: $check_r6 r7: $check_r7 "
}
-if [expr $check_r7 + 4 != $check_r8] {
+if {$check_r7 + 4 != $check_r8} {
fail "unexpected value r7+4 != r8 , r7: $check_r7 r8: $check_r8 "
}
-if [expr $check_r8 + 4 != $check_r9] {
+if {$check_r8 + 4 != $check_r9} {
fail "unexpected value r8+4 != r9 , r8: $check_r8 r9: $check_r9 "
}
set vs6_expected 0xa9b9c9d9a8b8c8d8a7b7c7d7a6b6c6d6
set vs7_expected 0xabbbcbdbaabacadaa9b9c9d9a8b8c8d8
-if [expr $check_vs4 != $vs4_expected] {
+if {$check_vs4 != $vs4_expected} {
fail "unexpected value vs4; actual:$check_vs4 expected:$vs4_expected"
}
-if [expr $check_vs5 != $vs5_expected ] {
+if {$check_vs5 != $vs5_expected} {
fail "unexpected value vs5; actual:$check_vs5 expected:$vs5_expected"
}
-if [expr $check_vs6 != $vs6_expected ] {
+if {$check_vs6 != $vs6_expected} {
fail "unexpected value vs6; actual:$check_vs6 expected:$vs6_expected"
}
-if [expr $check_vs7 != $vs7_expected ] {
+if {$check_vs7 != $vs7_expected} {
fail "unexpected value vs7; actual:$check_vs7 expected:$vs7_expected"
}
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
with_test_prefix "check PPR/DSCR access" {
clean_restart $::testfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
# Now do the actual test
clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return
}
clean_restart $testfile
-if ![runto bar] {
+if {![runto bar]} {
untested "could not run to bar"
return -1
}
with_test_prefix "check TAR access" {
clean_restart $::testfile
- if ![runto_main] {
+ if {![runto_main]} {
return
}
# Now do the actual test
clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return
}
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
global func
set test "found: $instr"
- if [regexp -nocase -line [instr_to_patt $instr] $func] {
+ if {[regexp -nocase -line [instr_to_patt $instr] $func]} {
pass $test
} else {
fail $test
standard_testfile
-if ![test_compiler_info gcc*] {
+if {![test_compiler_info gcc*]} {
# We use GCC's extended asm syntax
warning "unknown compiler"
return -1
standard_testfile
-if ![test_compiler_info gcc*] {
+if {![test_compiler_info gcc*]} {
# We use GCC's extended asm syntax
warning "unknown compiler"
return -1
require {istarget "powerpc*"} is_lp64_target
set flags { nodebug }
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
standard_testfile .c -main.c
lappend flags optimize=-O2
lappend flags additional_flags=-fno-stack-protector
# Figure out where the breakpoint will be placed taking account for
# stack alignment, and allocation of the dummy code area.
set bp_addr [get_valueof "/x" "\$sp" 0]
-set bp_addr [format 0x%x [expr ($bp_addr & ~0xf) - 0x20]]
+set bp_addr [format 0x%x [expr {($bp_addr & ~0xf) - 0x20}]]
# Fill the region we know will be used as the scratch area with the
# compressed nop instruction. If GDB fails to overwrite this with an
# that can be written to the fcsr register. The two arguments should
# be the value of each of the two fields within the fcsr register.
proc merge_fflags_and_frm { fflags_value frm_value } {
- set fcsr_value 0x[format %x [expr $fflags_value | ($frm_value << 5)]]
+ set fcsr_value 0x[format %x [expr {$fflags_value | ($frm_value << 5)}]]
return $fcsr_value
}
set frm_str_re [string_to_regexp "$frm_string"]
set frm_val_re [format %d ${frm_value}]
- set nv [format %d [expr ($fflags_value >> 4) & 0x1]]
- set dz [format %d [expr ($fflags_value >> 3) & 0x1]]
- set of [format %d [expr ($fflags_value >> 2) & 0x1]]
- set uf [format %d [expr ($fflags_value >> 1) & 0x1]]
- set nx [format %d [expr ($fflags_value >> 0) & 0x1]]
+ set nv [format %d [expr {($fflags_value >> 4) & 0x1}]]
+ set dz [format %d [expr {($fflags_value >> 3) & 0x1}]]
+ set of [format %d [expr {($fflags_value >> 2) & 0x1}]]
+ set uf [format %d [expr {($fflags_value >> 1) & 0x1}]]
+ set nx [format %d [expr {($fflags_value >> 0) & 0x1}]]
set fflags_pattern "NV:${nv} DZ:${dz} OF:${of} UF:${uf} NX:${nx}"
set frm_pattern "FRM:${frm_val_re} \\\[${frm_str_re}\\\]"
standard_testfile .S
-if [isnative] {
+if {[isnative]} {
# Create a temporary directory, to take a core dump there later.
set coredir [standard_output_file ${testfile}.d]
remote_exec build "rm -rf $coredir"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
-if [expr $before_pc + 6 != $after_pc] {
+if {$before_pc + 6 != $after_pc} {
fail "stepping first vector insn"
}
set b_high 3
set b_low 5
-set a [expr ($a_high << 32) | $a_low]
-set b [expr ($b_high << 32) | $b_low]
+set a [expr {($a_high << 32) | $a_low}]
+set b [expr {($b_high << 32) | $b_low}]
for {set j 0} {$j < 32} {incr j 1} {
- set i [expr 17 * $j % 32]
+ set i [expr {17 * $j % 32}]
gdb_test_no_output \
- "set \$v$i.v2_int64\[0\] = [expr $a * ($i + 1)]" \
+ "set \$v$i.v2_int64\[0\] = [expr {$a * ($i + 1)}]" \
"set v$i left"
- set i [expr 19 * (31 - $j) % 32]
+ set i [expr {19 * (31 - $j) % 32}]
gdb_test_no_output \
- "set \$v$i.v2_int64\[1\] = [expr $b * (32 - $i)]" \
+ "set \$v$i.v2_int64\[1\] = [expr {$b * (32 - $i)}]" \
"set v$i right"
}
set i 0
foreach {- left right} [regexp -all -inline -line {^.*:\s+(\w+)\s+(\w+)} $vregs] {
- if [expr $left != $a * ($i + 1) || $right != $b * (32 - $i)] {
+ if {$left != $a * ($i + 1) || $right != $b * (32 - $i)} {
fail "verify \$v$i after set"
}
if { $i < 16 } {
if { $r ne "v" } {
fail "info registers vector: bad line $j"
} elseif { $val ne [hex128 \
- [expr $a_high * ($i + 1) * $a_high ] \
- [expr $a_low * ($i + 1) * $a_low ] \
- [expr $b_high * (32 - $i) * $b_high * 32] \
- [expr $b_low * (32 - $i) * $b_low * 32] ] } {
+ [expr {$a_high * ($i + 1) * $a_high }] \
+ [expr {$a_low * ($i + 1) * $a_low }] \
+ [expr {$b_high * (32 - $i) * $b_high * 32}] \
+ [expr {$b_low * (32 - $i) * $b_low * 32}] ] } {
fail "compare \$v$i"
}
incr j 1
}
set test {$bp_addr == $prologue_end_addr}
- if { [expr $test] } {
+ if {$bp_addr == $prologue_end_addr} {
pass $test
} elseif { $bp_addr < $prologue_end_addr } {
# We'll allow this. For instance, amd64 has a prologue
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# This file is part of the gdb testsuite.
-# Basic tests of examining/assigning ADI version tags, and reporting
+# Basic tests of examining/assigning ADI version tags, and reporting
# precise mismatch.
require {istarget "sparc64*-*-linux*"}
set srcfile ${testfile}.S
set opts {}
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts]} {
return -1
}
set srcfile ${testfile}.S
set additional_flags "additional_flags=-mthumb"
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} [list debug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} [list debug $additional_flags]]} {
return -1
}
standard_testfile
set compile_flags {debug nowarnings quiet}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
-} elseif [test_compiler_info xlc*] {
+} elseif {[test_compiler_info xlc*]} {
set compile_flags "$compile_flags additional_flags=-qaltivec"
} else {
warning "unknown compiler"
standard_testfile
set compile_flags {debug nowarnings quiet}
-if [test_compiler_info gcc*] {
+if {[test_compiler_info gcc*]} {
set compile_flags "$compile_flags additional_flags=-maltivec additional_flags=-mabi=altivec"
-} elseif [test_compiler_info xlc*] {
+} elseif {[test_compiler_info xlc*]} {
set compile_flags "$compile_flags additional_flags=-qaltivec"
} else {
warning "unknown compiler"