aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Chastain <mec@google.com>2001-01-28 23:49:43 +0000
committerMichael Chastain <mec@google.com>2001-01-28 23:49:43 +0000
commitb2bbed47aadaf9c4901e87b2ecc56ac146a3b97b (patch)
treec91a37a2972914b618c926b485ad494614a9b822
parent80ee4fd53b910f425ecfa8a4f599025e00c2c608 (diff)
downloadgdb-b2bbed47aadaf9c4901e87b2ecc56ac146a3b97b.zip
gdb-b2bbed47aadaf9c4901e87b2ecc56ac146a3b97b.tar.gz
gdb-b2bbed47aadaf9c4901e87b2ecc56ac146a3b97b.tar.bz2
2001-01-28 Michael Chastain <chastain@redhat.com>
* gdb.c++/ovldbreak.exp (take_gdb_out_of_choice_menu): New proc to call when tests fail. It takes gdb out of the overloaded function choice menu back to the main prompt, so that the test program stays synchronized. (set_bp_overloaded): New proc to collect all the common code for setting a breakpoint on an overloaded name. Calls take_gdb_out_of_choice_menu when needed. (menu_overload1arg): New variable to collect the repeated instances of the expected menu for an overloaded name. Change the regular expression to handle changes in g++ type encoding: "void" can be either "void" or "", and "unsigned int" can be either "unsigned int" or "unsigned". (continue_to_bp_overloaded): Change regular expressions to handle changes in g++ type encoding. (no proc): Call take_gdb_out_of_choice_menu when needed. Remove redundant calls to "info break". Accept either "canceled" or "cancelled". Change regular expressions in "info break" calls to handle changes in g++ type encoding. Give all tests unique strings.
-rw-r--r--gdb/testsuite/gdb.c++/ovldbreak.exp622
1 files changed, 194 insertions, 428 deletions
diff --git a/gdb/testsuite/gdb.c++/ovldbreak.exp b/gdb/testsuite/gdb.c++/ovldbreak.exp
index 97271d3..7f5513b 100644
--- a/gdb/testsuite/gdb.c++/ovldbreak.exp
+++ b/gdb/testsuite/gdb.c++/ovldbreak.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2001 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
@@ -18,6 +18,7 @@
# bug-gdb@prep.ai.mit.edu
# written by Elena Zannoni (ezannoni@cygnus.com)
+# modified by Michael Chastain (chastain@redhat.com)
# This file is part of the gdb testsuite
#
@@ -60,375 +61,99 @@ if ![runto_main] then {
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "12\n"
- gdb_expect {
- -re "Breakpoint 2 at $hex: file.*$srcfile, line 111.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(char)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(char) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(char) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(char)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(char)(wrong menu)" }
- }
-
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111" \
- "breakpoint info"
-
-
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "11\n"
- gdb_expect {
- -re "Breakpoint 3 at $hex: file.*$srcfile, line 112.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(signed char)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(signed char) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(signed char) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(signed char)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(signed char)(wrong menu)" }
- }
-
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112" \
- "breakpoint info"
-
-
-
-
-
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "10\n"
- gdb_expect {
- -re "Breakpoint 4 at $hex: file.*$srcfile, line 113.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(unsigned char)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(unsigned char) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(unsigned char) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(unsigned char)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(unsigned char)(wrong menu)" }
- }
-
-
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113" \
- "breakpoint info"
-
-
-
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "9\n"
- gdb_expect {
- -re "Breakpoint 5 at $hex: file.*$srcfile, line 114.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(short)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(short) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(short) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(short)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(short)(wrong menu)" }
- }
-
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114" \
- "breakpoint info"
-
-
-
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "8\n"
- gdb_expect {
- -re "Breakpoint 6 at $hex: file.*$srcfile, line 115.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(unsigned short)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(unsigned short) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(unsigned short) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(unsigned short)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(unsigned short)(wrong menu)" }
- }
-
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115" \
- "breakpoint info"
-
-
-
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "7\n"
- gdb_expect {
- -re "Breakpoint 7 at $hex: file.*$srcfile, line 116.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(int)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(int) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(int) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(int)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(int)(wrong menu)" }
- }
-
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116" \
- "breakpoint info"
-
-
-
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "6\n"
- gdb_expect {
- -re "Breakpoint 8 at $hex: file.*$srcfile, line 117.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(unsigned int)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(unsigned int) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(unsigned int) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(unsigned int)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(unsigned int)(wrong menu)" }
- }
-
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117" \
- "breakpoint info"
-
-
-
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "5\n"
- gdb_expect {
- -re "Breakpoint 9 at $hex: file.*$srcfile, line 118.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(long)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(long) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(long) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(long)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(long)(wrong menu)" }
- }
-
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118" \
- "breakpoint info"
+# 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).
+#
+# This procedure issues a command that works at either the menu
+# prompt or the command prompt to get back to the command prompt.
+#
+# Note that an empty line won't do it (it means 'repeat the previous command'
+# at top level). A line with a single space in it works nicely.
+proc take_gdb_out_of_choice_menu {} {
+ global gdb_prompt
+ send_gdb " \n"
+ gdb_expect {
+ -re ".*$gdb_prompt $" {
+ }
+ timeout {
+ perror "could not resynchronize to command prompt (timeout)"
+ continue
+ }
+ }
+}
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "4\n"
- gdb_expect {
- -re "Breakpoint 10 at $hex: file.*$srcfile, line 119.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(unsigned long)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(unsigned long) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(unsigned long) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(unsigned long)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(unsigned long)(wrong menu)" }
- }
+# This procedure sets an overloaded breakpoint.
+# When I ask for such a breakpoint, gdb gives me a menu of 'cancel' 'all'
+# and a bunch of choices. I then choose from that menu by number.
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119" \
- "breakpoint info"
+proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} {
+ global gdb_prompt hex srcfile
+ # Get into the overload menu.
+ send_gdb "break $name\n"
+ gdb_expect {
+ -re "$expectedmenu" {
+ pass "bp menu for $name choice $mychoice"
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "3\n"
+ # Choose my choice.
+ send_gdb "$mychoice\n"
gdb_expect {
- -re "Breakpoint 11 at $hex: file.*$srcfile, line 120.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(float)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(float) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(float) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(float)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(float)(wrong menu)" }
- }
-
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120" \
- "breakpoint info"
+ -re "Breakpoint $bpnumber at $hex: file.*$srcfile, line $linenumber.\r\n$gdb_prompt $" {
+ pass "set bp $bpnumber on $name $mychoice line $linenumber"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "set bp $bpnumber on $name $mychoice line $linenumber (bad bp)"
+ }
+ timeout {
+ fail "set bp $bpnumber on $name $mychoice line $linenumber (timeout)"
+ take_gdb_out_of_choice_menu
+ }
+ }
+ }
+ -re ".*\r\n> " {
+ fail "bp menu for $name choice $mychoice (bad menu)"
+ take_gdb_out_of_choice_menu
+ }
+ -re ".*$gdb_prompt $" {
+ fail "bp menu for $name choice $mychoice (no menu)"
+ }
+ timeout {
+ fail "bp menu for $name choice $mychoice (timeout)"
+ take_gdb_out_of_choice_menu
+ }
+ }
+}
+# This is the expected menu for overload1arg.
+# Note the arg type variations on lines 6 and 13.
+# This accommodates different versions of g++.
+set menu_overload1arg "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n> $"
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "2\n"
- gdb_expect {
- -re "Breakpoint 12 at $hex: file.*$srcfile, line 121.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(double)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(double) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(double) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(double)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(double)(wrong menu)" }
- }
-gdb_test "info break" \
- "Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in main at.*$srcfile:49\r
-\[\t \]+breakpoint already hit 1 time\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(double\\) at.*$srcfile:121" \
- "breakpoint info"
+# Set breakpoints on foo::overload1arg, one by one.
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 12 2 111
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 11 3 112
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 10 4 113
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 9 5 114
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 8 6 115
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 7 7 116
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 6 8 117
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 5 9 118
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 4 10 119
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 3 11 120
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 2 12 121
+set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 13 13 110
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "13\n"
- gdb_expect {
- -re "Breakpoint 13 at $hex: file.*$srcfile, line 110.\r\n$gdb_prompt $" {
- pass "set bp on overload1arg(void)" }
- -re ".*$gdb_prompt $" {
- fail "set bp on overload1arg(void) wrong bp reply" }
- timeout {
- fail "(timeout)set bp on overload1arg(void) wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on overload1arg(void)(wrong menu)" }
- timeout { fail "(timeout)set bp on overload1arg(void)(wrong menu)" }
- }
+# Verify the breakpoints.
gdb_test "info break" \
"Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
@@ -440,36 +165,53 @@ gdb_test "info break" \
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(double\\) at.*$srcfile:121\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(void\\) at.*$srcfile:110" \
- "breakpoint info"
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \
+ "breakpoint info (after setting one-by-one)"
+# Test choice "cancel".
+# This is copy-and-paste from set_bp_overloaded.
send_gdb "break foo::overload1arg\n"
gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "0\n"
- gdb_expect {
- -re "canceled\r\n$gdb_prompt $" {
- pass "set bp canceled" }
- -re ".*$gdb_prompt $" {
- fail "set bp canceled wrong bp reply" }
- timeout {
- fail "(timeout)set bp canceled wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp canceled(wrong menu)" }
- timeout { fail "(timeout)set bp canceled(wrong menu)" }
- }
-
-
-
+ -re "$menu_overload1arg" {
+ pass "bp menu for foo::overload1arg choice cancel"
+ # Choose cancel.
+ send_gdb "0\n"
+ gdb_expect {
+ -re "canceled\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg canceled"
+ }
+ -re "cancelled\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg canceled"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg canceled (bad message)"
+ }
+ timeout {
+ fail "set bp on overload1arg canceled (timeout)"
+ take_gdb_out_of_choice_menu
+ }
+ }
+ }
+ -re ".*\r\n> " {
+ fail "bp menu for foo::overload1arg choice cancel (bad menu)"
+ take_gdb_out_of_choice_menu
+ }
+ -re ".*$gdb_prompt $" {
+ fail "bp menu for foo::overload1arg choice cancel (no menu)"
+ }
+ timeout {
+ fail "bp menu for foo::overload1arg choice cancel (timeout)"
+ take_gdb_out_of_choice_menu
+ }
+}
gdb_test "info break" \
"Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
@@ -481,61 +223,74 @@ gdb_test "info break" \
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(double\\) at.*$srcfile:121\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(void\\) at.*$srcfile:110" \
- "breakpoint info"
-
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \
+ "breakpoint info (after cancel)"
+# Delete these breakpoints.
send_gdb "delete breakpoints\n"
gdb_expect {
- -re "Delete all breakpoints.*$" {
+ -re "Delete all breakpoints.* $" {
send_gdb "y\n"
gdb_expect {
-re ".*$gdb_prompt $" {
- send_gdb "info breakpoints\n"
- gdb_expect {
- -re "No breakpoints or watchpoints..*$gdb_prompt $" {
- pass "Deleted all breakpoints"
- }
- -re ".*$gdb_prompt $" { fail "Deleted all breakpoints" }
- timeout { fail "Deleted all breakpoints (timeout)" }
- }
+ pass "delete all breakpoints"
+ }
+ timeout {
+ fail "delete all breakpoints (timeout)"
}
- timeout { fail "Deleted all breakpoints (timeout)" }
}
}
- -re ".*$gdb_prompt $" { fail "Deleted all breakpoints" }
- timeout { fail "Deleted all breakpoints (timeout)" }
+ timeout {
+ fail "delete all breakpoints (timeout)"
+ }
}
-
+gdb_test "info breakpoints" "No breakpoints or watchpoints." "breakpoint info (after delete)"
-send_gdb "break foo::overload1arg\n"
-gdb_expect {
--re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\(void\\) at.*$srcfile:110\r\n> $" {
- send_gdb "1\n"
- gdb_expect {
- -re "Breakpoint $decimal at $hex: file.*$srcfile, line 121.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 120.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 119.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 118.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 117.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 116.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 115.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 114.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 113.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 112.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 111.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 110.\r\nwarning: Multiple breakpoints were set.\r\nwarning: Use the .delete. command to delete unwanted breakpoints.\r\n$gdb_prompt $" {
- pass "set bp on all overload1arg()" }
- -re ".*$gdb_prompt $" {
- fail "set bp on all overload1arg() wrong bp reply" }
- timeout {
- fail "(timeout)set bp on all overload1arg() wrong bp reply" }
- }
- }
- -re ".*$gdb_prompt $" { fail "set bp on all overload1arg()(wrong menu)" }
- timeout { fail "(timeout)set bp on all overload1arg()(wrong menu)" }
- }
+# Test choice "all".
+# This is copy-and-paste from set_bp_overloaded.
+send_gdb "break foo::overload1arg\n"
+gdb_expect {
+ -re "$menu_overload1arg" {
+ pass "bp menu for foo::overload1arg choice all"
+ # Choose all.
+ send_gdb "1\n"
+ gdb_expect {
+ -re "Breakpoint $decimal at $hex: file.*$srcfile, line 121.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 120.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 119.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 118.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 117.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 116.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 115.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 114.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 113.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 112.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 111.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 110.\r\nwarning: Multiple breakpoints were set.\r\nwarning: Use the .delete. command to delete unwanted breakpoints.\r\n$gdb_prompt $" {
+ pass "set bp on overload1arg all"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "set bp on overload1arg all (bad message)"
+ }
+ timeout {
+ fail "set bp on overload1arg all (timeout)"
+ take_gdb_out_of_choice_menu
+ }
+ }
+ }
+ -re ".*\r\n> " {
+ fail "bp menu for foo::overload1arg choice all (bad menu)"
+ take_gdb_out_of_choice_menu
+ }
+ -re ".*$gdb_prompt $" {
+ fail "bp menu for foo::overload1arg choice all (no menu)"
+ }
+ timeout {
+ fail "bp menu for foo::overload1arg choice all (timeout)"
+ take_gdb_out_of_choice_menu
+ }
+}
gdb_test "info break" \
"Num Type\[\t \]+Disp Enb Address\[\t \]+What.*
@@ -543,41 +298,52 @@ gdb_test "info break" \
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(float\\) at.*$srcfile:120\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(long\\) at.*$srcfile:118\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned int\\) at.*$srcfile:117\r
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(int\\) at.*$srcfile:116\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(short\\) at.*$srcfile:114\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r
\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(char\\) at.*$srcfile:111\r
-\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\(void\\) at.*$srcfile:110" \
- "breakpoint info"
+\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \
+ "breakpoint info (after setting on all)"
+
-proc continue_to_bp_overloaded {n formals actuals} {
+# Run through each breakpoint.
+
+proc continue_to_bp_overloaded {bpnumber argtype actuals} {
global gdb_prompt hex decimal srcfile
- send_gdb "cont\n"
+
+ send_gdb "continue\n"
gdb_expect {
- -re "Continuing.\r\n\r\nBreakpoint $n, (${hex} in )?foo::overload1arg \\(this=${hex}(, )?${actuals}\\) at.*$srcfile:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${formals}\\).*\r\n$gdb_prompt $" {
- pass "continue to bp overloaded : ${formals}"
- }
- -re "$gdb_prompt $" { fail "continue to bp overloaded : ${formals}" }
- timeout { fail "(timeout) continue to bp overloaded : ${formals}" }
+ -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(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 ".*$gdb_prompt $" {
+ fail "continue to bp overloaded : ${argtype}"
+ }
+ timeout {
+ fail "continue to bp overloaded : ${argtype} (timeout)"
+ }
}
}
-continue_to_bp_overloaded 25 "void" ""
-continue_to_bp_overloaded 24 "char arg" "arg=2 \\'\\\\002\\'"
-continue_to_bp_overloaded 23 "signed char arg" "arg=3 \\'\\\\003\\'"
-continue_to_bp_overloaded 22 "unsigned char arg" "arg=4 \\'\\\\004\\'"
-continue_to_bp_overloaded 21 "short arg" "arg=5"
-continue_to_bp_overloaded 20 "unsigned short arg" "arg=6"
-continue_to_bp_overloaded 19 "int arg" "arg=7"
-continue_to_bp_overloaded 18 "unsigned int arg" "arg=8"
-continue_to_bp_overloaded 17 "long arg" "arg=9"
-continue_to_bp_overloaded 16 "unsigned long arg" "arg=10"
-continue_to_bp_overloaded 15 "float arg" "arg=100"
-continue_to_bp_overloaded 14 "double arg" "arg=200"
+continue_to_bp_overloaded 25 "(void|)" ""
+continue_to_bp_overloaded 24 "char" "arg=2 \\'\\\\002\\'"
+continue_to_bp_overloaded 23 "signed char" "arg=3 \\'\\\\003\\'"
+continue_to_bp_overloaded 22 "unsigned char" "arg=4 \\'\\\\004\\'"
+continue_to_bp_overloaded 21 "short" "arg=5"
+continue_to_bp_overloaded 20 "unsigned short" "arg=6"
+continue_to_bp_overloaded 19 "int" "arg=7"
+continue_to_bp_overloaded 18 "(unsigned|unsigned int)" "arg=8"
+continue_to_bp_overloaded 17 "long" "arg=9"
+continue_to_bp_overloaded 16 "unsigned long" "arg=10"
+continue_to_bp_overloaded 15 "float" "arg=100"
+continue_to_bp_overloaded 14 "double" "arg=200"
+
+
+# That's all, folks.
gdb_continue_to_end "finish program"