public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "dodji at seketeli dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug ada/12530] New: pretty-printing can't be easily toggled
Date: Wed, 02 Mar 2011 08:17:00 -0000	[thread overview]
Message-ID: <bug-12530-4717@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=12530

           Summary: pretty-printing can't be easily toggled
           Product: gdb
           Version: archer
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dodji@seketeli.org


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)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2011-03-02  8:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-02  8:17 dodji at seketeli dot org [this message]
2011-03-02  8:32 ` [Bug varobj/12530] " dodji at seketeli dot org
2011-03-02  8:42 ` dodji at seketeli dot org
2011-09-02 10:10 ` pmuldoon at redhat dot com
2023-08-31 16:35 ` tromey at sourceware dot org
2023-08-31 16:36 ` tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-12530-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).