Running tclint on the test-cases in gdb.dwarf2 shows a few problems.
Fix these.
"gdb/testsuite/lib",
"gdb/testsuite/gdb.arch",
"gdb/testsuite/gdb.base",
-"gdb/testsuite/gdb.dwarf2",
# IGNORE (document reason in trailing comment):
"gdb/testsuite/gdb.stabs", # To be removed.
]
standard_testfile .cc
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} {
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
}
return -1
}
- if ![runto func] {
+ if {![runto func]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list ldflags=-nostartfiles]] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
+ [list ldflags=-nostartfiles]]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list ldflags=-nostartfiles]] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
+ [list ldflags=-nostartfiles]]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list ldflags=-nostartfiles]] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
+ [list ldflags=-nostartfiles]]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
- [list ldflags=-nostartfiles]] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" \
+ [list ldflags=-nostartfiles]]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
clean_restart ${::testfile}
if { $goto_main } {
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile .S
set executable ${testfile}
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- [list nodebug $additional_flags]] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ [list nodebug $additional_flags]]} {
return -1
}
standard_testfile .c -debug.S
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptrbits 32
} else {
set ptrbits 64
standard_testfile main.c -debug.S
-if [prepare_for_testing "failed to prepare" $testfile \
- "${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ "${srcfile}" {}]} {
return -1
}
declare_labels cf_type cd_type cld_type
cf_type: DW_TAG_base_type {
- DW_AT_byte_size [expr 2 * $::float_size] DW_FORM_sdata
+ DW_AT_byte_size [expr {2 * $::float_size}] DW_FORM_sdata
DW_AT_encoding @DW_ATE_complex_float
DW_AT_name "complex float"
}
cd_type: DW_TAG_base_type {
- DW_AT_byte_size [expr 2 * $::double_size] DW_FORM_sdata
+ DW_AT_byte_size [expr {2 * $::double_size}] DW_FORM_sdata
DW_AT_encoding @DW_ATE_complex_float
DW_AT_name "complex double"
}
cld_type: DW_TAG_base_type {
- DW_AT_byte_size [expr 2 * $::long_double_size] DW_FORM_sdata
+ DW_AT_byte_size [expr {2 * $::long_double_size}] DW_FORM_sdata
DW_AT_encoding @DW_ATE_complex_float
DW_AT_name "complex long double"
}
declare_labels ci_type
ci_type: DW_TAG_base_type {
- DW_AT_byte_size [expr 2 * $::int_size] DW_FORM_sdata
+ DW_AT_byte_size [expr {2 * $::int_size}] DW_FORM_sdata
DW_AT_encoding @DW_ATE_lo_user
DW_AT_name "complex int"
}
declare_labels clang_cf_type clang_cd_type clang_cld_type
clang_cf_type: DW_TAG_base_type {
- DW_AT_byte_size [expr 2 * $::float_size] DW_FORM_sdata
+ DW_AT_byte_size [expr {2 * $::float_size}] DW_FORM_sdata
DW_AT_encoding @DW_ATE_complex_float
DW_AT_name "complex"
}
}
clang_cd_type: DW_TAG_base_type {
- DW_AT_byte_size [expr 2 * $::double_size] DW_FORM_sdata
+ DW_AT_byte_size [expr {2 * $::double_size}] DW_FORM_sdata
DW_AT_encoding @DW_ATE_complex_float
DW_AT_name "complex"
}
}
clang_cld_type: DW_TAG_base_type {
- DW_AT_byte_size [expr 2 * $::long_double_size] DW_FORM_sdata
+ DW_AT_byte_size [expr {2 * $::long_double_size}] DW_FORM_sdata
DW_AT_encoding @DW_ATE_complex_float
DW_AT_name "complex"
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile \
- "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ "${asm_file} ${srcfile}" {}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "ptype '$ctype'" \
"type = $ctype"
- eval set type_size \$::${type_id}_size
+ set type_size [subst \$::${type_id}_size]
gdb_test "p sizeof ('$type')" \
" = $type_size"
# With clang, the ctype name does not uniquely map to a type,
# so the size is unpredictable.
gdb_test "p sizeof ('$ctype')" \
- " = [expr 2 * $type_size]"
+ " = [expr {2 * $type_size}]"
}
set re_kfail \
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "break 'z:file.c':func" {Breakpoint [0-9]+ at .*}
-set dos [expr [istarget "*-*-cygwin*"] || [istarget "i?86-*-mingw*"] \
- || [istarget "*-*-msdosdjgpp*"] || [istarget "*-*-go32*"] ]
+set dos [expr {[istarget "*-*-cygwin*"] || [istarget "i?86-*-mingw*"] \
+ || [istarget "*-*-msdosdjgpp*"] || [istarget "*-*-go32*"]}]
if { $dos } {
gdb_test "break file.c:func" {Breakpoint [0-9]+ at .*}
return -1
}
-if ![runto stop_frame] {
+if {![runto stop_frame]} {
perror "Failed to stop in stop_frame"
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Line on which 'foo' is declared. Used in generated debug.
set foo_decl_line [gdb_get_line_number "foo decl line"]
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptr_type "data4"
} else {
set ptr_type "data8"
return false
}
- if ![runto_main] {
+ if {![runto_main]} {
return false
}
declare_labels lines_table
- set foo_offset [expr $::foo_middle_addr - $::foo_start_addr]
+ set foo_offset [expr {$::foo_middle_addr - $::foo_start_addr}]
cu { version $::dwarf_version } {
compile_unit {
declare_labels lines_table ranges_label
- set foo_offset [expr $::foo_middle_addr - $::r1_s]
+ set foo_offset [expr {$::foo_middle_addr - $::r1_s}]
cu { version $::dwarf_version } {
compile_unit {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto f] {
+if {![runto f]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
proc line_for { l } {
global srcfile
set line [gdb_get_line_number "$l:" $srcfile]
- return [expr $line + 1]
+ return [expr {$line + 1}]
}
# A helper proc to create the DWARF assembly for the test.
return -1
}
-if ![runto func] {
+if {![runto func]} {
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
}
set objcopy_program [gdb_find_objcopy]
set command "$objcopy_program -N block_start -N block_end -N break_at ${binfile} ${binfile_stripped}"
verbose -log "Executing: $command"
-set result [catch "exec $command" output]
+set result [catch {exec {*}$command} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
gdb_load ${binfile_stripped}
-if ![runto "*${break_at}"] {
+if {![runto "*${break_at}"]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
-if [build_executable "failed to prepare" $testfile \
- [list $asm_file $srcfile] {nodebug}] {
+if {[build_executable "failed to prepare" $testfile \
+ [list $asm_file $srcfile] {nodebug}]} {
return -1
}
}
}
-if [build_executable "failed to prepare" $testfile \
- [list $asm_file $srcfile] {nodebug}] {
+if {[build_executable "failed to prepare" $testfile \
+ [list $asm_file $srcfile] {nodebug}]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile \
- [list $asm_file $srcfile] {nodebug}] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ [list $asm_file $srcfile] {nodebug}]} {
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_test "n" "foo \\(2\\);" "bar2, 1st next"
gdb_test "n" "foo \\(4\\);" "bar2, 2nd next"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
proc line_for { l } {
global srcfile
set line [gdb_get_line_number "$l:" $srcfile]
- return [expr $line + 1]
+ return [expr {$line + 1}]
}
# Execute test.
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# Add unique test prefix.
proc test { cv cdw64 lv ldw64 {string_form ""}} {
with_test_prefix cv=$cv {
- with_test_prefix cdw=[expr $cdw64 ? 64 : 32] {
+ with_test_prefix cdw=[expr {$cdw64 ? 64 : 32}] {
with_test_prefix lv=$lv {
- with_test_prefix ldw=[expr $ldw64 ? 64 : 32] {
+ with_test_prefix ldw=[expr {$ldw64 ? 64 : 32}] {
if { $string_form == "" } {
test_1 $cv $cdw64 $lv $ldw64
} else {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile .S
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
- ${additional_flags}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
+ ${additional_flags}]} {
return -1
}
standard_testfile .c main.c
-if [prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"] {
+if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2"]} {
return -1
}
file_symbols no-run
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "p array3" " = 3" "array3 using DW_OP_call4"
# Location lists need PC.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "p arraynoloc" " = <optimized out>"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Creating a CU with 4-byte addresses lets this test link on
# both 32- and 64-bit machines.
cu { addr_size 4 } {
-
+
DW_TAG_compile_unit {
DW_AT_language @DW_LANG_C99
DW_AT_name $srcfile
DW_AT_encoding @DW_ATE_signed
DW_AT_name integer
}
-
+
array_label: DW_TAG_array_type {
DW_AT_name foo__array_type
DW_AT_type :$int_label
DW_AT_type :$int_label
DW_AT_lower_bound 0 DW_FORM_data1
DW_AT_upper_bound 127 DW_FORM_data1
- }
+ }
}
-
+
struct_label: DW_TAG_structure_type {
DW_AT_name "foo"
DW_AT_byte_size 12 DW_FORM_sdata
DW_AT_data_member_location 8 data1
}
}
-
+
pointer_label: DW_TAG_pointer_type {
DW_AT_byte_size 4 DW_FORM_sdata
DW_AT_type :$struct_label
}
-
+
DW_TAG_subprogram {
DW_AT_name func01
DW_AT_type :$int_label
DW_AT_location {} DW_FORM_block1
}
}
-
+
DW_TAG_subprogram {
DW_AT_name main
DW_AT_type :$int_label
}
}
}
-
+
set sources "$srcfile $asm_file"
if {[build_executable "failed to compile" $testfile $sources {nodebug}]} {
return -1
if {![runto func01]} {
return -1
}
-
+
gdb_test "info addr ptr" "Symbol \"ptr\" is optimized out."
-
+
gdb_test "print ptr" "<optimized out>"
-
+
gdb_test "print *ptr" "value has been optimized out"
-
+
gdb_test "print ptr->a" "value has been optimized out"
-
+
gdb_test "print ptr->x" "value has been optimized out"
-
+
gdb_test "print ptr->y" "value has been optimized out"
}
}
global mi_gdb_prompt
global binfile
-
+
with_test_prefix "mi" {
if {[mi_clean_restart $::testfile]} {
return
}
-
+
# This causes GDB to dereference a pointer-to-structure when doing
# -var-create.
mi_gdb_test "-gdb-set print object on" ".*" "set print object on"
-
+
mi_gdb_test "-break-insert main" ".*" "insert breakpoint main"
mi_gdb_test "-break-insert func01" ".*" "insert breakpoint func01"
-
+
# Run to main. Use an explicit expect here since the limited
# debug info will result in output that isn't handled by the
# MI test utilities.
fail "$test (timeout)"
}
}
-
+
# Run to func01. Use an explicit expect here as above.
set test "continue to func01"
mi_send_resuming_command "exec-continue" "$test"
fail "$test (timeout)"
}
}
-
+
# Test that -var-create for 'ptr' is successful.
mi_create_varobj "var1" "ptr" "create varobj for ptr"
set struct_foo_ptr \
[string cat \
[string_to_regexp "struct foo *"] "( $::re_address_class)?"]
-
+
# Test that -var-list-children of 'ptr' is successful.
mi_list_varobj_children "var1" \
[list \
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto f] {
+if {![runto f]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
clean_restart $::testfile
gdb_test_no_output "maintenance set ignore-prologue-end-flag on"
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
exp_continue
}
-re "^$gdb_prompt $" {
- gdb_assert [expr $end_seq_count == 3] $gdb_test_name
+ gdb_assert [expr {$end_seq_count == 3}] $gdb_test_name
}
-re ".*linetable: \\(\\(struct linetable \\*\\) 0x0\\):\r\nNo line table.\r\n" {
exp_continue
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
with_test_prefix "step-test-2" {
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# Note that the RE used for the following test will fail when the
- # breakpoint has been set on multiple locations. E.g. "(2 locations)".
+ # breakpoint has been set on multiple locations. E.g. "(2 locations)".
# This is intentional since that behavior is one of the bugs that
# this test case tests for.
gdb_test "break foo" \
}
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
with_test_prefix "step-test-3" {
clean_restart ${testfile}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
# Tests in the "enable_foo_cold_stepping" section, below, did
# not work prior to July, 2019. They had been disabled via
# use of the "enable_foo_cold_stepping" flag.
- #
+ #
# As noted elsewhere, this test case causes foo_cold,
# originally a separate function invoked via a subroutine
# call, to be considered as part of foo via use of
return -1
}
-if ![runto foo] {
+if {![runto foo]} {
return -1
}
gdb_load_no_complaints $binfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# warning: (Internal error: pc 0x555555554619 in read in psymtab,
# but not in symtab.)
# ...
-# (gdb)
+# (gdb)
gdb_test "break baz" \
"Breakpoint.*at.*"
clean_restart
gdb_load_no_complaints $binfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
# First try referencing DW_AT_frame_base which is not defined.
-if [runto func_nofb] {
+if {[runto func_nofb]} {
gdb_test "p func_nofb_var" {Could not find the frame base for "func_nofb".} "func_nofb print"
gdb_test "bt full" " in main .* main_var = 1" "func_nofb backtrace"
}
# And now try referencing DW_AT_frame_base defined using a self-reference
# (DW_OP_fbreg).
-if [runto func_loopfb] {
+if {[runto func_loopfb]} {
gdb_test "p func_loopfb_var" "DWARF-2 expression error: Loop detected .*" "func_loopfb print"
gdb_test "bt full" " in main .* main_var = 1" "func_loopfb backtrace"
}
return -1
}
-if ![runto stop_frame] {
+if {![runto stop_frame]} {
perror "Failed to stop in stop_frame"
return -1
}
return -1
}
-if ![runto foo] {
+if {![runto foo]} {
return 0
}
gdb_test "continue" "$hex in foo \\(\\)"
# Test multiple location breakpoints vs. prologue analysis on -O2 -g code.
# when the first statement of a function is an inlined function GDB could
# crash. Map of this testcase:
-#
+#
# File name Line number Starting address
# main.c 5 func_start
# other.c 1 func0
standard_testfile
set executable ${testfile}
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptrbits 32
} else {
set ptrbits 64
# 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 \
+set result [catch {exec $objcopy_program \
-N func0 -N func1 -N func2 -N func3 -N func_start -N func_end \
-N fund0 -N fund1 -N fund2 -N fund3 -N fund -N fund_start \
- ${binfile}" output]
+ ${binfile}} output]
verbose "result is $result"
verbose "output is $output"
if {$result != 0} {
clean_restart $executable
-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
}
return -1
}
-if ![runto "stop_frame"] {
+if {![runto "stop_frame"]} {
return -1
}
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
set foo_decl_line [gdb_get_line_number "foo decl line"]
set bar_call_line [gdb_get_line_number "bar call line"]
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptr_type "data4"
} else {
set ptr_type "data8"
if {$with_line_table} {
program {
DW_LNE_set_address foo_label
- line [expr $::bar_call_line - 2]
+ line [expr {$::bar_call_line - 2}]
DW_LNS_copy
DW_LNE_set_address foo_0
- line [expr $::bar_call_line - 1]
+ line [expr {$::bar_call_line - 1}]
DW_LNS_copy
DW_LNE_set_address foo_1
return false
}
- if ![runto_main] {
+ if {![runto_main]} {
return false
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile \
- "${asm_file} ${srcfile} ${srcfile2}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ "${asm_file} ${srcfile} ${srcfile2}" {}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# For that, we ask GDB by debugging our test program. Any program
# would do, but since we already have one specifically for this
# testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
set int_size [get_sizeof "int" -1]
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile .S main.c
-if [prepare_for_testing "failed to prepare" ${testfile} \
- [list $srcfile $srcfile2] {nodebug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} \
+ [list $srcfile $srcfile2] {nodebug}]} {
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
}
# Stress test gdb's handling of cached comp units, disable the cache.
gdb_test_no_output "maint set dwarf max-cache-age 0"
-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
}
if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
return -1
}
-if ![remote_file host exists [standard_output_file ${testfile}.dwp]] {
+if {![remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "testsuite run does not produce dwp files"
return 0
}
# 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
standard_testfile
remote_file host delete [standard_output_file ${testfile}.dwp]
-if [remote_file host exists [standard_output_file ${testfile}.dwp]] {
+if {[remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "dwp file cannot be deleted"
return 0
}
if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
return -1
}
-if ![remote_file host exists [standard_output_file ${testfile}.dwp]] {
+if {![remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "testsuite run does not produce dwp files"
return 0
}
remote_file host delete [standard_output_file ${thelink}.dwp]
# file link is only Tcl 8.4+.
remote_exec host "ln -sf ${testfile} [standard_output_file $thelink]"
-if ![remote_file host exists [standard_output_file $thelink]] {
+if {![remote_file host exists [standard_output_file $thelink]]} {
unsupported "host does not support symbolic links (binary symlink is missing)"
return 0
}
-if [remote_file host exists [standard_output_file $thelink.dwp]] {
+if {[remote_file host exists [standard_output_file $thelink.dwp]]} {
unsupported "host does not support symbolic links (we tried to delete a file and it is still there)"
return 0
}
gdb_exit
remote_exec host "mv -f [standard_output_file ${testfile}.dwp] [standard_output_file ${thelink}.dwp]"
-if [remote_file host exists [standard_output_file ${testfile}.dwp]] {
+if {[remote_file host exists [standard_output_file ${testfile}.dwp]]} {
unsupported "host does not support symbolic links (binary symlink exists)"
return 0
}
-if ![remote_file host exists [standard_output_file ${thelink}.dwp]] {
+if {![remote_file host exists [standard_output_file ${thelink}.dwp]]} {
unsupported "host does not support symbolic links (dwp symlink is missing)"
return 0
}
clean_restart "${dwp_symlink_dir}/${dwp_symlink_binary}"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} {
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
}
# Now we can start GDB.
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set obj [standard_output_file "${testfile}.o"]
set dwo [standard_output_file "${testfile}.dwo"]
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
- [list $srcfile \
- [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
- $obj]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
+ [list $srcfile \
+ [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
+ $obj]]} {
return -1
}
clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set obj [standard_output_file "${testfile}.o"]
set dwo [standard_output_file "${testfile}.dwo"]
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" \
- {nodebug pie} \
- [list $srcfile [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
- $obj]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" \
+ {nodebug pie} \
+ [list $srcfile \
+ [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
+ $obj]]} {
return -1
}
clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set obj [standard_output_file "${testfile}.o"]
set dwo [standard_output_file "${testfile}.dwo"]
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
- [list $srcfile \
- [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
- $obj]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
+ [list $srcfile \
+ [list nodebug split-dwo additional_flags=-DDWO=\"$dwo\"] \
+ $obj]]} {
return -1
}
clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Compile all of the input files, split the DWARF into the .dwo files.
set obj1 [standard_output_file "${testfile}-1-dw.o"]
set obj2 [standard_output_file "${testfile}-2-dw.o"]
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
- [list $asm_file_1 [list nodebug split-dwo] $obj1] \
- [list $asm_file_2 [list nodebug split-dwo] $obj2] \
- [list $srcfile [list nodebug]]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {nodebug} \
+ [list $asm_file_1 [list nodebug split-dwo] $obj1] \
+ [list $asm_file_2 [list nodebug split-dwo] $obj2] \
+ [list $srcfile [list nodebug]]]} {
return -1
}
clean_restart $::testfile
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Now we can start GDB.
clean_restart ${testfile}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
lappend dwo_options split-dwo
lappend dwo_options additional_flags=-DDWO=\"$dwo\"
-if [build_executable_and_dwo_files "$testfile.exp" "${binfile}" $options \
- [list $srcfile $dwo_options $obj]] {
+if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" $options \
+ [list $srcfile $dwo_options $obj]]} {
return -1
}
# We need to know the endianess in order
# to write some of the debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare for endianness test" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare for endianness test" ${testfile} ${srcfile}]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "mt print objfiles ${testfile}" \
# 32-bit targets do not support any of the testcases; keep quiet there.
set opts {quiet}
set executable ${testfile}-${name}
- if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" $opts] {
+ if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" $opts]} {
return -1
}
- if ![runto_main] {
+ if {![runto_main]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $executable "${asm_file} ${srcfile}" {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
lappend opts nopie
-if [info exists COMPILE] {
+if {[info exists COMPILE]} {
# make check RUNTESTFLAGS='gdb.dwarf2/implptr.exp COMPILE=1 CC_FOR_TARGET=gcc\ -m32'
set srcfile ${csrcfile}
lappend opts debug optimize=-O2
# Additional test to verify the referenced CU is not aged out.
gdb_test_no_output "maintenance set dwarf max-cache-age 0"
-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
}
}
}
-if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# For that, we ask GDB by debugging our implref-const program.
# Any program would do, but since we already have implref-const
# specifically for this testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# For that, we ask GDB by debugging our implref-global program.
# Any program would do, but since we already have implref-global
# specifically for this testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# For that, we ask GDB by debugging our implref-struct program.
# Any program would do, but since we already have implref-struct
# specifically for this testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
# DW_OP_GNU_implicit_pointer implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# We need to know the size of integer type in order
# to write some of the debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
# We need to know the size of integer and address types in order
# to write some of the debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug}]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# We need to know the size of integer types in order to write some of the
# debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
# We need to know the size of integer and address types in order
# to write some of the debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile .c
-if [prepare_for_testing "failed to prepare" $testfile $srcfile \
- {debug nowarnings}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug nowarnings}]} {
return -1
}
set executable ${testfile}
set asm_file [standard_output_file ${srcfile2}]
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
# Value returned is $1 = (B *) $hex <g_>
# Note that this compilation is used for all GDB sessions.
set exec_options [list debug shlib=$lib_so]
-if [prepare_for_testing "failed to prepare" ${testfile} \
- ${::srcfile} $exec_options] {
+if {[prepare_for_testing "failed to prepare" ${testfile} \
+ ${::srcfile} $exec_options]} {
return -1
}
set ::directories $directories
set ::file_names $file_names
set ::is_64 $is_64
- set 32_or_64 [expr $is_64 ? 64 : 32]
+ set 32_or_64 [expr {$is_64 ? 64 : 32}]
set asm_file [standard_output_file ${::testfile}-${test_name}-${32_or_64}.S]
Dwarf::assemble $asm_file {
}
}
- 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
}
lappend opts c++
lappend opts additional_flags=-std=c++11
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $opts]} {
return -1
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile} ${srcfile3}" {nodebug}] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile} ${srcfile3}" {nodebug}]} {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
set host_binfile [gdb_remote_download host $binfile]
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}]
lassign [remote_exec host mktemp -d] ret cache_dir
return -1
}
-if ![runto foo] {
+if {![runto foo]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile .S
-if [is_ilp32_target] {
+if {[is_ilp32_target]} {
set ptrbits 32
} else {
set ptrbits 64
}
}
-if [prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}] {
+if {[prepare_for_testing "failed to prepare" $testfile "${asm_file} ${srcfile}" {}]} {
return -1
}
" int j;" \
"}"]
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile symbol_needs_eval.c ${gdb_test_file_name}-dw.S
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
return
}
# so an error should be reported.
gdb_test "print/d a" "No frame selected." "variable a can't be printed"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
standard_testfile symbol_needs_eval.c ${gdb_test_file_name}-dw.S
-if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
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
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
return -1
}
-if ![runto func] {
+if {![runto func]} {
return -1
}
# 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 support for DW_OP_GNU_variable_value.
+# Test support for DW_OP_GNU_variable_value.
load_lib dwarf.exp
# For that, we ask GDB by debugging our varval program.
# Any program would do, but since we already have varval
# specifically for this testcase, might as well use that.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
return -1
}
set int_size [get_sizeof "int" -1]
global asm_file executable srcfile bad
set bad ${arg_bad}
- # Create the DWARF.
+ # Create the DWARF.
Dwarf::assemble ${asm_file} {
global bad int_size addr_size
}
}
- if [prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}] {
+ if {[prepare_for_testing "failed to prepare" ${executable} [list ${asm_file} ${srcfile}] {}]} {
return -1
}
}
}
# DW_OP_GNU_variable_value implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
# DW_OP_GNU_variable_value implementation requires a valid frame.
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "print badval" "value has been optimized out"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}