This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug c++/15203] New: GDB can't find static variable declared locally
- From: "sergiodj at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 27 Feb 2013 01:01:49 +0000
- Subject: [Bug c++/15203] New: GDB can't find static variable declared locally
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=15203
Bug #: 15203
Summary: GDB can't find static variable declared locally
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned@sourceware.org
ReportedBy: sergiodj@redhat.com
CC: jan.kratochvil@redhat.com, keiths@redhat.com
Classification: Unclassified
Consider the following code:
class foo
{
public:
int bar()
{
static int x;
if (x != 5)
{
x = 5;
}
}
};
int main()
{
foo myfoo;
myfoo.bar();
}
On FSF GDB HEAD, one cannot print the value of "x" by doing:
(gdb) print 'foo::bar()::x'
No symbol "foo::bar()::x" in current context.
This happens because some symbols are marked as BSF_GNU_UNIQUE since
<http://sourceware.org/ml/binutils/2009-06/msg00016.html> was committed. I
have a patch which fixes it (to be sent later) by ensuring that GDB reads those
symbols. However, just applying the doesn't entirely fixes the issue, since it
exposes another regression:
(gdb) p 'foo::bar()::x'
../../../../gdb-src/gdb/cp-namespace.c:816: internal-error:
cp_lookup_nested_symbol called on a non-aggregate type.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
This regression happens because of
<http://sourceware.org/git/?p=gdb.git;a=commit;h=677b1bfabd372790dca4dad32fcb05dd77658728>.
I am creating this bug in order to track the regression. I will send patches
to fix it later.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.