Bug 21208

Summary: Inspecting std::set causes gdb to hang when using gdb/mi interface and pretty printing
Product: gdb Reporter: Jan Pohanka <xhpohanka>
Component: miAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: tromey
Priority: P2    
Version: 7.12.1   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: gdb log

Description Jan Pohanka 2017-03-01 09:47:22 UTC
Created attachment 9865 [details]
gdb log

Following code causes problem to mi interpreter with pretty printing enabled

#include <set>
#include <string>

using namespace std;

int main()
{
    set<string> foo; // non POD type needed here
    foo.insert("bar");

    return 0;
}


Following commands can be used to reproduce the issue
gdb --interpreter=mi ./test

br main
-enable-pretty-printing
-exec-run
-var-create - * foo
-var-list-children var1

Listing children of foo causes very long loop that sometimes never finishes. Detailed log is attached.
Comment 1 Tom Tromey 2022-05-25 18:47:43 UTC
I see this in the log: numchild="72752"

What's probably going on is that this is printing the
uninitialized set.  Normally a front end should use
the output-limiting features of MI to avoid getting
tons of garbage in this case.  gdb has no way to know
whether a variable is initialized or not...
Comment 2 Tom Tromey 2023-08-31 17:19:39 UTC
Duping to the general bug about uninitialized handling.

*** This bug has been marked as a duplicate of bug 11868 ***