This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug mi/10586] New: Anonymous unions/structs not handled correctly under MI


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]