aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
authorMichael Chastain <mec@google.com>2004-01-27 02:43:35 +0000
committerMichael Chastain <mec@google.com>2004-01-27 02:43:35 +0000
commit0a55bc2299dc92c910688e299c7cc2fd620274c4 (patch)
treecb4f872d926e4fc9471c650bc21a1fc62614d00d /gdb/testsuite/gdb.cp
parentc1321b30cfad7a5435684824d5d5bf80dfa616b5 (diff)
downloadgdb-0a55bc2299dc92c910688e299c7cc2fd620274c4.zip
gdb-0a55bc2299dc92c910688e299c7cc2fd620274c4.tar.gz
gdb-0a55bc2299dc92c910688e299c7cc2fd620274c4.tar.bz2
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.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/local.exp129
1 files changed, 90 insertions, 39 deletions
diff --git a/gdb/testsuite/gdb.cp/local.exp b/gdb/testsuite/gdb.cp/local.exp
index f4e8d22..8654674 100644
--- a/gdb/testsuite/gdb.cp/local.exp
+++ b/gdb/testsuite/gdb.cp/local.exp
@@ -73,53 +73,104 @@ if ![runto 'marker1'] then {
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"