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/testsuite/cp] local.exp: add "ptype l"


This patch updates the "ptype Local" test in gdb.cp/local.exp.
This versions keeps "ptype Local" and adds "ptype l".

Tested on:

  gdb 6.0, gdb HEAD
  gcc 2.95.3, gcc 3.3.2, gcc HEAD
  gdwarf-2, -gstabs+

I'll give this another 24 hours for comments and then commit it.

Michael C

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

	* gdb.cp/local.exp: Rewrite "ptype Local".  Add "ptype l".
	Provide arms for current output in all my configurations.

Index: local.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/local.exp,v
retrieving revision 1.3
diff -c -3 -p -r1.3 local.exp
*** local.exp	19 Jan 2004 04:06:42 -0000	1.3
--- local.exp	24 Jan 2004 23:00:31 -0000
*************** if ![runto 'marker1'] then {
*** 73,125 ****
  
  gdb_test "up" ".*foobar.*" "up from marker1"
  
! # Local classes in g++ get names like "main.1::InnerLocal", just like local
! # static variables.  Some targets use "___" instead of ".".
  
! # ---
! # Pattern 1:
! # PASS
! #   dwarf-2
! #     gcc 2.95.3
  #
! # Pattern 2:
! # FAIL
! # This has a duplicate "char loc_foo" line.  This is a bug.
! # Historically this has been an XFAIL.
! #   dwarf-2
! #     gcc 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
  #
! # Pattern 3:
! # PASS
! #   stabs+
! #     gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
  #
! # Pattern 4:
! # This an old pattern from the hppa aCC version of this file.
! # I left it alone.
  #
! # chastain 2002-04-08
  
! # pattern #5
! # PASS
! #   stabs+
! #     gcc HEAD abi-2
! #
! # chastain 2004-01-02
  
! set sep "(\[.\]|___)\[0-9\]"
  
! send_gdb "ptype Local\n"
! gdb_expect {
!   -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" }
!   -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" {
!     kfail "gdb/483" "ptype Local"
!   }
!   -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*Local & operator *=\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((void|)\\);\[\r\n\t \]*char loc_foo\\(char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" }
!   -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\)\r\n\}.*$gdb_prompt $" { xpass "ptype Local (old aCC)" }
!   -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\(char\\);\[\r\n\t \]*Local & operator *=\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((void|)\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" }
!   -re ".*$gdb_prompt $"   {  fail "ptype Local" }
!   timeout             { fail "(timeout) ptype Local" }
  }
  
  gdb_test "break marker2"
--- 73,176 ----
  
  gdb_test "up" ".*foobar.*" "up from marker1"
  
! set sep "(\[.\]|___)\[0-9\]"
  
! # ptype on a local variable.
  #
! # This test has six arms.  The first three arms accept normal output:
! # no synthetic methods; synthetic methods before user methods;
! # synthetic methods after user methods.
  #
! # The next two arms accept "foobar__Fi.0::Local" instead of "Local".
! # This is a bug.  It happens in various places with various versions of
! # gcc and gdb and various debugging types.
  #
! # The last arm accepts the user methods in duplicate.  This bug happens
! # with gcc 3.3.2 -gdwarf-2, and has been fixed in gcc HEAD 2004-01-22.
  #
! # -- chastain 2004-01-24
  
! set re_class		"((struct|class) Local \{${ws}public:|struct Local \{)"
! set re_fields		"int loc1;"
! set re_methods		"char loc_foo\\(char\\);"
! set re_synth_gcc_23	"Local & operator=\\(Local const ?&\\);${ws}Local\\(Local const ?&\\);${ws}Local\\((void|)\\);"
  
! set XX_class		"((struct|class) foobar__Fi.0::Local \{${ws}public:|struct foobar__Fi.0:Local \{)"
! set XX_synth_gcc_2	"Local & operator=\\(foobar__Fi.0::Local const ?&\\);${ws}Local\\(foobar__Fi.0::Local const ?&\\);${ws}Local\\((void|)\\);"
! set YY_methods		"$re_methods${ws}$re_methods"
! 
! set name "ptype l"
! gdb_test_multiple "ptype l" $name {
!     -re "type = $re_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc 2.95.3, dwarf-2
! 	# gdb 6.0, gcc HEAD 2004-01-22, dwarf-2
! 	# gdb HEAD 2004-01-23, gcc HEAD 2004-01,22, dwarf-2
! 	pass "$name"
!     }
!     -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23${ws}$re_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc 3.3.2, stabs+
! 	# gdb HEAD 2004-01-23, gcc 3.3.2, stabs+
! 	pass "$name"
!     }
!     -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23${ws}$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc HEAD 2004-01-22, stabs+
! 	# gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, stabs+
! 	pass "$name"
!     }
!     -re "type = $XX_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb HEAD 2004-01-23, gcc 2.95.3, dwarf-2
! 	kfail "gdb/1516" "$name"
!     }
!     -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}($re_synth_gcc_23|$XX_synth_gcc_2)${ws}$re_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc 2.95.3, stabs+
! 	# gdb HEAD 2004-01-23, gcc 2.95.3, stabs+
! 	kfail "gdb/1516" "$name"
!     }
!     -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}$YY_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc 3.3.2, dwarf-2
! 	# gdb HEAD 2004-01-23, gcc 3.2.2, dwarf-2
! 	kfail "gdb/483" "$name"
!     }
! }
! 
! # This is the same test with "ptype Local" (the type name)
! # instead of "ptype l" (the variable name).
  
! set name "ptype Local"
! gdb_test_multiple "ptype Local" $name {
!     -re "type = $re_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc 2.95.3, dwarf-2
! 	# gdb 6.0, gcc HEAD 2004-01-22, dwarf-2
! 	# gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, dwarf-2
! 	pass "$name"
!     }
!     -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23${ws}$re_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc 3.3.2, stabs+
! 	# gdb HEAD 2004-01-23, gcc 3.3.2, stabs+
! 	pass "$name"
!     }
!     -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23${ws}$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc HEAD 2004-01-22, stabs+
! 	# gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, stabs+
! 	pass "$name"
!     }
!     -re "type = $XX_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" {
! 	kfail "gdb/1516" "$name"
!     }
!     -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}($re_synth_gcc_23|$XX_synth_gcc_2)${ws}$re_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc 2.95.3, stabs+
! 	# gdb HEAD 2004-01-23, gcc 2.95.3, stabs+
! 	kfail "gdb/1516" "$name"
!     }
!     -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}$YY_methods$nl\}$nl$gdb_prompt $" {
! 	# gdb 6.0, gcc 3.3.2, dwarf-2
! 	# gdb HEAD 2004-01-23, gcc 3.2.2, dwarf-2
! 	kfail "gdb/483" "$name"
!     }
!     -re "No symbol \"Local\" in current context.$nl$gdb_prompt $" {
! 	# gdb HEAD 2004-01-23, gcc 2.95.3, dwarf-2
! 	fail "$name"
!     }
  }
  
  gdb_test "break marker2"


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