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] Anonymous unions/structs not handled correctly under MI


------- Additional Comments From nickrob at snap dot net dot nz  2009-10-10 03:10 -------
Subject:  Anonymous unions/structs not handled correctly under MI

 > Thanks for looking at this. I have applied the patch to the latest cvs snapshot
 > of GDB (7.0.50.20091009) and still get "Duplicate variable object name" using
 > the posted testcase. Here's the debugger session.

Ah, yes.  I got sidetracked and considered the equivalent C case below.  I'll
have a look at the C++ case that you posted,

-- 
Nick                                           http://users.snap.net.nz/~nickrob


#include <stdio.h>

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

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

int main()
{
  test bar = {{1, 2.2}, {3, 4.4}};

    bar.a = 5;
    bar.b = 6.6;
    printf ("%d\n", bar.a);
    printf ("%f\n", bar.b);
}

previously:

-var-create - * bar
^done,name="var1",numchild="2",value="{...}",type="test",thread-id="1",has_more="0"
(gdb) 
-var-list-children var1
^error,msg="Duplicate variable object name"
(gdb) 

with patch:

-var-list-children var1
^done,numchild="2",children=[child={name="var1.0",exp="0",numchild="2",type="struct {...}",thread-id="1"},child={name="var1.1",exp="1",numchild="2",type="struct {...}",thread-id="1"}],has_more="0"
(gdb) 
-var-list-children var1.0 
^done,numchild="2",children=[child={name="var1.0.a",exp="a",numchild="0",type="int",thread-id="1"},child={name="var1.0.b",exp="b",numchild="0",type="float",thread-id="1"}],has_more="0"
(gdb) 
-var-list-children var1.1
^done,numchild="2",children=[child={name="var1.1.c",exp="c",numchild="0",type="int",thread-id="1"},child={name="var1.1.d",exp="d",numchild="0",type="float",thread-id="1"}],has_more="0"
(gdb) 
=


-- 


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]