diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-09-22 03:28:34 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-09-22 03:28:34 +0000 |
commit | c2c6d25f0d5eea4f834420870021a8c52db24018 (patch) | |
tree | f4b3d5e9e3207fa8118db4085f9c6a0cbc2bdaf6 /gdb/testsuite/gdb.c++ | |
parent | 54af6ff67571ba569b94e26d558d02f9955e6844 (diff) | |
download | gdb-c2c6d25f0d5eea4f834420870021a8c52db24018.zip gdb-c2c6d25f0d5eea4f834420870021a8c52db24018.tar.gz gdb-c2c6d25f0d5eea4f834420870021a8c52db24018.tar.bz2 |
import gdb-1999-09-21
Diffstat (limited to 'gdb/testsuite/gdb.c++')
-rw-r--r-- | gdb/testsuite/gdb.c++/overload.cc | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.c++/overload.exp | 22 |
2 files changed, 32 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.c++/overload.cc b/gdb/testsuite/gdb.c++/overload.cc index 58d07de..97083c5 100644 --- a/gdb/testsuite/gdb.c++/overload.cc +++ b/gdb/testsuite/gdb.c++/overload.cc @@ -24,6 +24,10 @@ int overload1arg (unsigned long); int overload1arg (float); int overload1arg (double); +int overloadfnarg (void); +int overloadfnarg (int); +int overloadfnarg (int, int (*) (int)); + int overloadargs (int a1); int overloadargs (int a1, int a2); int overloadargs (int a1, int a2, int a3); @@ -94,6 +98,12 @@ 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;} +/* Test to see that we can explicitly request overloaded functions + with function pointers in the prototype. */ + +int foo::overloadfnarg (void) { return ifoo * 20; } +int foo::overloadfnarg (int arg) { arg = 0; return 13;} +int foo::overloadfnarg (int arg, int (*foo) (int)) { return foo(arg); } /* Some functions to test overloading by varying argument count. */ diff --git a/gdb/testsuite/gdb.c++/overload.exp b/gdb/testsuite/gdb.c++/overload.exp index fa12bff..e889273 100644 --- a/gdb/testsuite/gdb.c++/overload.exp +++ b/gdb/testsuite/gdb.c++/overload.exp @@ -397,3 +397,25 @@ gdb_expect { -re ".*$gdb_prompt $" { fail "print call overloaded func double arg" } timeout { fail "(timeout) print call overloaded func double arg" } } + +# 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 "list foo::overloadfnarg(void)"\ + ".*int foo::overloadfnarg.*\\(void\\).*" \ + "print overloaded function with no args" + +gdb_test "list foo::overloadfnarg(int)"\ + "int foo::overloadfnarg.*\\(int arg\\).*" \ + "print 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" + +# 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" |