VisualGDB with VS2010 and STL containers

Sysprogs forums Forums VisualGDB VisualGDB with VS2010 and STL containers

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #676
    Lonko
    Participant

    Hi guys,

    i’m using VisualGdb + VC2010. Native VS2010 has good visualizers for STL containers. How come VisualGDB does not? Or is this somewhere to be enabled?

    Example:

    Watch window:

    Is it possible to get nicer visualizers?

    Best regards,
    Lonko

    #2754
    ket
    Participant

    Hi,

    Normally VisualGDB does support good visualizers for STL containers. Which version of VisualGDB are you using and which project type do you have (e.g. Linux, Embedded etc.)?

    #2755
    Lonko
    Participant

    It is a linux embedded project compiled on linux machine with custom toolchain and deployed to an embedded device.
    GDB Version on linux machine is either 7.3 or 7.6, gdbserver is 7.2 and cannot rebuild to a new one… with the toolchain it always fails!

    Best regards,

    #2756
    support
    Keymaster

    The structure of the STL containers can be different in your toolchain. Please go to the GDB Session pane, select “Raw GDB Output”, add your vector to the Watch window, expand it and send us the contents of the GDB Session window. It will contain GDB commands issued by VisualGDB that should explain why STL vector visualization is not working.

    #2757
    Lonko
    Participant

    Hi,

    for the vector:

    -var-delete “var10”
    ^done,ndeleted=”1″
    -var-delete “var11”
    ^done,ndeleted=”2″
    -var-create –frame 0 –thread 1 – * “vct”
    ^done,name=”var14″,numchild=”1″,value=”{…}”,type=”vector, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″,has_more=”0″
    -var-list-children –simple-values “var14” 0 1
    ^done,numchild=”1″,children=[child={name=”var14._Vector_base, std::allocator >, std::allocator, std::allocator > > >”,exp=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,numchild=”1″,type=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″}],has_more=”0″
    -var-list-children –simple-values “var14” 0 1
    ^done,numchild=”1″,children=[child={name=”var14._Vector_base, std::allocator >, std::allocator, std::allocator > > >”,exp=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,numchild=”1″,type=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″}],has_more=”0″
    -var-evaluate-expression “var14._Vector_base, std::allocator >, std::allocator, std::allocator > > >”
    ^done,value=”{…}”
    -var-delete “var9”
    ^done,ndeleted=”3″
    -var-create –frame 0 –thread 1 – * “vct”
    ^done,name=”var15″,numchild=”1″,value=”{…}”,type=”vector, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″,has_more=”0″
    -var-list-children –simple-values “var15” 0 1
    ^done,numchild=”1″,children=[child={name=”var15._Vector_base, std::allocator >, std::allocator, std::allocator > > >”,exp=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,numchild=”1″,type=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″}],has_more=”0″
    -var-list-children –simple-values “var15” 0 1
    ^done,numchild=”1″,children=[child={name=”var15._Vector_base, std::allocator >, std::allocator, std::allocator > > >”,exp=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,numchild=”1″,type=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″}],has_more=”0″
    -var-evaluate-expression “var15._Vector_base, std::allocator >, std::allocator, std::allocator > > >”
    ^done,value=”{…}”
    -stack-list-frames –thread 1
    ^done,stack=[frame={level=”0″,addr=”0x0001c5f4″,func=”main”,file=”src/ePayEmbedded.cpp”,fullname=”/tmp/VisualGDB/g/Temp/ePay/ePay/src/ePayEmbedded.cpp”,line=”29″}]
    -stack-list-arguments –thread 1 0
    ^done,stack-args=[frame={level=”0″,args=[name=”argc”,name=”argv”]}]

    For std::string testSTR;
    -var-create –frame 0 –thread 1 – * “testStr”
    ^done,name=”var16″,numchild=”2″,value=”{…}”,type=”Util::string”,thread-id=”1″,has_more=”0″
    -var-list-children –simple-values “var16” 0 2
    ^done,numchild=”2″,children=[child={name=”var16.public”,exp=”public”,numchild=”1″,value=””,thread-id=”1″},child={name=”var16.private”,exp=”private”,numchild=”2″,value=””,thread-id=”1″}],has_more=”0″
    -var-list-children –simple-values “var16.public” 0 1
    ^done,numchild=”1″,children=[child={name=”var16.public.npos”,exp=”npos”,numchild=”0″,value=”4294967295″,type=”const size_t”,thread-id=”1″}],has_more=”0″
    -var-list-children –simple-values “var16.private” 0 2
    ^done,numchild=”2″,children=[child={name=”var16.private._M_dataplus”,exp=”_M_dataplus”,numchild=”2″,type=”basic_string, std::allocator >::_Alloc_hider”,thread-id=”1″},child={name=”var16.private._S_empty_rep_storage”,exp=”_S_empty_rep_storage”,numchild=”4″,type=”size_t [4]”,thread-id=”1″}],has_more=”0″
    -var-evaluate-expression “var16.private._M_dataplus”
    ^done,value=”{…}”
    -var-evaluate-expression “var16.private._S_empty_rep_storage”
    ^done,value=”[4]”
    -var-create –frame 0 –thread 1 – * “testStr”
    ^done,name=”var17″,numchild=”2″,value=”{…}”,type=”Util::string”,thread-id=”1″,has_more=”0″
    -var-list-children –simple-values “var17” 0 2
    ^done,numchild=”2″,children=[child={name=”var17.public”,exp=”public”,numchild=”1″,value=””,thread-id=”1″},child={name=”var17.private”,exp=”private”,numchild=”2″,value=””,thread-id=”1″}],has_more=”0″
    -var-list-children –simple-values “var17.public” 0 1
    ^done,numchild=”1″,children=[child={name=”var17.public.npos”,exp=”npos”,numchild=”0″,value=”4294967295″,type=”const size_t”,thread-id=”1″}],has_more=”0″
    -var-list-children –simple-values “var17.private” 0 2
    ^done,numchild=”2″,children=[child={name=”var17.private._M_dataplus”,exp=”_M_dataplus”,numchild=”2″,type=”basic_string, std::allocator >::_Alloc_hider”,thread-id=”1″},child={name=”var17.private._S_empty_rep_storage”,exp=”_S_empty_rep_storage”,numchild=”4″,type=”size_t [4]”,thread-id=”1″}],has_more=”0″
    -var-evaluate-expression “var17.private._M_dataplus”
    ^done,value=”{…}”
    -var-evaluate-expression “var17.private._S_empty_rep_storage”
    ^done,value=”[4]”
    -var-create –frame 0 –thread 1 – * “vct”
    ^done,name=”var18″,numchild=”1″,value=”{…}”,type=”vector, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″,has_more=”0″
    -var-list-children –simple-values “var18” 0 1
    ^done,numchild=”1″,children=[child={name=”var18._Vector_base, std::allocator >, std::allocator, std::allocator > > >”,exp=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,numchild=”1″,type=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″}],has_more=”0″
    -var-list-children –simple-values “var18” 0 1
    ^done,numchild=”1″,children=[child={name=”var18._Vector_base, std::allocator >, std::allocator, std::allocator > > >”,exp=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,numchild=”1″,type=”_Vector_base, std::allocator >, std::allocator, std::allocator > > >”,thread-id=”1″}],has_more=”0″
    -var-evaluate-expression “var18._Vector_base, std::allocator >, std::allocator, std::allocator > > >”
    ^done,value=”{…}”
    -stack-list-frames –thread 1
    ^done,stack=[frame={level=”0″,addr=”0x0001c5f4″,func=”main”,file=”src/ePayEmbedded.cpp”,fullname=”/tmp/VisualGDB/g/Temp/ePay/ePay/src/ePayEmbedded.cpp”,line=”29″}]
    -stack-list-arguments –thread 1 0
    ^done,stack-args=[frame={level=”0″,args=[name=”argc”,name=”argv”]}]

    Best regards,
    Alen

    #2758
    ket
    Participant

    Hi,

    It looks to be a namespace issue, the vector and string are not displayed with nice visualizers because gdb reports their namespaces wrong i.e. not as std. Normally the type would always be referred with the full namespace. This could be a toolchain issue or maybe something wrong with namespaces in your code.

    The vector type is reported as vector only not as std::vector. Is the std namespace mapped to an empty namespace? We do not feel comfortable always using an std::vector visualizer for any vector type without a namespace, it can give issues with other libraries vector types.

    The string is reported as Util::string not as std::string. Again we cannot add support of a std::string visualizer to Util::string, as the structure of Util::string would normally be anything but std::string.

    We could give you the source of STLVisualizers, the plugin that handles STL visualization that you could adjust it for your toolchain if you are interested.

    #2759
    Lonko
    Participant

    If you think i can manage to adjust the code so that it will fit my toolchain then please send, as it is really anoying :S
    Also is there a way to display vars either in decimal or hex instead of octal ? Can this also be change with visualizers?

    Regards,

    #2760
    support
    Keymaster

    We have sent you the source code for the STLTypeVisualizers. If you encounter any issues with it, please let us know.
    Regarding octal display, GDB sometimes uses it internally, but we usually convert the values to either decimal or hexadecimal form. If you encounter octal output in some cases, please provide us with repro steps so that we could investigate and fix it.

    #2761
    Lonko
    Participant

    Hi implemented the vizualizers and it works ok.

    Hexadecimals are usualy not displayed on byte arrays. Also sometimes when you have complex data type and in it vector with bytes it ignores the Hexadecimal switch.
    Basicaly sometimes it works sometimes it does not 😀

    #2762
    support
    Keymaster

    Hi,

    If you could provide a GDB log and/or screenshots illustrating your problem, we could be able to help you further.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.