aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2001-11-01 23:41:09 +0000
committerMichael Snyder <msnyder@vmware.com>2001-11-01 23:41:09 +0000
commitcbfa24cd20b2d5799582c0f952b7122018ffd915 (patch)
tree2fe61e0d8db17bfc198cfd2ec71a6a91886e1e86
parente90bf65af75dd2e610e09ab803a004509addd05c (diff)
downloadgdb-cbfa24cd20b2d5799582c0f952b7122018ffd915.zip
gdb-cbfa24cd20b2d5799582c0f952b7122018ffd915.tar.gz
gdb-cbfa24cd20b2d5799582c0f952b7122018ffd915.tar.bz2
2001-10-31 Michael Snyder <msnyder@redhat.com>
* gdb.c++/overload.exp: Select overloadfnarg(void) or overloadfnarg(), depending on what the symbol table contains. * gdb.c++/derivation.exp: Accept both "foo(void)" and "foo()" in the output of the ptype command. Similarly, accept both "const &" and "const&".
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.c++/derivation.exp20
-rw-r--r--gdb/testsuite/gdb.c++/overload.exp34
3 files changed, 44 insertions, 18 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d29216a..6f518e9 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2001-10-31 Michael Snyder <msnyder@redhat.com>
+
+ * gdb.c++/overload.exp: Select overloadfnarg(void) or overloadfnarg(),
+ depending on what the symbol table contains.
+ * gdb.c++/derivation.exp: Accept both "foo(void)" and "foo()" in
+ the output of the ptype command. Similarly, accept both "const &"
+ and "const&".
+
2001-10-31 Corinna Vinschen <vinschen@redhat.com>
* gdb.base/miscexprs.c (main): Add usage of preprocessor
diff --git a/gdb/testsuite/gdb.c++/derivation.exp b/gdb/testsuite/gdb.c++/derivation.exp
index 13501f2..beae325 100644
--- a/gdb/testsuite/gdb.c++/derivation.exp
+++ b/gdb/testsuite/gdb.c++/derivation.exp
@@ -90,8 +90,8 @@ gdb_expect {
send_gdb "ptype a_instance\n"
gdb_expect {
- -re "type = class A \{\r\n\[\t \]*public:\r\n\[\t \]*int a;\r\n\[\t \]*int aa;\[\r\n\t ]+A & operator=\\(A const &\\);\[\r\n\t ]+A\\(A const &\\);\[\r\n\t ]+A\\(void\\);\r\n\[\t \]*int afoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype a_instance (with synth ops)" }
- -re "type = class A \{\r\n\[\t \]*public:\r\n\[\t \]*int a;\r\n\[\t \]*int aa;\[\r\n\t \]+A\\(void\\);\r\n\[\t \]*int afoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype a_instance (no synth ops)" }
+ -re "type = class A \{\r\n\[\t \]*public:\r\n\[\t \]*int a;\r\n\[\t \]*int aa;\[\r\n\t ]+A & operator=\\(A const ?&\\);\[\r\n\t ]+A\\(A const ?&\\);\[\r\n\t ]+A\\(void\\);\r\n\[\t \]*int afoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype a_instance (with synth ops)" }
+ -re "type = class A \{\r\n\[\t \]*public:\r\n\[\t \]*int a;\r\n\[\t \]*int aa;\[\r\n\t \]+A\\(void\\);\r\n\[\t \]*int afoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype a_instance (no synth ops)" }
-re ".*$gdb_prompt $" { fail "ptype a_instance" }
timeout { fail "(timeout) ptype a_instance" }
}
@@ -112,15 +112,15 @@ gdb_expect {
if {$gcc_compiled} then {
send_gdb "ptype d_instance\n"
gdb_expect {
- -re "type = class D : private A, public B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t ]+D & operator=\\(D const &\\);\[\r\n\t ]+D\\(D const &\\);\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" }
- -re "type = class D : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" }
+ -re "type = class D : private A, public B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t ]+D & operator=\\(D const ?&\\);\[\r\n\t ]+D\\(D const ?&\\);\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" }
+ -re "type = class D : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" }
-re ".*$gdb_prompt $" { fail "ptype d_instance" }
timeout { fail "(timeout) ptype d_instance" }
}
} else {
send_gdb "ptype d_instance\n"
gdb_expect {
- -re "type = class D : private A, public B, protected C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" }
+ -re "type = class D : private A, public B, protected C \{\r\n\[\t \]*public:\r\n\[\t \]*int d;\r\n\[\t \]*int dd;\[\r\n\t \]+D\\(void\\);\r\n\[\t \]*int dfoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype d_instance" }
-re ".*$gdb_prompt $" { fail "ptype d_instance" }
timeout { fail "(timeout) ptype d_instance" }
}
@@ -142,15 +142,15 @@ gdb_expect {
if {$gcc_compiled} {
send_gdb "ptype e_instance\n"
gdb_expect {
- -re "type = class E : public A, private B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t ]+E & operator=\\(E const &\\);\[\r\n\t ]+E\\(E const &\\);\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" }
- -re "type = class E : public A, private B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" }
+ -re "type = class E : public A, private B, (protected|private) C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t ]+E & operator=\\(E const ?&\\);\[\r\n\t ]+E\\(E const ?&\\);\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" }
+ -re "type = class E : public A, private B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" }
-re ".*$gdb_prompt $" { fail "ptype e_instance" }
timeout { fail "(timeout) ptype e_instance" }
}
} else {
send_gdb "ptype e_instance\n"
gdb_expect {
- -re "type = class E : public A, private B, protected C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" }
+ -re "type = class E : public A, private B, protected C \{\r\n\[\t \]*public:\r\n\[\t \]*int e;\r\n\[\t \]*int ee;\[\r\n\t \]+E\\(void\\);\r\n\[\t \]*int efoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype e_instance" }
-re ".*$gdb_prompt $" { fail "ptype e_instance" }
timeout { fail "(timeout) ptype e_instance" }
}
@@ -171,8 +171,8 @@ gdb_expect {
send_gdb "ptype f_instance\n"
gdb_expect {
- -re "type = class F : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int f;\r\n\[\t \]*int ff;\[\r\n\t ]+F & operator=\\(F const &\\);\[\r\n\t ]+F\\(F const &\\);\[\r\n\t \]+F\\(void\\);\r\n\[\t \]*int ffoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype f_instance" }
- -re "type = class F : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int f;\r\n\[\t \]*int ff;\[\r\n\t \]+F\\(void\\);\r\n\[\t \]*int ffoo\\(void\\);\r\n\[\t \]*int foo\\(void\\);\r\n\}.*$gdb_prompt $" { pass "ptype f_instance" }
+ -re "type = class F : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int f;\r\n\[\t \]*int ff;\[\r\n\t ]+F & operator=\\(F const ?&\\);\[\r\n\t ]+F\\(F const ?&\\);\[\r\n\t \]+F\\(void\\);\r\n\[\t \]*int ffoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype f_instance" }
+ -re "type = class F : private A, public B, private C \{\r\n\[\t \]*public:\r\n\[\t \]*int f;\r\n\[\t \]*int ff;\[\r\n\t \]+F\\(void\\);\r\n\[\t \]*int ffoo\\((void|)\\);\r\n\[\t \]*int foo\\((void|)\\);\r\n\}.*$gdb_prompt $" { pass "ptype f_instance" }
-re ".*$gdb_prompt $" { fail "ptype f_instance" }
timeout { fail "(timeout) ptype f_instance" }
}
diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp
index afda692..d4d1269 100644
--- a/gdb/testsuite/gdb.c++/overload.exp
+++ b/gdb/testsuite/gdb.c++/overload.exp
@@ -391,22 +391,40 @@ gdb_expect {
# Now some tests to see if we can list overloaded functions properly:
-send_gdb "set listsize 1\n"
-gdb_expect -re ".*$gdb_prompt $"
+gdb_test "set listsize 1" "" ""
+# send_gdb "set listsize 1\n"
+# gdb_expect -re ".*$gdb_prompt $"
-gdb_test "list foo::overloadfnarg(void)"\
- ".*int foo::overloadfnarg.*\\(void\\).*" \
- "print overloaded function with no args"
+#
+# Decide whether to use "()" or "(void)"
+#
+
+send_gdb "info func overloadfnarg\n"
+gdb_expect {
+ -re ".*overloadfnarg\\(void\\).*$gdb_prompt $" {
+ gdb_test "list foo::overloadfnarg(void)"\
+ ".*int foo::overloadfnarg.*\\(void\\).*" \
+ "list overloaded function with no args"
+ }
+ -re ".*overloadfnarg\\(\\).*$gdb_prompt $" {
+ gdb_test "list foo::overloadfnarg()"\
+ ".*int foo::overloadfnarg.*\\(void\\).*" \
+ "list overloaded function with no args"
+ }
+ -re ".*$gdb_prompt $" {
+ fail "list overloaded function with no args (no matching symbol)"
+ }
+}
gdb_test "list foo::overloadfnarg(int)"\
"int foo::overloadfnarg.*\\(int arg\\).*" \
- "print overloaded function with int arg"
+ "list overloaded function with int arg"
gdb_test "list foo::overloadfnarg(int, int (*)(int))" \
"int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
- "print overloaded function with function ptr args"
+ "list overloaded function with function ptr args"
# This one crashes GDB. Don't know why yet.
gdb_test "list \"foo::overloadfnarg(int, int (*)(int))\"" \
"int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
- "print overloaded function with function ptr args - quotes around argument"
+ "list overloaded function with function ptr args - quotes around argument"