Background ========== In a graphical debugger, suppose the user is looking at the local variables of the current frame. If the user enables pretty printing, those variables have to dynamically be re-rendered using the pretty printers. Likewise, whenever the user disables pretty printing, those variable have to dynamically be re-rendered without the pretty printing visualizers. It should not be required to re-start the graphical debugger just to toggle pretty printing. There are several things that make it hard for front-ends using the GDB MI API to achieve this goal. Issue description ================= The current MI API doesn't allow clients to globally disable pretty printing. Rather, every single variable object needs to see its visualizer set to 'None', using -var-set-visualizer. From the point of view of the client, this is suboptimal. There could be an MI command that would cause all current variable objects to be re-rendered. Clients would then be notified and would update their side of the graphical representation of the re-rendered variables. In case doing this would be too hard, the current scheme could be kept. But then there are other point that would need to be addressed. Currently, whenever a variable object (named var1) has been created and rendered using pretty printers, it's quite hard to make its sub-objects be recursively be re-rendered using the "None" pretty printer, at least. That is, -var-set-visualizer None var, followed by -var-list-children --all-values yields sub-objects rendered with the *previous* pretty printing visualizer. In other words, sub-objects currently don't inherit the pretty printing visualizer of their parent object. Possible solution ================= I am proposing to maybe have a -var-list-children --with-visualizer <Name>, and similarly a -var-create --with-visualizer <Name> to disable/enable pretty printing per variable object, including their sub objects. Below is a small gdb session that should hopefully illustrate my point. [dodji@adjoa test]$ cat test.cc #include <string> using std::string; class person { string m_name; public: person (const string& name = ""): m_name (name) { } }; int main() { person p ("Toto"); return 0; } [dodji@adjoa test]$ gdb --interpreter=mi2 ./test (gdb) b main ~"b main\n" ~"Breakpoint 1 at 0x4007af: file test.cc, line 19.\n" ^done (gdb) run ~"Breakpoint 1, main () at test.cc:19\n" ~"19\t person p (\"Toto\");\n" *stopped,frame={addr="0x00000000004007af",func="main",args=[],file="test.cc",fullname="/home/dodji/test/test.cc",line="19"},thread-id="1",stopped-threads="all",core="1" (gdb) next ~"n\n" ^running *running,thread-id="1" (gdb) ~"20\t return 0;\n" *stopped,frame={addr="0x0000000000400850",func="main",args=[],file="test.cc",fullname="/home/dodji/test/test.cc",line="20"},thread-id="1",stopped-threads="all",core="1" (gdb) -enable-pretty-printing ^done (gdb) -var-create - * p ^done,name="var1",numchild="1",value="{...}",type="person",thread-id="1",has_more="0" (gdb) -var-list-children --all-values var1 ^done,numchild="1",children=[child={name="var1.private",exp="private",numchild="1",value="",thread-id="1"}],has_more="0" (gdb) -var-list-children --all-values var1.private ^done,numchild="1",children=[child={name="var1.private.m_name",exp="m_name",numchild="0",value="\"Toto\"",type="std::string",thread-id="1",displayhint="string",dynamic="1"}],has_more="0" (gdb) -var-set-visualizer var1 None ^done (gdb) -var-list-children --all-values var1 ^done,numchild="1",children=[child={name="var1.private",exp="private",numchild="1",value="",thread-id="1"}],has_more="0" (gdb) -var-list-children --all-values var1.private ^done,numchild="1",children=[child={name="var1.private.m_name",exp="m_name",numchild="0",value="\"Toto\"",type="std::string",thread-id="1",displayhint="string",dynamic="1"}],has_more="0" (gdb) -var-set-visualizer var1.private None ^done (gdb) -var-list-children --all-values var1.private ^done,numchild="1",children=[child={name="var1.private.m_name",exp="m_name",numchild="0",value="\"Toto\"",type="std::string",thread-id="1",displayhint="string",dynamic="1"}],has_more="0" (gdb) -var-set-visualizer var1.private.m_name None ^done (gdb) -var-list-children --all-values var1.private ^done,numchild="1",children=[child={name="var1.private.m_name",exp="m_name",numchild="2",value="{...}",type="std::string",thread-id="1"}],has_more="0" The exact GDB version I am using is: GNU gdb (GDB) Fedora (7.1-34.fc13)
Another possible proposal could also be to have something like -var-set-visualizer --recursive <Name>, to allow setting a given visualizer to not only a variable object, but also to its sub-objects. I guess this might be even better than having the -var-list-children --with-visualizer I was proposing earlier.
If you change a visualizer, the children may all change. So I tend to think there's no way to really satisfy this request.
What I mean is, even the names or number of children may change. A pretty-printer can synthesize or omit children. I think I'm going to close this, please reopen if I'm in error.