For example if i create a vector; ``` std::vector<std::string> aVector { "this", "is", "a", "standard", "list"} ``` in the normal gdb command line i would get ``` p aVector $1 = std::vector of length 5, capacity 5 = {"this", "is ", "a", "standard", "list"} ``` however in GDB/MI ``` -var-create - * "aVector" -- result-class: done name: var21 numchild: 0 value: {...} type: std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > thread-id: 1 displayhint: array dynamic: 1 has_more: 1 ``` the to_string value of the std::vector pretty printer is gone and replaced by "{...}" the values is meant to show the size of the vector and very valuable when debugging. with the help of my mentor i was able to get the relevant part that it is hardcoded to return `{...}` (there may be other parts) that may be relevant. here https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/c-varobj.c;h=f6db3a5d1ba77ad86e7d36a2cd94ef5fdc26069b;hb=refs/heads/master#l478 https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/varobj.c;h=d0c857a69060644b225f3072b96c90a44b6d1548;hb=refs/heads/master#l2162 thanks
Yeah, back when we added Python pretty-printing, the MI maintainer requested this behavior. I don't know why, as it seems un-useful to me. Perhaps we could lift this restriction and show the to_string output correctly in MI. (Maybe only under the newest MI version, to keep compatibility.)
(In reply to Tom Tromey from comment #1) > Yeah, back when we added Python pretty-printing, the MI maintainer > requested this behavior. I don't know why, as it seems un-useful to me. > Perhaps we could lift this restriction and show the to_string output > correctly in MI. (Maybe only under the newest MI version, to keep > compatibility.) yeah that would be nice to remove the restriction on either the last or the last two mi versions.
Marking this one as a dup, as the other bug is older and has a patch. *** This bug has been marked as a duplicate of bug 11335 ***