To reproduce see this example debug session: cat main.cpp #include <vector> int main() { struct { std::vector<int> a; } struct1; struct1.a.push_back(10); struct1.a.push_back(100); return 0; } gdb --interpreter=mi2 testdebugee -enable-pretty-printing break main.cpp:12 -exec-run -var-create struct1 @ struct1 -var-list-children --all-values struct1 ^done,numchild="1",children=[child={name="struct1.public",exp="public",numchild="1",value="",thread-id="1"}],has_more="0" -var-list-children --all-values struct1.public ^done,numchild="1",children=[child={name="struct1.public.a",exp="a",numchild="0",value="{...}",type="std::vector<int, std::allocator<int> >",thread-id="1",displayhint="array",dynamic="1"}],has_more="0" ^^^^ should be "2" #correct: -var-list-children --all-values struct1.public.a ^done,numchild="2",displayhint="array",children=[child={name="struct1.public.a.[0]",exp="[0]",numchild="0",value="10",type="int",thread-id="1"},child={name="struct1.public.a.[1]",exp="[1]",numchild="0",value="100",type="int",thread-id="1"}],ha #correct: -var-info-num-children struct1.public.a ^done,numchild="2"
ok the ^^^^ doesn't point where I wanted it to. To be more clear: Current output: {name="struct1.public.a",exp="a",numchild="0" Expected output: {name="struct1.public.a",exp="a",numchild="2" (after -var-list-children --all-values struct1.public)
'numchild' isn't reliable for a dynamic varobj. This is documented in the MI docs: 'numchild' The number of children of the varobj. This number is not necessarily reliable for a dynamic varobj. Instead, you must examine the 'has_more' attribute. This is a little confusing because in this command: -var-list-children --all-values struct1.public ^done,numchild="1",children=[child={name="struct1.public.a",exp="a",numchild="0",value="{...}",type="std::vector<int, std::allocator<int> >",displayhint="array",dynamic="1"}],has_more="0" ... the has_more here refers to 'struct1.public' (which really only does have one child), and 'a' doesn't have a has_more here. Instead one must list the children of 'a' to find out. So, I'm somewhat inclined to mark this as not a bug.
Finally came back around to this. I think it isn't a bug.