public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15203] New: GDB can't find static variable declared locally
@ 2013-02-27  1:01 sergiodj at redhat dot com
  2013-02-27 18:18 ` [Bug c++/15203] " sergiodj at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sergiodj at redhat dot com @ 2013-02-27  1:01 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-18  9:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27  1:01 [Bug c++/15203] New: GDB can't find static variable declared locally sergiodj at redhat dot com
2013-02-27 18:18 ` [Bug c++/15203] " sergiodj at redhat dot com
2013-02-27 18:45 ` sergiodj at redhat dot com
2013-03-14 11:13 ` cvs-commit at gcc dot gnu.org
2013-03-14 11:17 ` sergiodj at redhat dot com
2013-03-18  9:20 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).