aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2012-03-01 20:34:13 +0000
committerKeith Seitz <keiths@redhat.com>2012-03-01 20:34:13 +0000
commitd3dc44a619a1f52ace35f3cccb16b6096e13b5da (patch)
tree01a8715e9a9b305c41ca2371174cbbbfa1c862dc /gdb/testsuite/gdb.cp
parente0a4d1083e0845e8e402b75b32b0e81b1a3f4e10 (diff)
downloadgdb-d3dc44a619a1f52ace35f3cccb16b6096e13b5da.zip
gdb-d3dc44a619a1f52ace35f3cccb16b6096e13b5da.tar.gz
gdb-d3dc44a619a1f52ace35f3cccb16b6096e13b5da.tar.bz2
* gdb.cp/method2.exp: Output of overload menu is now
alphabetized. Update tests for "break A::method". * gdb.cp/ovldbreak.exp: Use gdb_get_line_number instead of hard-coding them. Overload menu is alphabetized: rewrite to accommodate. Unset variables LINE and TYPES which are used in other tests. Compute the output of "info break". Update the breakpoint table after all breakpoints are deleted. (continue_to_bp_overloaded): Rename ACTUALS to ARGUMENT and compute ACTUALS and the method body based on parameters. Update expected output accordingly. * gdb.cp/ovldbreak.cc (foo::overload1arg): Reformat and add unique comments to allow the use of gdb_get_line_number. * gdb.cp/method2.exp: Use prepare_for_testing and cleanup some Tcl syntax. * gdb.cp/ovldbreak.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/method2.exp32
-rw-r--r--gdb/testsuite/gdb.cp/ovldbreak.cc47
-rw-r--r--gdb/testsuite/gdb.cp/ovldbreak.exp295
3 files changed, 217 insertions, 157 deletions
diff --git a/gdb/testsuite/gdb.cp/method2.exp b/gdb/testsuite/gdb.cp/method2.exp
index f44381f..2aa035e 100644
--- a/gdb/testsuite/gdb.cp/method2.exp
+++ b/gdb/testsuite/gdb.cp/method2.exp
@@ -21,24 +21,15 @@
if { [skip_cplus_tests] } { continue }
set testfile "method2"
-set srcfile ${testfile}.cc
-set binfile ${objdir}/${subdir}/${testfile}
+set srcfile $testfile.cc
+set binfile $objdir/$subdir/$testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
untested method2.exp
return -1
}
-if [get_compiler_info $binfile "c++"] {
- return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
-if ![runto_main] then {
+if {![runto_main]} {
perror "couldn't run to breakpoint"
continue
}
@@ -50,8 +41,21 @@ proc test_break { lang } {
"" \
"setting language $lang"
+ # Menu items should be alphabetical
+ set ovlds [lsort {"" "int" "A*"}]
+ set items {"cancel" "all"}
+ foreach ovld $ovlds {
+ lappend items "A::method($ovld)"
+ }
+ set menu_items {}
+ set idx 0
+ foreach item $items {
+ lappend menu_items ".$idx. .*[string_to_regexp $item]"
+ incr idx
+ }
+ set expect [join $menu_items {.*[\r\n]*}]
gdb_test_multiple "break A::method" "breaking in method ($lang)" {
- -re ".0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. .*:A::method\\(A\\*\\)\[\r\n\]*.3. .*:A::method\\(int\\)\[\r\n\]*.4. .*:A::method\\(\\)\[\r\n\]*> $" {
+ -re $expect {
gdb_test "0" \
"canceled" \
"breaking in method ($lang)"
diff --git a/gdb/testsuite/gdb.cp/ovldbreak.cc b/gdb/testsuite/gdb.cp/ovldbreak.cc
index 832b0fa..c3cc069 100644
--- a/gdb/testsuite/gdb.cp/ovldbreak.cc
+++ b/gdb/testsuite/gdb.cp/ovldbreak.cc
@@ -103,18 +103,41 @@ foo::~foo () {}
/* Some functions to test overloading by varying one argument type. */
-int foo::overload1arg (void) { return 1; }
-int foo::overload1arg (char arg) { arg = 0; return 2;}
-int foo::overload1arg (signed char arg) { arg = 0; return 3;}
-int foo::overload1arg (unsigned char arg) { arg = 0; return 4;}
-int foo::overload1arg (short arg) { arg = 0; return 5;}
-int foo::overload1arg (unsigned short arg) { arg = 0; return 6;}
-int foo::overload1arg (int arg) { arg = 0; return 7;}
-int foo::overload1arg (unsigned int arg) { arg = 0; return 8;}
-int foo::overload1arg (long arg) { arg = 0; return 9;}
-int foo::overload1arg (unsigned long arg) { arg = 0; return 10;}
-int foo::overload1arg (float arg) { arg = 0; return 11;}
-int foo::overload1arg (double arg) { arg = 0; return 12;}
+int foo::overload1arg (void)
+{ return 1; } /* fo1 void */
+
+int foo::overload1arg (char arg)
+{ arg = 0; return 2; } /* fo1 char */
+
+int foo::overload1arg (signed char arg)
+{ arg = 0; return 3; } /* fo1 signed_char */
+
+int foo::overload1arg (unsigned char arg)
+{ arg = 0; return 4; } /* fo1 unsigned_char */
+
+int foo::overload1arg (short arg)
+{ arg = 0; return 5; } /* fo1 short_int */
+
+int foo::overload1arg (unsigned short arg)
+{ arg = 0; return 6; } /* fo1 unsigned_short_int */
+
+int foo::overload1arg (int arg)
+{ arg = 0; return 7; } /* fo1 int */
+
+int foo::overload1arg (unsigned int arg)
+{ arg = 0; return 8; } /* fo1 unsigned_int */
+
+int foo::overload1arg (long arg)
+{ arg = 0; return 9; } /* fo1 long_int */
+
+int foo::overload1arg (unsigned long arg)
+{ arg = 0; return 10; } /* fo1 unsigned_long_int */
+
+int foo::overload1arg (float arg)
+{ arg = 0; return 11; } /* fo1 float */
+
+int foo::overload1arg (double arg)
+{ arg = 0; return 12; } /* fo1 double */
/* Some functions to test overloading by varying argument count. */
diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp
index b719224..3e35b79 100644
--- a/gdb/testsuite/gdb.cp/ovldbreak.exp
+++ b/gdb/testsuite/gdb.cp/ovldbreak.exp
@@ -32,28 +32,21 @@ set timeout 15
if { [skip_cplus_tests] } { continue }
set testfile "ovldbreak"
-set srcfile ${testfile}.cc
-set binfile ${objdir}/${subdir}/${testfile}
+set srcfile $testfile.cc
+set binfile $objdir/$subdir/$testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
- untested ovldbreak.exp
- return -1
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
+ untested ovldbreak.exp
+ return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# set it up at a breakpoint so we can play with the variable values
#
-if ![runto_main] then {
+if {![runto_main]} {
perror "couldn't run to breakpoint"
continue
}
-
-
# When I ask gdb to set a breakpoint on an overloaded function,
# gdb gives me a choice menu. I might get stuck in that choice menu
# (for example, if C++ name mangling is not working properly).
@@ -120,68 +113,113 @@ proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} {
}
}
-# This is the expected menu for overload1arg.
+# Compute the expected menu for overload1arg.
# Note the arg type variations for void and integer types.
# This accommodates different versions of g++.
-set menu_overload1arg "\\\[0\\\] cancel\r\n"
-append menu_overload1arg "\\\[1\\\] all\r\n"
-append menu_overload1arg "\\\[2\\\] .*$srcfile:foo::overload1arg\\(double\\)\r\n"
-append menu_overload1arg "\\\[3\\\] .*$srcfile:foo::overload1arg\\(float\\)\r\n"
-append menu_overload1arg "\\\[4\\\] .*$srcfile:foo::overload1arg\\((unsigned long|long unsigned)( int)?\\)\r\n"
-append menu_overload1arg "\\\[5\\\] .*$srcfile:foo::overload1arg\\(long( int)?\\)\r\n"
-append menu_overload1arg "\\\[6\\\] .*$srcfile:foo::overload1arg\\((unsigned int|unsigned)\\)\r\n"
-append menu_overload1arg "\\\[7\\\] .*$srcfile:foo::overload1arg\\(int\\)\r\n"
-append menu_overload1arg "\\\[8\\\] .*$srcfile:foo::overload1arg\\((unsigned short|short unsigned)( int)?\\)\r\n"
-append menu_overload1arg "\\\[9\\\] .*$srcfile:foo::overload1arg\\(short( int)?\\)\r\n"
-append menu_overload1arg "\\\[10\\\] .*$srcfile:foo::overload1arg\\(unsigned char\\)\r\n"
-append menu_overload1arg "\\\[11\\\] .*$srcfile:foo::overload1arg\\(signed char\\)\r\n"
-append menu_overload1arg "\\\[12\\\] .*$srcfile:foo::overload1arg\\(char\\)\r\n"
-append menu_overload1arg "\\\[13\\\] .*$srcfile:foo::overload1arg\\((void|)\\)\r\n"
-append menu_overload1arg "> $"
+# Probe for the real types. This will do some unnecessary checking
+# for some simple types (like "int"), but it's just easier to loop
+# over all_types instead of calling out just the exceptions.
+# This list /must/ remain in the same order that the methods are
+# called in the source code. Otherwise the order in which breakpoints
+# are hit (tested below) will be incorrect.
+set all_types [list void char signed_char unsigned_char short_int \
+ unsigned_short_int int unsigned_int long_int \
+ unsigned_long_int float double]
+
+# ARGUMENTS is an array that will map from synthetic type to argument
+# expressions in the source code, which is of the form "arg = $decimal".
+# ARGUMENTS stores this decimal number.
+array set arguments {
+ void ""
+ char 2
+ signed_char 3
+ unsigned_char 4
+ short_int 5
+ unsigned_short_int 6
+ int 7
+ unsigned_int 8
+ long_int 9
+ unsigned_long_int 10
+ float 100(.0)?
+ double 200(.0)?
+}
+
+unset -nocomplain line types
+foreach type $all_types {
+ # TYPES is an array that maps the synthetic names in ALL_TYPES
+ # to the real type used in the debugger. These will be checked
+ # below and changed if the debugger thinks they are different from
+ # their default values.
+ set types($type) [join [split $type "_"] " "]
+
+ # LINE is an array that will map from synthetic type to line number.
+ # in the source code.
+ set line($type) [gdb_get_line_number "fo1 $type"]
+
+ # Probe for the actual type.
+ gdb_test_multiple "print &foo::overload1arg($types($type))" \
+ "probe $types($type)" {
+ -re ".*\<foo::.*\>.*$gdb_prompt $" {
+ regexp {<.*>} $expect_out(0,string) func
+ regexp {\(.*\)} $func real_type
+
+ # Store the real type into TYPES.
+ set types($type) [string trim $real_type {()}]
+
+ # Create an inverse mapping of the actual type to
+ # the synthetic type.
+ set type_map("$types($type)") $type
+ pass "detect $type"
+ }
+ }
+}
+
+# This is a list of the actual overloaded method arguments.
+set overloads {}
+foreach type $all_types {
+ lappend overloads $types($type)
+}
+
+# Sort this list alphabetically.
+set overloads [lsort $overloads]
+
+# Create the menu list.
+set items {"cancel" "all"}
+foreach ovld $overloads {
+ lappend items "$srcfile:foo::overload1arg\\($ovld\\)"
+}
+set menu_items {}
+set idx 0
+foreach item $items {
+ lappend menu_items ".$idx. .*$item"
+ incr idx
+}
+set menu_overload1arg [join $menu_items {[\r\n]*}]
+append menu_overload1arg {[\r\n]*> $}
# Set multiple-symbols to "ask", to allow us to test the use
# of the multiple-choice menu when breaking on an overloaded method.
gdb_test_no_output "set multiple-symbols ask"
# Set breakpoints on foo::overload1arg, one by one.
-
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 12 2 107
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 11 3 108
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 10 4 109
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 9 5 110
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 8 6 111
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 7 7 112
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 6 8 113
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 5 9 114
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 4 10 115
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 3 11 116
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 2 12 117
-set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 13 13 106
-
-
+set bpnum 1
+set method "foo::overload1arg"
+for {set idx 0} {$idx < [llength $overloads]} {incr idx} {
+ set type [lindex $overloads $idx]
+ set_bp_overloaded $method $menu_overload1arg \
+ [expr {$idx + 2}] [incr bpnum] $line($type_map("$type"))
+}
# Verify the breakpoints.
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:107\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:108\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:109\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:110\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:117\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:106" \
- "breakpoint info (after setting one-by-one)"
-
-
+set bptable "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*"
+append bptable "\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\[\r\n\]+"
+append bptable "\[\t \]+breakpoint already hit 1 time\[\r\n\]+"
+foreach ovld $overloads {
+ append bptable [format "\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(%s\\) at.*$srcfile:%d\[\r\n\]+" $ovld \
+ $line($type_map("$ovld"))]
+}
+gdb_test "info break" $bptable "breakpoint info (after setting one-by-one)"
# Test choice "cancel".
# This is copy-and-paste from set_bp_overloaded.
@@ -221,25 +259,7 @@ gdb_expect {
}
}
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:107\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:108\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:109\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:110\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:117\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:106" \
- "breakpoint info (after cancel)"
-
-
+gdb_test "info break" $bptable "breakpoint info (after cancel)"
# Delete these breakpoints.
@@ -303,64 +323,76 @@ gdb_expect {
gdb_test "info break" \
"Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+<MULTIPLE>\[\t \]*\r
-\[0-9\]+.1\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:117\r
-\[0-9\]+.2\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:116\r
-\[0-9\]+.3\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:115\r
-\[0-9\]+.4\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:114\r
-\[0-9\]+.5\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:113\r
-\[0-9\]+.6\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:112\r
-\[0-9\]+.7\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:111\r
-\[0-9\]+.8\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:110\r
-\[0-9\]+.9\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:109\r
-\[0-9\]+.10\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:108\r
-\[0-9\]+.11\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:107\r
-\[0-9\]+.12\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:106" \
+\[0-9\]+.1\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:140\r
+\[0-9\]+.2\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:137\r
+\[0-9\]+.3\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:134\r
+\[0-9\]+.4\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:131\r
+\[0-9\]+.5\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:128\r
+\[0-9\]+.6\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:125\r
+\[0-9\]+.7\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:122\r
+\[0-9\]+.8\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:119\r
+\[0-9\]+.9\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:116\r
+\[0-9\]+.10\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:113\r
+\[0-9\]+.11\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:110\r
+\[0-9\]+.12\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:107" \
"breakpoint info (after setting on all)"
-
# Run through each breakpoint.
+proc continue_to_bp_overloaded {bpnumber might_fail line argtype argument} {
+ global gdb_prompt hex decimal srcfile
+
+ if {$argument == ""} {
+ set actuals ""
+ } else {
+ set actuals "arg=$argument"
+ if {[regexp {char} $argtype]} {
+ append actuals " \\'\\\\00$argument\\'"
+ }
+ }
-# NOTE: carlton/2003-02-03: I'm seeing failures on some of the tests,
-# with the wrong arg being printed out. Michael Chastain sees
-# failures at times, too, albeit fewer than I do.
+ if {[string match $argtype "void"]} {
+ set body "return $decimal;"
+ } else {
+ set body "arg = 0; return $decimal;"
+ }
-proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} {
- global gdb_prompt hex decimal srcfile
+ gdb_test_multiple "continue" "continue to bp overloaded : $argtype" {
+ -re "Continuing.\r\n\r\nBreakpoint $bpnumber, foo::overload1arg \\(this=${hex}(, )?$actuals\\) at .*$srcfile:$line\r\n$decimal\[\t \]+{ $body }.*$gdb_prompt $" {
+ pass "continue to bp overloaded : $argtype"
+ }
- send_gdb "continue\n"
- gdb_expect {
- -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, foo::overload1arg \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
- pass "continue to bp overloaded : ${argtype}"
- }
- -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, foo::overload1arg \\(this=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
- if $might_kfail {
- kfail "gdb/1025" "continue to bp overloaded : ${argtype}"
- } else {
- fail "continue to bp overloaded : ${argtype}"
- }
- }
- -re ".*$gdb_prompt $" {
- fail "continue to bp overloaded : ${argtype}"
- }
- timeout {
- fail "continue to bp overloaded : ${argtype} (timeout)"
- }
+ -re "Continuing.\r\n\r\nBreakpoint $bpnumber, foo::overload1arg \\(this=${hex}, arg=.*\\) at .*$srcfile:$line\r\n$decimal\[\t \]+{ $body }.*$gdb_prompt $" {
+ if $might_kfail {
+ kfail "c++/8130" "continue to bp overloaded : $argtype"
+ } else {
+ fail "continue to bp overloaded : $argtype"
+ }
+ }
}
}
-continue_to_bp_overloaded 0 14 "(void|)" ""
-continue_to_bp_overloaded 1 14 "char" "arg=2 \\'\\\\002\\'"
-continue_to_bp_overloaded 1 14 "signed char" "arg=3 \\'\\\\003\\'"
-continue_to_bp_overloaded 1 14 "unsigned char" "arg=4 \\'\\\\004\\'"
-continue_to_bp_overloaded 1 14 "short" "arg=5"
-continue_to_bp_overloaded 1 14 "unsigned short" "arg=6"
-continue_to_bp_overloaded 0 14 "int" "arg=7"
-continue_to_bp_overloaded 0 14 "(unsigned|unsigned int)" "arg=8"
-continue_to_bp_overloaded 0 14 "long" "arg=9"
-continue_to_bp_overloaded 0 14 "unsigned long" "arg=10"
-continue_to_bp_overloaded 0 14 "float" "arg=100"
-continue_to_bp_overloaded 1 14 "double" "arg=200"
+# An array which describes which of these methods might be expected
+# to kfail on GCC 2.95. See C++/8210.
+array set might_fail {
+ void 0
+ char 1
+ signed_char 1
+ unsigned_char 1
+ short_int 1
+ unsigned_short_int 1
+ int 0
+ unsigned_int 0
+ long_int 0
+ unsigned_long_int 0
+ float 0
+ double 1
+}
+
+foreach type $all_types {
+ continue_to_bp_overloaded 14 $might_fail($type) $line($type) \
+ $type $arguments($type)
+}
# Test breaking on an overloaded function when multiple-symbols
# is set to "cancel"
@@ -376,4 +408,5 @@ gdb_test "break foo::foofunc" \
# That's all, folks.
+unset -nocomplain line types
gdb_continue_to_end "finish program"