This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/commit/testsuite/cp] overload.exp


This is another gdb.cp/*.exp rewrite.

The hard part of this file is "ptype" on a monster class with
about 35 data fields and members.  The existing code just punted and
matched one little bit in the middle, but I match it all.

On top of the normal variation in output format, there are two different
bad outputs to catch.  One is an instance of "const char *" appearing as
"char *".  The other is more interesting: a destructor gets an argument,
like this: "~foo(int)".  David C already filed a PR for this so I
kfail'ed onto the existing PR.

I tested this on native i686-pc-linux-gnu with gcc 2.95.3, gcc 3.3.2,
gcc HEAD, and both dwarf-2 and stabs+.

I am committing this now.

Michael C

2004-01-01  Michael Chastain  <mec.gnu@mindspring.com>

	* gdb.cp/overload.exp: Rewrite.  Clean up patterns to match
	current versions of gcc, including gcc abi 2.  Remove gratuitous
	restart of test program.  Use gdb_test_multiple and gdb_test for
	all tests.  Add patterns to xfail missing "const" in "const char *"
	and kfail PR gdb/1155.

Index: overload.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/overload.exp,v
retrieving revision 1.1
diff -c -3 -p -r1.1 overload.exp
*** overload.exp	23 Aug 2003 03:55:59 -0000	1.1
--- overload.exp	1 Jan 2004 08:55:32 -0000
***************
*** 1,4 ****
! # Copyright 1998, 1999, 2000, 2001, 2002, 2003 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
--- 1,5 ----
! # Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
! # 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,37 ****
  # bug-gdb@prep.ai.mit.edu
  
  # written by Elena Zannoni (ezannoni@cygnus.com)
  
  # This file is part of the gdb testsuite
- #
- # tests for overloaded member functions. Command Line calls
- #
  
  
  if $tracelevel then {
!         strace $tracelevel
!         }
  
- #
- # test running programs
- #
  set prms_id 0
  set bug_id 0
  
--- 19,37 ----
  # bug-gdb@prep.ai.mit.edu
  
  # written by Elena Zannoni (ezannoni@cygnus.com)
+ # Rewritten by Michael Chastain <mec.gnu@mindspring.com>
  
  # This file is part of the gdb testsuite
  
+ # Tests for overloaded member functions.
  
  if $tracelevel then {
!     strace $tracelevel
! }
! 
! set ws "\[\r\n\t \]+"
! set nl "\[\r\n\]+"
  
  set prms_id 0
  set bug_id 0
  
*************** if  { [gdb_compile "${srcdir}/${subdir}/
*** 45,65 ****
       gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
  }
  
- if [get_compiler_info ${binfile} "c++"] {
-     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 {
!     perror "couldn't run to breakpoint"
!     continue
! }
  
  if ![runto 'marker1'] then {
      perror "couldn't run to marker1"
--- 45,56 ----
       gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
  }
  
  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 'marker1'] then {
      perror "couldn't run to marker1"
*************** if ![runto 'marker1'] then {
*** 68,130 ****
  
  gdb_test "up" ".*main.*" "up from marker1"
  
! send_gdb "print foo_instance1\n"
! gdb_expect {
!     -re ".\[0-9\]* = \{ifoo = 111, ccpfoo = 0x0\}\r\n$gdb_prompt $" {
!         pass "print foo_instance1"
!       }
!     -re ".*$gdb_prompt $" { fail "print foo_instance1" }
!     timeout           { fail "(timeout) print foo_instance1" }
!   }
! 
! 
! setup_xfail "hppa*-*-*" CLLbs16901
! send_gdb "ptype foo_instance1\n"
! gdb_expect {
!   -re "type = class foo \{.*public:.*int ifoo;.*const char \\*ccpfoo;.*foo\\(int\\);.*foo\\(int, (const char|char const) \\*\\);.*foo\\(foo &\\);.*~foo\\(void\\);.*void foofunc\\(int\\);.*void foofunc\\(int, signed char \\*\\);.*int overload1arg\\(void\\);.*int overload1arg\\(char\\);.*int overload1arg\\(signed char\\);.*int overload1arg\\(unsigned char\\);.*int overload1arg\\(short\\);.*int overload1arg\\(unsigned short\\);.*int overload1arg\\(int\\);.*int overload1arg\\(unsigned int\\);.*int overload1arg\\(long\\);.*int overload1arg\\(unsigned long\\);.*int overload1arg\\(float\\);.*int overload1arg\\(double\\);.*int overloadargs\\(int\\);.*int overloadargs\\(int, int\\);.*int overloadargs\\(int, int, int\\);.*int overloadargs\\(int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int\\);.*i
 nt overloadargs\\(int, int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int, int\\);.*int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);\r\n\}\r\n$gdb_prompt $" {
!         pass "ptype foo_instance1 (HP aCC -- known quirk with ~foo parameter list)"
!       }
!     -re "type = class foo .*int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);\r\n\}\r\n$gdb_prompt $" {
! 	pass "ptype foo_instance1 (shorter match)"
      }
!     -re ".*$gdb_prompt $" { fail "ptype foo_instance1" }
!     timeout           { fail "(timeout) ptype foo_instance1" }
!   }
! 
! send_gdb "print foo_instance2\n"
! gdb_expect {
!     -re ".\[0-9\]* = \{ifoo = 222, ccpfoo = $hex \"A\"\}\r\n$gdb_prompt $" {
!         pass "print foo_instance2"
!       }
!     -re ".*$gdb_prompt $" { fail "print foo_instance2" }
!     timeout           { fail "(timeout) print foo_instance2" }
!   }
! 
! send_gdb "print foo_instance3\n"
! gdb_expect {
!     -re ".\[0-9\]* = \{ifoo = 222, ccpfoo = $hex \"A\"\}\r\n$gdb_prompt $" {
!         pass "print foo_instance3"
!       }
!     -re ".*$gdb_prompt $" { fail "print foo_instance3" }
!     timeout           { fail "(timeout) print foo_instance3" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 1\r\n$gdb_prompt $" {
!         pass "print call overloaded func 1 arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 1 arg" }
!     timeout           { fail "(timeout) print call overloaded func 1 arg" }
!   }
  
  
  # If GDB fails to restore the selected frame properly after the
  # inferior function call above (see GDB PR 1155 for an explanation of
  # why this might happen), all the subsequent tests will fail.  We
  # should detect and report that failure, but let the marker call
  # finish so that the rest of the tests can run undisturbed.
  gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
      -re "#0  marker1.*$gdb_prompt $" {
          setup_kfail "gdb/1155" s390-*-linux-gnu
--- 59,146 ----
  
  gdb_test "up" ".*main.*" "up from marker1"
  
! # Print the monster class type.
! # See virtfunc.exp for a discussion of ptype.
! #
! # This is hairy to begin with.  It is even more hairy because of the
! # XX_* alternate patterns to catch the KFAIL and XFAIL cases.
! 
! set re_class	"((struct|class) foo \{${ws}public:|struct foo \{)"
! set re_fields	"int ifoo;${ws}const char ?\\* ?ccpfoo;"
! set XX_fields  	"int ifoo;${ws}char ?\\* ?ccpfoo;"
! set re_ctor	"foo\\(int\\);${ws}foo\\(int, (char const|const char) ?\\*\\);${ws}foo\\(foo ?&\\);"
! set re_dtor	"~foo\\((void|)\\);"
! set XX_dtor	"~foo\\(int\\);"
! set re_methods	                  "void foofunc\\(int\\);"
! set re_methods	"${re_methods}${ws}void foofunc\\(int, signed char ?\\*\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\((void|)\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(char\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(signed char\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(unsigned char\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(short\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(unsigned short\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(int\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(unsigned int\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(long\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(unsigned long\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(float\\);"
! set re_methods	"${re_methods}${ws}int overload1arg\\(double\\);"
! set re_methods	"${re_methods}${ws}int overloadfnarg\\((void|)\\);"
! set re_methods	"${re_methods}${ws}int overloadfnarg\\(int\\);"
! set re_methods	"${re_methods}${ws}int overloadfnarg\\(int, int ?\\(\\*\\) ?\\(int\\)\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int, int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int, int\\);"
! set re_methods	"${re_methods}${ws}int overloadargs\\(int, int, int, int, int, int, int, int, int, int, int\\);"
! set re_synth	"foo & operator=\\(foo const ?&\\);"
! set re_all_m	 	 "($re_ctor${ws}$re_dtor${ws}$re_methods"
! set re_all_m	"$re_all_m|$re_ctor${ws}$re_dtor${ws}$re_methods${ws}$re_synth"
! set re_all_m	"$re_all_m|$re_synth${ws}$re_ctor${ws}$re_dtor${ws}$re_methods"
! set re_all_m	"$re_all_m|$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods"
! set re_all_m	"$re_all_m)"
! set XX_all_m	"$re_ctor${ws}$XX_dtor${ws}$re_methods"
! 
! gdb_test_multiple "ptype foo_instance1" "ptype foo_instance1" {
!     -re "type = $re_class${ws}$re_fields${ws}$re_all_m$nl\}$nl$gdb_prompt $" {
! 	pass "ptype foo_instance1"
!     }
!     -re "type = $re_class${ws}$XX_fields${ws}$re_all_m$nl\}$nl$gdb_prompt $" {
! 	# gcc 2.95.3 -gstabs+, no "const" on "const char *"
! 	# TODO: gdb.base/constvar.exp has XFAILed this kind of problem for a
! 	# long time, but an XFAIL really needs an external bug report.
! 	# -- chastain 2003-12-31
! 	setup_xfail "*-*-*"
! 	fail "ptype foo_instance1"
!     }
!     -re "type = $re_class${ws}$re_fields${ws}$XX_all_m$nl\}$nl$gdb_prompt $" {
! 	# gcc 3.3.2 -gdwarf-2, "~foo(int)"
! 	kfail "gdb/1113" "ptype foo_instance1"
      }
! }
! 
! # Print variables and method calls.
! # This is a walk in the park.
! 
! gdb_test "print foo_instance1" "\\$\[0-9\]+ = \{ifoo = 111, ccpfoo = 0x0\}"
! gdb_test "print foo_instance2" "\\$\[0-9\]+ = \{ifoo = 222, ccpfoo = $hex \"A\"\}"
! gdb_test "print foo_instance3" "\\$\[0-9\]+ = \{ifoo = 222, ccpfoo = $hex \"A\"\}"
  
+ gdb_test "print foo_instance1.overloadargs(1)" "\\$\[0-9\]+ = 1" \
+     "print call overloaded func 1 arg"
  
  # If GDB fails to restore the selected frame properly after the
  # inferior function call above (see GDB PR 1155 for an explanation of
  # why this might happen), all the subsequent tests will fail.  We
  # should detect and report that failure, but let the marker call
  # finish so that the rest of the tests can run undisturbed.
+ 
  gdb_test_multiple "frame" "re-selected 'main' frame after inferior call" {
      -re "#0  marker1.*$gdb_prompt $" {
          setup_kfail "gdb/1155" s390-*-linux-gnu
*************** gdb_test_multiple "frame" "re-selected '
*** 137,390 ****
      }
  }
  
  
! send_gdb "print foo_instance1.overloadargs(1, 2)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 2\r\n$gdb_prompt $" {
!         pass "print call overloaded func 2 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 2 args" }
!     timeout           { fail "(timeout) print call overloaded func 2  args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 3\r\n$gdb_prompt $" {
!         pass "print call overloaded func 3 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 3 args" }
!     timeout           { fail "(timeout) print call overloaded func 3 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 4\r\n$gdb_prompt $" {
!         pass "print call overloaded func 4 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 4 args" }
!     timeout           { fail "(timeout) print call overloaded func 4 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 5\r\n$gdb_prompt $" {
!         pass "print call overloaded func 5 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 5 args" }
!     timeout           { fail "(timeout) print call overloaded func 5 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 6\r\n$gdb_prompt $" {
!         pass "print call overloaded func 6 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 6 args" }
!     timeout           { fail "(timeout) print call overloaded func 6 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 7\r\n$gdb_prompt $" {
!         pass "print call overloaded func 7 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 7 args" }
!     timeout           { fail "(timeout) print call overloaded func 7 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 8\r\n$gdb_prompt $" {
!         pass "print call overloaded func 8 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 8 args" }
!     timeout           { fail "(timeout) print call overloaded func 8 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 9\r\n$gdb_prompt $" {
!         pass "print call overloaded func 9 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 9 args" }
!     timeout           { fail "(timeout) print call overloaded func 9 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 10\r\n$gdb_prompt $" {
!         pass "print call overloaded func 10 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 10 args" }
!     timeout           { fail "(timeout) print call overloaded func 10 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 11\r\n$gdb_prompt $" {
!         pass "print call overloaded func 11 args"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func 11 args" }
!     timeout           { fail "(timeout) print call overloaded func 11 args" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg()\n"
! gdb_expect {
!     -re ".\[0-9\]* = 1\r\n$gdb_prompt $" {
!         pass "print call overloaded func void arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func void arg" }
!     timeout           { fail "(timeout) print call overloaded func void arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((char)arg2)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 2\r\n$gdb_prompt $" {
!         pass "print call overloaded func char arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func char arg" }
!     timeout           { fail "(timeout) print call overloaded func char arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((signed char)arg3)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 3\r\n$gdb_prompt $" {
!         pass "print call overloaded func signed char arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func signed char arg" }
!     timeout           { fail "(timeout) print call overloaded func signed char arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((unsigned char)arg4)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 4\r\n$gdb_prompt $" {
!         pass "print call overloaded func unsigned char arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned char arg" }
!     timeout           { fail "(timeout) print call overloaded func unsigned char arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((short)arg5)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 5\r\n$gdb_prompt $" {
!         pass "print call overloaded func short arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func short arg" }
!     timeout           { fail "(timeout) print call overloaded func short arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((unsigned short)arg6)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 6\r\n$gdb_prompt $" {
!         pass "print call overloaded func unsigned short arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned short  arg" }
!     timeout           { fail "(timeout) print call overloaded func unsigned short arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((int)arg7)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 7\r\n$gdb_prompt $" {
!         pass "print call overloaded func int arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func int arg" }
!     timeout           { fail "(timeout) print call overloaded func int arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((unsigned int)arg8)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 8\r\n$gdb_prompt $" {
!         pass "print call overloaded func unsigned int arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned int arg" }
!     timeout           { fail "(timeout) print call overloaded func unsigned int arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((long)arg9)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 9\r\n$gdb_prompt $" {
!         pass "print call overloaded func long arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func long arg" }
!     timeout           { fail "(timeout) print call overloaded func long arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((unsigned long)arg10)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 10\r\n$gdb_prompt $" {
!         pass "print call overloaded func unsigned long arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func unsigned long arg" }
!     timeout           { fail "(timeout) print call overloaded func unsigned long arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((float)arg11)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 11\r\n$gdb_prompt $" {
!         pass "print call overloaded func float arg"
!       }
!     -re ".*$gdb_prompt $" { fail "print call overloaded func float arg" }
!     timeout           { fail "(timeout) print call overloaded func float arg" }
!   }
! 
! 
! send_gdb "print foo_instance1.overload1arg((double)arg12)\n"
! gdb_expect {
!     -re ".\[0-9\]* = 12\r\n$gdb_prompt $" {
!         pass "print call overloaded func double arg"
!       }
!     -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:
  
! gdb_test "set listsize 1" "" ""
! # send_gdb "set listsize 1\n"
! # gdb_expect -re ".*$gdb_prompt $"
  
! #
! # 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\\).*" \
     "list overloaded function with int arg"
  
--- 153,270 ----
      }
  }
  
+ gdb_test "print foo_instance1.overloadargs(1, 2)" \
+     "\\$\[0-9\]+ = 2" \
+     "print call overloaded func 2 args"
  
! gdb_test "print foo_instance1.overloadargs(1, 2, 3)" \
!     "\\$\[0-9\]+ = 3" \
!     "print call overloaded func 3 args"
  
! gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4)" \
!     "\\$\[0-9\]+ = 4" \
!     "print call overloaded func 4 args"
  
! gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5)" \
!     "\\$\[0-9\]+ = 5" \
!     "print call overloaded func 5 args"
  
! gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6)" \
!     "\\$\[0-9\]+ = 6" \
!     "print call overloaded func 6 args"
! 
! gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7)" \
!     "\\$\[0-9\]+ = 7" \
!     "print call overloaded func 7 args"
  
! gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8)" \
!     "\\$\[0-9\]+ = 8" \
!     "print call overloaded func 8 args"
! 
! gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9)" \
!     "\\$\[0-9\]+ = 9" \
!     "print call overloaded func 9 args"
! 
! gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)" \
!     "\\$\[0-9\]+ = 10" \
!     "print call overloaded func 10 args"
! 
! gdb_test "print foo_instance1.overloadargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)" \
!     "\\$\[0-9\]+ = 11" \
!     "print call overloaded func 11 args"
! 
! gdb_test "print foo_instance1.overload1arg()" \
!     "\\$\[0-9\]+ = 1" \
!     "print call overloaded func void arg"
! 
! gdb_test "print foo_instance1.overload1arg((char)arg2)" \
!     "\\$\[0-9\]+ = 2" \
!     "print call overloaded func char arg"
! 
! gdb_test "print foo_instance1.overload1arg((signed char)arg3)" \
!     "\\$\[0-9\]+ = 3" \
!     "print call overloaded func signed char arg"
! 
! gdb_test "print foo_instance1.overload1arg((unsigned char)arg4)" \
!     "\\$\[0-9\]+ = 4" \
!     "print call overloaded func unsigned char arg"
! 
! gdb_test "print foo_instance1.overload1arg((short)arg5)" \
!     "\\$\[0-9\]+ = 5" \
!     "print call overloaded func short arg"
! 
! gdb_test "print foo_instance1.overload1arg((unsigned short)arg6)" \
!     "\\$\[0-9\]+ = 6" \
!     "print call overloaded func unsigned short arg"
! 
! gdb_test "print foo_instance1.overload1arg((int)arg7)" \
!     "\\$\[0-9\]+ = 7" \
!     "print call overloaded func int arg"
! 
! gdb_test "print foo_instance1.overload1arg((unsigned int)arg8)" \
!     "\\$\[0-9\]+ = 8" \
!     "print call overloaded func unsigned int arg"
! 
! gdb_test "print foo_instance1.overload1arg((long)arg9)" \
!     "\\$\[0-9\]+ = 9" \
!     "print call overloaded func long arg"
! 
! gdb_test "print foo_instance1.overload1arg((unsigned long)arg10)" \
!     "\\$\[0-9\]+ = 10" \
!     "print call overloaded func unsigned long arg"
! 
! gdb_test "print foo_instance1.overload1arg((float)arg11)" \
!     "\\$\[0-9\]+ = 11" \
!     "print call overloaded func float arg"
! 
! gdb_test "print foo_instance1.overload1arg((double)arg12)" \
!     "\\$\[0-9\]+ = 12" \
!     "print call overloaded func double arg"
! 
! # ---
! 
! # List overloaded functions.
! 
! # The void case is tricky because some compilers say "(void)"
! # and some compilers say "()".
! 
! gdb_test "set listsize 1" "" ""
! gdb_test_multiple "info func overloadfnarg" "list overloaded function with no args" {
      -re ".*overloadfnarg\\(void\\).*$gdb_prompt $" {
+ 	# gcc 2
  	gdb_test "list foo::overloadfnarg(void)"\
  		".*int foo::overloadfnarg.*\\(void\\).*" \
  		"list overloaded function with no args"
      }
      -re ".*overloadfnarg\\(\\).*$gdb_prompt $" {
+ 	# gcc 3
  	gdb_test "list foo::overloadfnarg()"\
  		".*int foo::overloadfnarg.*\\(void\\).*" \
  		"list overloaded function with no args"
      }
  }
  
! gdb_test "list foo::overloadfnarg(int)" \
      "int foo::overloadfnarg.*\\(int arg\\).*" \
     "list overloaded function with int arg"
  
*************** gdb_test "list foo::overloadfnarg(int, i
*** 392,400 ****
     "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
     "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\\)\\).*" \
     "list overloaded function with function ptr args - quotes around argument"
  
! gdb_test "print intToChar(1)" ".\[0-9\]* = 297"
--- 272,282 ----
     "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
     "list overloaded function with function ptr args"
  
  gdb_test "list \"foo::overloadfnarg(int, int (*)(int))\"" \
     "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \
     "list overloaded function with function ptr args - quotes around argument"
  
! # One last mysterious test.
! # I wonder what this is for?
! 
! gdb_test "print intToChar(1)" "\\$\[0-9\]+ = 297"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]