Running tclint on the test-cases in gdb.cp shows a few problems.
Fix these.
"gdb/testsuite/lib",
"gdb/testsuite/gdb.arch",
"gdb/testsuite/gdb.base",
-"gdb/testsuite/gdb.cp",
"gdb/testsuite/gdb.dwarf2",
"gdb/testsuite/gdb.mi",
# IGNORE (document reason in trailing comment):
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
#
set main_line 25
-# The commands we test here produce many lines of output; disable "press
+# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"
set old_gdb_prompt $gdb_prompt
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
-send_gdb "set annotate 2\n"
+send_gdb "set annotate 2\n"
gdb_expect {
-re "set annotate 2\r\n$gdb_prompt$" { pass "annotation set at level 2" }
-re ".*$gdb_prompt$" { fail "annotation set at level 2" }
}
#
-# break at first line of main.
+# break at first line of main.
#
set pat [multi_line "" \
"\032\032post-prompt" \
}
#
-# set up a watch point on a.x
+# set up a watch point on a.x
#
set pat [multi_line "" \
"\032\032post-prompt" \
#
-# send ^C to gdb, so that the quit() function gets called
+# send ^C to gdb, so that the quit() function gets called
# and annotate-quit is tested
# test:
# annotate-quit
#
-if ![target_info exists gdb,nointerrupts] {
+if {![target_info exists gdb,nointerrupts]} {
send_gdb "\003"
gdb_expect {
-re "\r\n\032\032error-begin\r\nQuit\r\n\r\n\032\032quit\r\n$gdb_prompt$" \
}
#
-# FIXME: the testsuite does not currently have tests for
+# FIXME: the testsuite does not currently have tests for
# annotate_catchpoints and annotate_function_call
-# and a few variants of the annotations that are
+# and a few variants of the annotations that are
# tested (marked by FIXME on the annot?.exp files)
#
#
set main_line 25
-# The commands we test here produce many lines of output; disable "press
+# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"
set old_gdb_prompt $gdb_prompt
set gdb_prompt "\r\n\032\032pre-prompt\r\n$gdb_prompt \r\n\032\032prompt\r\n"
-send_gdb "set annotate 3\n"
+send_gdb "set annotate 3\n"
gdb_expect_list "annotation set at level 3" "\r\n$gdb_prompt$" {
"set annotate 3"
}
}
#
-# break at first line of main.
+# break at first line of main.
#
send_gdb "break 22\n"
gdb_expect_list "break at main" "$gdb_prompt$" {
}
#
-# set up a watch point on a.x
+# set up a watch point on a.x
#
send_gdb "watch a.x\n"
gdb_expect_list "set watch on a.x" "$gdb_prompt$" {
}
#
-# send ^C to gdb, so that the quit() function gets called
+# send ^C to gdb, so that the quit() function gets called
# and annotate-quit is tested
# test:
# annotate-quit
#
-if ![target_info exists gdb,nointerrupts] {
+if {![target_info exists gdb,nointerrupts]} {
send_gdb "\003"
gdb_expect_list "annotate-quit" "$gdb_prompt$" {
"\r\n\032\032error-begin\r\n"
}
#
-# FIXME: the testsuite does not currently have tests for
+# FIXME: the testsuite does not currently have tests for
# annotate_catchpoints and annotate_function_call
-# and a few variants of the annotations that are
+# and a few variants of the annotations that are
# tested (marked by FIXME on the annot?.exp files)
#
# Modify the member just set
gdb_test_no_output "set var foo.cloth = 35" "set var foo.cloth"
-# Now print out anon union again to see if the right member was set
+# Now print out anon union again to see if the right member was set
gdb_test "print foo" \
"\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 0, x = \{rock = 0, rock2 = 0\}, \{qux = 0, mux = 0\}, boulder = 0\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
"print foo 3"
gdb_test "next" "42\[ \t\]*foo.mux = 55;" "next 3"
-# Now print out anon union again
+# Now print out anon union again
gdb_test "print foo" \
"\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 44, x = \{rock = 44, rock2 = 0\}, \{qux = 44, mux = 44\}, boulder = 44\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
"print foo 4"
# Modify the member just set
gdb_test_no_output "set var foo.pebble = 45" "set var foo.pebble"
-# Now print out anon union again to see if the right member was set
+# Now print out anon union again to see if the right member was set
gdb_test "print foo" \
"\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 45, x = \{rock = 45, rock2 = 0\}, \{qux = 45, mux = 45\}, boulder = 45\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
"print foo 5"
# Modify another member at a different level
gdb_test_no_output "set var foo.qux = 46" "set var foo.qux"
-# Now print out anon union again to see if the right member was set
+# Now print out anon union again to see if the right member was set
gdb_test "print foo" \
"\\$\[0-9\]* = \{num1 = \{zero = 0, one = 0\}, \{pebble = 46, x = \{rock = 46, rock2 = 0\}, \{qux = 46, mux = 46\}, boulder = 46\}, \{paper = 35, cloth = 35\}, num2 = \{two = 0, three = 0\}\}" \
"print foo 6"
# See if z shows the same value
gdb_test "print z" "\\$\[0-9\]* = 45" "print z 2"
-# Set the anon union member
+# Set the anon union member
gdb_test_no_output "set var z = 27" "set var z"
# See if the change in value is noticed
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "print * b" ".* = {<A> = {a = 42}, b = 1729}" \
"let compiler cast base class pointer to derived class pointer"
-# Check upcasting (it is trivial but still).
+# Check upcasting (it is trivial but still).
gdb_test "print * (A *) b" ".* = {a = 42}" \
"cast derived class pointer to base class pointer"
# Casting References.
-# Check upcasting.
+# Check upcasting.
gdb_test "print (A &) br" ".* = .A &.* {a = 42}" \
"cast derived class reference to base class reference"
#
# gcc 2.X with stabs (stabs or stabs+?) used to have a problem with
# static methods whose name is the same as their argument mangling.
-
+
cp_test_ptype_class \
"class Static" "" "class" "Static" \
{
# Test simple access to class members.
proc test_non_inherited_member_access {} {
-
+
# Print non-inherited members of g_A.
gdb_test "print g_A.a" ".* = 1"
gdb_test "print g_A.x" ".* = 2"
set tst "setting breakpoint at '$sym'"
if {[gdb_breakpoint "'$sym'"]} {
pass $tst
- }
+ }
}
# are (none need character escaping -- "add" will take care of that):
# add name type print_name list
-# NAME,type: value is type of function
+# NAME,type: value is type of function
# NAME,print: value is print name of function (careful w/inherited/virtual!)
# NAME,list: value is comment in source code on first line of function
# (without the leading "//")
# operator[] needs double backslashes, so that a single backslash
# will be sent to GDB, preventing the square brackets from being
- # evaluated as a regular expression.
+ # evaluated as a regular expression.
info_func "operator\\\[\\\](" "void foo::operator\[\]($dm_type_foo_ref);"
# These are gnarly because they might end with 'static'.
gdb_test "print &foo::operator new" \
" = .* $hex <foo::operator new\\(.*\\)(| static)>"
gdb_test "print &foo::operator new\[\]" \
- " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>"
+ " = .* $hex <foo::operator new\\\[\\\]\\(.*\\)(| static)>"
print_addr "foo::operator delete($dm_type_void_star)"
print_addr "foo::operator delete\[\]($dm_type_void_star)"
fail "$style: set demangle-style"
error "set_demangling_style: set style"
}
- timeout {
+ timeout {
fail "$style: set demangle-style (timeout)"
error "set_demangling_style: set style"
}
gdb_test_multiple "show demangle-style" \
"$style: check demangling style" {
- -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" {
+ -re "The current C\[+\]+ demangling style is \"$style\".\r\n$gdb_prompt $" {
pass "$style: check demangling style"
}
-re ".*$gdb_prompt $" {
fail "$style: check demangling style"
error "set_demangling_style: check style"
}
- timeout {
- fail "$style: check demangling style (timeout)"
+ timeout {
+ fail "$style: check demangling style (timeout)"
error "set_demangling_style: check style"
}
}
### Why don't we just pass the STYLE and NAME as two separate
### arguments, or let the style be a global variable? That would be
### cleaner. However, doing it this way means that:
-###
+###
### 1) the name of the test, as recorded in the summary and log,
### appears verbatim in the script, and
-###
+###
### 2) that test names are unique, even though we try to demangle the same
### identifiers using several different mangling styles.
-###
+###
### This makes it a lot easier for people tracking down failures to
### find the one they care about.
}
proc catch_demangling_errors {command} {
- if {[catch $command result]} {
+ if {[catch {$command} result]} {
puts "ERROR: demangle.exp: while running $command: $result"
}
}
# Test support for different demangling styles. Note that this does
# not depend upon running the test program and does not depend upon
-# gdb being able to lookup any C++ symbols. It simply calls the
+# gdb being able to lookup any C++ symbols. It simply calls the
# internal demangler with synthesized strings and tests the results.
proc do_tests {} {
# This file is part of the gdb testsuite
# tests for inheritance, with several derivations types combinations
-# (private, public, protected)
+# (private, public, protected)
# classes have simple members and member functions.
set ws "\[\r\n\t \]+"
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
if {![runto_main]} {
return
-}
+}
gdb_breakpoint [gdb_get_line_number "Break here"]
gdb_continue_to_breakpoint here
# Xfail for missing DW_AT_type in DW_TAG_enumeration_type, gcc PR debug/16063.
-set have_xfail [expr [test_compiler_info gcc-*] && [gcc_major_version] < 5]
+set have_xfail [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 5}]
gdb_test_multiple "ptype arg1" "" {
-re -wrap "type = enum enum1 : unsigned int \\{\\}" {
gdb_load ${binfile}
gdb_load_shlib $binfile_lib
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
require allow_stl_tests
standard_testfile .cc
-
+
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
gdb_test "break catcher" "Breakpoint \[0-9\]+ at.*"
# Get the first exception thrown
-
+
gdb_test "continue" \
"Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*" \
"continue to first throw"
do_continue_to_catchpoint "continue to catch"
gdb_test "print \$_exception" " = $output" \
"print exception value at catch"
-
+
do_continue_to_catchpoint "continue to rethrow"
gdb_test "print \$_exception" " = $output" \
"print exception value at rethrow"
if { [prepare_for_testing "failed to prepare" expand-sals $srcfile {debug c++}] } {
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
# Author: P. N. Hilfinger, AdaCore, Inc.
-# This test checks the behavior of formatted print when applied to a
+# This test checks the behavior of formatted print when applied to a
# reference value. The intended behavior is that a formatted print of
-# such a value should display the same value as a plain print,
+# such a value should display the same value as a plain print,
# modulo format, of course. Older versions of GDB would instead print
# the reference's address value itself when doing a formatted print,
# rather than printing both that and the dereferenced value. We also
-re "\\$\[0-9\]+ = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" {
return $expect_out(1,string)
}
- timeout {
+ timeout {
perror "couldn't find address of $var"
return ""
}
gdb_test_multiple $test $test {
-re "\\$\[0-9\]+ = \\([string_to_regexp $type]\\) @0x\[a-f0-9\]+: [string_to_regexp $val].*$gdb_prompt $" {
pass $test
- }
+ }
-re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
fail "$test (prints just address)"
}
gdb_test_multiple $test $test {
-re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
pass $test
- }
+ }
-re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
fail "$test (prints unexpected address)"
}
if {![runto_main]} {
return
-}
+}
# See http://sources.redhat.com/gdb/bugs/1355
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12066
lappend flags_nodebug nodebug
lappend flags_nodebug c++
-if [prepare_for_testing "failed to prepare" $testfile $srcfile $flags_debug] {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags_debug]} {
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
}
}
-if [prepare_for_testing "failed to prepare" $testfile \
- [list $asm_file $srcfile] $flags_nodebug] {
+if {[prepare_for_testing "failed to prepare" $testfile \
+ [list $asm_file $srcfile] $flags_nodebug]} {
return
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
# the rest of the test can be complied with debug information. Whilst we
# are at it, also test functions with debug information and C functions too.
-if [target_info exists gdb,cannot_call_functions] {
+if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
continue
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
kfail gdb/825 "Local out of scope"
}
}
-
+
# DTS CLLbs14316 and CLLbs17058
# coulter - I added a clause for HP's aCC compiler. We print out the type
# because of two reasons:
# There is a number at the end of InnerLocal4 which should not be there,
# DTS CLLbs14316
-# The line number for the class
+# The line number for the class
# setup_xfail "hppa*-*-*" CLLbs14316
# ---
}
get_debug_format
-set non_dwarf [expr ! [test_debug_format "DWARF \[0-9\]"]]
+set non_dwarf [expr {! [test_debug_format "DWARF \[0-9\]"]}]
# First, run to after we've constructed all the objects:
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return
}
# will loose. The heuristic of GDB should be improved.
setup_kfail gdb/12924 "*-*-uclinux*"
fail "disabled breakpoint 1.2"
- }
+ }
}
# Make sure we can set a breakpoint on a source statement that spans
gdb_test_no_output {condition $bpnum i==1} \
"separate condition: set condition"
-
+
gdb_run_cmd
gdb_test "" "Breakpoint $bkptno_num_re,.*foo<int> \\(i=1\\).*" "separate condition: run to breakpoint"
gdb_test "print foo.func (b, f)" " = ${result}"
incr result
- set result [expr $result + 3]
+ set result [expr {$result + 3}]
gdb_test "print foo += b" \
" = \\((?:struct )?foo_type &\\) @${hex}: \\\{var = ${result}\\\}"
"\\$\[0-9\]* = 20" \
"print x in A::foo"
-# Check access to this pointer
+# Check access to this pointer
gdb_test "print this" \
"\\$\[0-9\]* = \\((class |)A *\\* *(const|)\\) $hex" \
"\\$\[0-9\]* = 33" \
"print x in A::bar"
-# Check access to this pointer
+# Check access to this pointer
get_debug_format
"\\$\[0-9\]* = 33" \
"print data_ in funk::getFunky"
-# Check access to this pointer
+# Check access to this pointer
gdb_test "print this" \
"\\$\[0-9\]* = \\((class |)funk *\\* *(const|)\\) $hex" \
pass "finish program"
}
-re "Continuing.* EXIT code 0.*$inferior_exited_re normally.*$gdb_prompt $" {
- pass "finish program (exit wrapper)"
+ pass "finish program (exit wrapper)"
}
}
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_no_output [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]"
}
}
"print as bool"
# Test bool type printing, etc.
-# Note: Language is already set to C++ above!
+# Note: Language is already set to C++ above!
gdb_test "print v_bool" "\\$\[0-9\]* = false" "print a bool var"
# set a bool variable
gdb_test_multiple "info func xyzq" "info func xyzq" {
-re "All functions.*File.*namespace.cc:\r\n.*\tint AAA::A_xyzq\\(int\\);\r\n.*\tint BBB::B_xyzq\\(int\\);\r\n.*\tchar AAA::xyzq\\(char\\);\r\n.*\tchar BBB::xyzq\\(char\\);\r\n.*\tchar BBB::CCC::xyzq\\(char\\);\r\n.*\tchar BBB::Class::xyzq\\(char\\);\r\n$gdb_prompt $" {
pass "info func xyzq"
- }
+ }
-re "All functions.*File.*namespace.cc:\r\n.*\tint AAA::A_xyzq\\(int\\);\r\n.*\tchar AAA::xyzq\\(char\\);\r\n.*\tint BBB::B_xyzq\\(int\\);\r\n.*\tchar BBB::CCC::xyzq\\(char\\);\r\n.*\tchar BBB::Class::xyzq\\(char\\);\r\n.*\tchar BBB::xyzq\\(char\\);\r\n$gdb_prompt $" {
pass "info func xyzq"
- }
+ }
}
# Call a function in a namespace
gdb_test "print BBB::CCC::xyzq('x')" \
"\\$\[0-9\]* = 122 'z'"
-
+
# Break on a function in a nested namespace
gdb_test "break BBB::CCC::xyzq" \
gdb_test "print C::cOtherFileVar" "\\$\[0-9\].* = 319"
gdb_test "print ::C::cOtherFileVar" "\\$\[0-9\].* = 319"
-if $xfail_class_types { setup_xfail *-*-* }
+if {$xfail_class_types} { setup_xfail *-*-* }
gdb_test "whatis C::OtherFileClass::cOtherFileClassType" "type = short"
-if $xfail_class_types { setup_xfail *-*-* }
+if {$xfail_class_types} { setup_xfail *-*-* }
gdb_test "whatis ::C::OtherFileClass::cOtherFileClassType" "type = short"
gdb_test "print C::OtherFileClass::cOtherFileClassVar" " = 318"
}
-re "\\$\[0-9\].* = 318\r\n$gdb_prompt $" {
# Do not permit to XFAIL on recent GCCs.
- if $xfail_class_types {
- setup_xfail *-*-*
+ if {$xfail_class_types} {
+ setup_xfail *-*-*
fail $test
# Unresolved means human intervention is required to determine
# whether the test passed or failed. Since the previous test
# Test class typedefs printing.
set expect "type = class C::OtherFileClass \{\r\n.*\r\n *typedef short cOtherFileClassType;\r\n *typedef long cOtherFileClassType2;\r\n\}"
-if $xfail_class_types { setup_xfail *-*-* }
+if {$xfail_class_types} { setup_xfail *-*-* }
gdb_test "ptype OtherFileClass" $expect "ptype OtherFileClass typedefs"
-if $xfail_class_types { setup_xfail *-*-* }
+if {$xfail_class_types} { setup_xfail *-*-* }
gdb_test "ptype ::C::OtherFileClass" $expect "ptype ::C::OtherFileClass typedefs"
# Some anonymous namespace tests.
# (the source only uses that at the root struct).
# We also don't create nodes not in the source file
# (id >= 60).
- if {[expr {$n % 10}] != 0 && $n < 60} {
+ if {$n % 10 != 0 && $n < 60} {
lappend nodes($id,children) $n
}
}
send_log "int\nmain \(\)\n\{\n"
set plist {}
for {set i 10} {$i < 60} {incr i} {
- if {$i > 10 && [expr {$i % 10}] == 0} {
+ if {$i > 10 && $i % 10 == 0} {
incr i
set plist {"S10"}
send_log "\n"
if {![runto_main]} {
return
-}
+}
if {![skip_unwinder_tests]} {
unsupported "nextoverthrow.exp could not find _Unwind_DebugHook"
# Xfail for incorrect decl_line on DW_TAG_imported_module,
# gcc PR debug/108716.
set have_gcc108716_xfail \
- [expr [test_compiler_info gcc-*] && [gcc_major_version] < 13]
+ [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 13}]
gdb_test_multiple "print x" "print x, before using statement" {
-re -wrap "No symbol .x. in current context.*" {
gdb_test_no_output "set language c++"
-if [gdb_breakpoint "myclass::func"] {
+if {[gdb_breakpoint "myclass::func"]} {
pass "setting breakpoint at myclass::func"
}
set line_bar_A [gdb_get_line_number "int bar (A)"]
set line_bar_B [gdb_get_line_number "int bar (B)"]
- set lines1 [line_range_pattern [expr $line_bar_A - 5] [expr $line_bar_A + 4]]
- set lines2 [line_range_pattern [expr $line_bar_B - 5] [expr $line_bar_B + 4]]
+ set lines1 [line_range_pattern [expr {$line_bar_A - 5}] [expr {$line_bar_A + 4}]]
+ set lines2 [line_range_pattern [expr {$line_bar_B - 5}] [expr {$line_bar_B + 4}]]
set any "\[^\r\n\]*"
set h1_re "file: \"${any}overload.cc\", line number: $line_bar_A, symbol: \"bar\\(A\\)\""
# Test choice "cancel".
# This is copy-and-paste from set_bp_overloaded.
-send_gdb "break foo::overload1arg\n"
+send_gdb "break foo::overload1arg\n"
gdb_expect {
-re "$menu_overload1arg" {
pass "bp menu for foo::overload1arg choice cancel"
# This is copy-and-paste from set_bp_overloaded.
incr bpnum
-send_gdb "break foo::overload1arg\n"
+send_gdb "break foo::overload1arg\n"
gdb_expect {
-re "$menu_overload1arg" {
pass "bp menu for foo::overload1arg choice all"
}
-re "Continuing.\r\n\r\nBreakpoint $bkptno_num_re, foo::overload1arg \\(this=${hex}, arg=.*\\) at .*$srcfile:$line\r\n$decimal\[\t \]+{ $body }.*$gdb_prompt $" {
- if $might_kfail {
+ if {$might_kfail} {
kfail "c++/8130" "continue to bp overloaded : $argtype"
} else {
fail "continue to bp overloaded : $argtype"
set definition "$classname\:\:$signature
{
data\[0\] = $CUSTOM;
- data\[[expr $length - 1]\] = $CUSTOM;
+ data\[[expr {$length - 1}]\] = $CUSTOM;
tracer = $TRACE;
}\n"
}
$classname\:\:$classname (void)
{
data\[0\] = $ORIGINAL;
- data\[[expr $length - 1]\] = $ORIGINAL;
+ data\[[expr {$length - 1}]\] = $ORIGINAL;
}
$definitions
gdb_test "print ${name}_var.${data_field}\[0\]" " = $ORIGINAL" \
"cbv argument should not change, item 0"
if {$length > 1} {
- set last_index [expr $length - 1]
+ set last_index [expr {$length - 1}]
gdb_test "print ${name}_var.${data_field}\[$last_index\]" \
" = $ORIGINAL" \
"cbv argument should not change, item $last_index"
# sure the test still fails:
#
# 2002-08-29 Jim Blandy <jimb@redhat.com>
-#
+#
# * symtab.c (lookup_symbol_aux): In the cases where we find a
# minimal symbol of an appropriate name and use its address to
# select a symtab to read and search, use `name' (as passed to us)
# The original bug was that you'd try to set a breakpoint on a method
# (e.g., `break s::method1'), and you'd get an error, but if you
# repeated the command, it would work the second time:
-#
+#
# (gdb) break s::method1
# the class s does not have any method named method1
# Hint: try 's::method1<TAB> or 's::method1<ESC-?>
# (Note leading single quote.)
# (gdb) break s::method1
# Breakpoint 1 at 0x804841b: file psmang1.cc, line 13.
-# (gdb)
+# (gdb)
#
# We observed this bug first using Stabs, and then using Dwarf 2.
#
gdb_test "print static_cast<float&> (global_float)" " = \\(float &\\) @$hex: 3\\.$decimal"
gdb_test "print static_cast<float&&> (global_float)" " = \\(float &&\\) @$hex: 3\\.$decimal"
-set t "print value of f2 on (Child&&) in main"
+set t "print value of f2 on (Child&&) in main"
gdb_start_again "marker1 here" $t
gdb_test "print f2(static_cast<Child&&>(Q))" ".* = 40.*" $t
gdb_test "up" ".*main.*" "up from marker1 1"
-gdb_test "print rrt" " = \\(short( int)? &&\\) @$hex: -1" "print value of rrt"
+gdb_test "print rrt" " = \\(short( int)? &&\\) @$hex: -1" "print value of rrt"
gdb_test "ptype rrt" "type = short( int)? &&"
clean_restart $testfile
- if ![runto_main] {
+ if {![runto_main]} {
return 0
}
# Delete all breakpoints, watchpoints, tracepoints, and catchpoints so that
}
with_test_prefix "save" {
- if ![restart] {
+ if {![restart]} {
return -1
}
}
with_test_prefix "restore" {
- if ![restart] {
+ if {![restart]} {
return -1
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
clean_restart $executable
- if ![runto $main_location qualified] {
+ if {![runto $main_location qualified]} {
return
}
# that some easier heuristic could be figured out). Still, it is
# not certain that the first failure wouldn't also be fixed by
# having location view support, so for now it is tagged as such.
- set have_kfail [expr [test_compiler_info gcc*] && !$use_header]
+ set have_kfail [expr {[test_compiler_info gcc*] && !$use_header}]
set ok 1
gdb_test_multiple "next" "next step 1" {
clean_restart ${executable}
- if ![runto_main] {
+ if {![runto_main]} {
return
}
}
# Xfail for superfluous DW_TAG_lexical_block, gcc PR debug/55541.
-set have_xfail [expr [test_compiler_info gcc-*] && [gcc_major_version] < 5]
+set have_xfail [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 5}]
gdb_test "ptype Outer::Inner::InnerInner" \
"type = struct Outer::Inner::InnerInner.*"
gdb_continue_to_breakpoint "continue to first breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "ptype T" "double" "test type of T in base_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print I" " = 23" "test value of I in base_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print P == &a_global" " = true" "test value of P in base_m"
if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
if {!$have_pr_45024_fixed} { setup_xfail *-*-* }
gdb_test "print I" " = 47" "test value of I in inner_m"
-if $have_older_template_gcc { setup_xfail "*-*-*"
+if {$have_older_template_gcc} { setup_xfail "*-*-*"
} elseif {[test_compiler_info {gcc-[0-3]-*}]
|| [test_compiler_info {gcc-4-[0-5]-*}]} {
# gcc-4.5.x still does not emit inner DW_TAG_structure_type.
if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
gdb_test "print MP" "&S::f" "test value of MP in inner_m"
-if $have_older_template_gcc { setup_xfail "*-*-*"
+if {$have_older_template_gcc} { setup_xfail "*-*-*"
} elseif {[test_compiler_info {gcc-[0-3]-*}]
|| [test_compiler_info {gcc-4-[0-5]-*}]} {
# gcc-4.5.x still does not emit outer DW_TAG_structure_type.
gdb_continue_to_breakpoint "continue to third breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "ptype T" "unsigned char" "test type of T in func"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print I" " = 91" "test value of I in func"
# PR symtab/16842 - gdb used to crash here.
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in func"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print P == &a_global" " = true" "test value of P in func"
if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
gdb_continue_to_breakpoint "continue to fourth breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "ptype T" "double" "test type of T in templ_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print I" " = 23" "test value of I in templ_m"
# PR symtab/16842 - gdb used to crash here.
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "info addr I" "Symbol \"I\" is constant." "test address of I in templ_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "print P == &a_global" " = true" "test value of P in templ_m"
if {!$have_pr_41736_fixed} { setup_xfail *-*-* }
gdb_test "print MP" "&S::f" "test value of MP in templ_m"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "whatis Q" "short" "test type of Q in templ_m"
#
gdb_continue_to_breakpoint "continue to fifth breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*" }
+if {$have_older_template_gcc} { setup_xfail "*-*-*" }
gdb_test "ptype F" "type = void \\\(S::\\\*\\\)\\\(S \\\* const\\\)" \
"test type of F in k2_m"
gdb_continue_to_breakpoint "continue to sixth breakpoint for temargs"
-if $have_older_template_gcc { setup_xfail "*-*-*"
+if {$have_older_template_gcc} { setup_xfail "*-*-*"
} elseif { $using_gcc } { setup_xfail gcc/49546 "*-*-*" }
gdb_test "ptype F" {type = void \(\*\)\(int\)} "test type of F in k3_m"
-if $have_older_template_gcc { setup_xfail "*-*-*"
+if {$have_older_template_gcc} { setup_xfail "*-*-*"
} elseif { $using_gcc } { setup_xfail gcc/49546 "*-*-*" }
gdb_test "print F" { = \(void \(\*\)\(int\)\) 0x[0-9a-f]+ <S3::m\(int\)>} \
"test value of F in k3_m"
"constructor breakpoint (bad menu choices)"
}
}
-
+
gdb_test_multiple "break T5<int>::~T5" "destructor_breakpoint" {
-re "Breakpoint.*at.* file .*${testfile}.cc, line.*$gdb_prompt $"
{
kfail "gdb/8217" "destructor breakpoint"
}
}
-
+
gdb_test "break T5<int>::value" \
"Breakpoint.*at.* file .*${testfile}.cc, line.*" \
"value method breakpoint"
proc test_template_calls {} {
global gdb_prompt
- 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_template_typedef
test_template_args
- if [ runto_main] {
+ if {[ runto_main]} {
test_template_calls
}
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
gdb_test "p *u" {You can't do that without a process to debug.} "test crash"
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
do_typeid_tests 0
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}
}
gdb_test "break marker1" \
- "Breakpoint .*${srcfile}.*"
+ "Breakpoint .*${srcfile}.*"
gdb_test "cont" \
"Break.* marker1(\\(\\)|) \\(\\) at .*:$decimal.*" \
pass "re-selected 'main' frame after inferior call"
}
}
-
+
gdb_test "print one - two" "\\\$\[0-9\]* = {x = -2, y = -2}"
gdb_test "print one * two" "\\\$\[0-9\]* = {x = 8, y = 15}"
global gdb_prompt
global nl
- if [target_info exists gdb,cannot_call_functions] {
+ if {[target_info exists gdb,cannot_call_functions]} {
unsupported "this target can not call functions"
return 0
}
return -1
}
-if ![runto_main] {
+if {![runto_main]} {
return -1
}