* gdb.c++/local.exp: Don't expect Local to be in scope in main;

it's local to foobar.  Check for it there, and check that it's not
present in main.
* gdb.c++/local.cc (marker2): New function.
(foobar): Call marker1.
(main): Call marker2 instead of marker1.
This commit is contained in:
Jim Blandy 2003-02-05 05:48:46 +00:00
parent 5d83691bdf
commit 6b5497864a
3 changed files with 47 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2003-02-05 Jim Blandy <jimb@redhat.com>
* gdb.c++/local.exp: Don't expect Local to be in scope in main;
it's local to foobar. Check for it there, and check that it's not
present in main.
* gdb.c++/local.cc (marker2): New function.
(foobar): Call marker1.
(main): Call marker2 instead of marker1.
2003-02-04 Andrew Cagney <ac131313@redhat.com>
* gdb.disasm/mn10200.exp: Obsolete file.

View File

@ -4,6 +4,9 @@ void marker1 (void)
{
}
void marker2 (void)
{
}
int foobar (int x)
{
@ -20,6 +23,8 @@ int foobar (int x)
static Local l1;
char c;
marker1 ();
l.loc1 = 23;
c = l.loc_foo('x');
@ -56,6 +61,6 @@ int main()
il.ilc = 'b';
il.ip = &c;
marker1();
marker2();
}
}

View File

@ -67,7 +67,7 @@ if ![runto 'marker1'] then {
continue
}
gdb_test "up" ".*main.*" "up from marker1"
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 ".".
@ -102,8 +102,7 @@ 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 $" {
# setup_kfail "gdb/483"
fail "ptype Local (gdb/483)"
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)" }
@ -111,6 +110,36 @@ gdb_expect {
timeout { fail "(timeout) ptype Local" }
}
gdb_test "break marker2"
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2.*" \
"continuing to marker2"
gdb_test "up" ".*main.*" "up from marker2"
# Make sure that `Local' isn't in scope here; it's local to foobar.
# setup_kfail "gdb/825"
send_gdb "ptype Local\n"
set eol "\[\t \]*\[\r\n\]+\[\t \]*"
gdb_expect {
-re "No symbol \"Local\" in current context.*${gdb_prompt} $" {
pass "Local out of scope"
}
-re "ptype Local${eol}type = class Local {${eol} public:${eol} int loc1;${eol}${eol} Local & operator=\\(Local const&\\);${eol} Local\\(Local const&\\);${eol} Local\\(\\);${eol} char loc_foo\\(char\\);${eol}}${eol}${gdb_prompt} " {
# GCC emits STABS debugging information in a way that doesn't
# properly preserve the scoping of local classes. I think
# we'd need to start using Sun's extensions to stabs to get
# this right.
kfail gdb/825 "Local out of scope"
}
-re ".*${gdb_prompt} $" {
fail "Local out of scope"
}
timeout {
fail "Local out of scope (timeout)"
}
}
# DTS CLLbs14316 and CLLbs17058
# coulter - I added a clause for HP's aCC compiler. We print out the type
# as xx instead of const unsigned char, but we still have an expected failure