public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/10586] New: Anonymous unions/structs not handled correctly under MI
@ 2009-09-01 20:07 elethiomel at gmail dot com
  2009-09-01 20:11 ` [Bug mi/10586] " tromey at redhat dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: elethiomel at gmail dot com @ 2009-09-01 20:07 UTC (permalink / raw)
  To: gdb-prs

When attempting to var-list-children on an anonymous union I get "Duplicate
variable object name" if there are multiple anonymous unions or structs. Below
is a code sample and GDB/MI session

Version is 6.8.50.20090901 (The latest weekly cvs snapshot)

This bug was apparently noticed in 2006 by Apple's Jim Ingham and fixed in their
tree. http://sourceware.org/ml/gdb/2006-11/msg00104.html . Their source is
available at http://www.opensource.apple.com/release/mac-os-x-106/ and indeed,
there is mention of the problem in the code and a relevant fix. I lack the
expertise to integrate their changes back into gdb though.

#include <iostream>

struct test
{
        struct{
                int a;
                float b;
        };

        struct{
                int c;
                float d;
        };
};

int main()
{
    test bar;

    std::cout << bar.a << std::endl;
    std::cout << bar.b << std::endl;
}



663-stack-list-locals 0
663^done,locals=[name="bar"]
(gdb)
664 whatis bar
&"whatis bar\n"
~"type = test\n"
664^done
(gdb)
665 ptype test
&"ptype test\n"
~"type = struct test {\n"
~"    test::<anonymous struct>;\n"
~"    test::<anonymous struct>;\n"
~"}\n"
665^done
(gdb)
666-var-create - * bar
666^done,name="var1",numchild="1",value="{...}",type="test",thread-id="1"
(gdb)
667-var-evaluate-expression var1
667^done,value="{...}"
(gdb)
668-var-list-children var1
668^done,numchild="1",children=[child={name="var1.public",exp="public",numchild="2",thread-id="1"}]
(gdb)
669-var-info-expression var1
669^done,lang="C++",exp="bar"
(gdb)
670-var-list-children var1.public
670^error,msg="Duplicate variable object name"
(gdb)
671-var-list-children var1
671^done,numchild="1",children=[child={name="var1.public",exp="public",numchild="2",thread-id="1"}]
(gdb)
672-var-list-children var1.public
672^error,msg="Duplicate variable object name"
(gdb)

-- 
           Summary: Anonymous unions/structs not handled correctly under MI
           Product: gdb
           Version: 6.8
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: mi
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: elethiomel at gmail dot com
                CC: gdb-prs at sourceware dot org
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10586

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2012-01-12 22:55 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-10586-4717@http.sourceware.org/bugzilla/>
2011-11-11 21:32 ` [Bug mi/10586] Anonymous unions/structs not handled correctly under MI keiths at redhat dot com
2012-01-12 22:51 ` cvs-commit at gcc dot gnu.org
2012-01-12 22:52 ` cvs-commit at gcc dot gnu.org
2012-01-12 22:55 ` keiths at redhat dot com
2009-09-01 20:07 [Bug mi/10586] New: " elethiomel at gmail dot com
2009-09-01 20:11 ` [Bug mi/10586] " tromey at redhat dot com
2009-09-01 21:14 ` elethiomel at gmail dot com
2009-10-08 16:57 ` elethiomel at gmail dot com
2009-10-10  0:42 ` nickrob at snap dot net dot nz
2009-10-10  2:23 ` elethiomel at gmail dot com
2009-10-10  3:10 ` nickrob at snap dot net dot nz
2009-10-10  3:33 ` nickrob at snap dot net dot nz
2009-10-10 13:27 ` elethiomel at gmail dot com
2009-10-10 22:35 ` nickrob at snap dot net dot nz
2009-10-10 22:56 ` elethiomel at gmail dot com
2009-10-11  0:36 ` nickrob at snap dot net dot nz

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).