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 ".".
+set sep "(\[.\]|___)\[0-9\]"
-# ---
-# Pattern 1:
-# PASS
-# dwarf-2
-# gcc 2.95.3
+# ptype on a local variable.
#
-# 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
+# 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.
#
-# Pattern 3:
-# PASS
-# stabs+
-# gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD
+# 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.
#
-# Pattern 4:
-# This an old pattern from the hppa aCC version of this file.
-# I left it alone.
+# 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 2002-04-08
+# -- chastain 2004-01-24
-# pattern #5
-# PASS
-# stabs+
-# gcc HEAD abi-2
-#
-# chastain 2004-01-02
+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 sep "(\[.\]|___)\[0-9\]"
+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"
-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" }
+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"