public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/13149] New: Some pretty printers don't work in MI mode
@ 2011-09-02 21:17 dodji at seketeli dot org
  2011-09-05 15:47 ` [Bug mi/13149] " mjw at redhat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dodji at seketeli dot org @ 2011-09-02 21:17 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 13149
           Summary: Some pretty printers don't work in MI mode
           Product: gdb
           Version: 7.3
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mi
        AssignedTo: unassigned@sourceware.org
        ReportedBy: dodji@seketeli.org
                CC: pmuldoon@redhat.com
    Classification: Unclassified


Consider this test case:

$ cat -n ~/test.cc
     1    #include <vector>
     2    #include <string>
     3    
     4    int
     5    main()
     6    {
     7        std::vector<std::string> v;
     8        std::string s;
     9        
    10        s = "ein";
    11        v.push_back (s);
    12        s = "zwei";
    13        v.push_back (s);
    14        s = "drei";
    15        v.push_back (s);
    16    }

If I debug it using gdb 7.3 and the mi interpreter, I can see that
the pretty printer for the 'v' variable is not "working" in MI, but is
working in CLI:

$ gdb --interpreter=mi2 ./test
=thread-group-added,id="i1"
~"GNU gdb (GDB) Fedora (7.3-41.fc15)\n"
~"Copyright (C) 2011 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to
change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by
law.  Type \"show copying\"\nand \"show warranty\" for details.\n"
~"This GDB was configured as \"x86_64-redhat-linux-gnu\".\nFor bug reporting
instructions, please see:\n"
~"<http://www.gnu.org/software/gdb/bugs/>...\n"
~"\nwarning: "
~"Current output protocol does not support redirection\n"
~"\nwarning: "
~"Currently logging to gdb.txt.  Turn the logging off and on to make the new
setting effective.\n"
~"Reading symbols from /home/dodji/test..."
~"done.\n"
(gdb) 
-enable-pretty-printing
^done
(gdb) 
b main
~"b main\n"
~"Breakpoint 1 at 0x4009ed: file test.cc, line 7.\n"
^done
(gdb) 
run
~"run\n"
~"Starting program: /home/dodji/test \n"
=thread-group-started,id="i1",pid="30679"
=thread-created,id="1",group-id="i1"
^running
*running,thread-id="all"
(gdb) 
=library-loaded,id="/lib64/ld-linux-x86-64.so.2",target-name="/lib64/ld-linux-x86-64.so.2",host-name="/lib64/ld-linux-x86-64.so.2",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/usr/lib64/libstdc++.so.6",target-name="/usr/lib64/libstdc++.so.6",host-name="/usr/lib64/libstdc++.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib64/libm.so.6",target-name="/lib64/libm.so.6",host-name="/lib64/libm.so.6",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib64/libgcc_s.so.1",target-name="/lib64/libgcc_s.so.1",host-name="/lib64/libgcc_s.so.1",symbols-loaded="0",thread-group="i1"
=library-loaded,id="/lib64/libc.so.6",target-name="/lib64/libc.so.6",host-name="/lib64/libc.so.6",symbols-loaded="0",thread-group="i1"
~"\nBreakpoint "
~"1, main () at test.cc:7\n"
~"7\t    std::vector<std::string> v;\n"
*stopped,frame={addr="0x00000000004009ed",func="main",args=[],file="test.cc",fullname="/home/dodji/test.cc",line="7"},thread-id="1",stopped-threads="all",core="2"
(gdb) 
n
~"n\n"
^running
*running,thread-id="1"
(gdb) 
~"8\t    std::string s;\n"
*stopped,frame={addr="0x00000000004009f9",func="main",args=[],file="test.cc",fullname="/home/dodji/test.cc",line="8"},thread-id="1",stopped-threads="all",core="2"
(gdb) 
n
~"n\n"
^running
*running,thread-id="1"
(gdb) 
~"10\t    s = \"ein\";\n"
*stopped,frame={addr="0x0000000000400a05",func="main",args=[],file="test.cc",fullname="/home/dodji/test.cc",line="10"},thread-id="1",stopped-threads="all",core="1"
(gdb) 
n
~"n\n"
^running
*running,thread-id="1"
(gdb) 
~"11\t    v.push_back (s);\n"
*stopped,frame={addr="0x0000000000400a16",func="main",args=[],file="test.cc",fullname="/home/dodji/test.cc",line="11"},thread-id="1",stopped-threads="all",core="2"
(gdb) 
n
~"n\n"
^running
*running,thread-id="1"
(gdb) 
~"12\t    s = \"zwei\";\n"
*stopped,frame={addr="0x0000000000400a29",func="main",args=[],file="test.cc",fullname="/home/dodji/test.cc",line="12"},thread-id="1",stopped-threads="all",core="2"
(gdb) 
-var-create - * s
^done,name="var1",numchild="0",value="
\"ein\"",type="std::string",thread-id="1",displayhint="string",dynamic="1",has_more="0"
(gdb) 
-var-create - * v
^done,name="var2",numchild="0",value="{...}",type="std::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >
>",thread-id="1",displayhint="array",dynamic="1",has_more="1"
(gdb) 
p v
~"p v\n"
~"$1 = std::vector of length 1, capacity 1 = {\"ein\""
~"}\n"
^done
(gdb) 

you Can see that the "-var-create - * v" yields a varobj which value
is "{...}".  If I tried to explore it I get:

-var-list-children var2
^done,numchild="1",displayhint="array",children=[child={name="var2.[0]",exp="[0]",numchild="0",type="std::basic_string<char,
std::char_traits<char>, std::allocator<char>
>",thread-id="1",displayhint="string",dynamic="1"}],has_more="0"
(gdb) 
-var-list-children var2.[0]
^done,numchild="0",displayhint="string",has_more="0"
(gdb) 


Not particularly well pretty printed.  Notice how the CLI command "p
v" yields a pretty printed value, instead.  Notice also how the varobj
created for the string "s" yields a pretty printed value.

This version of GDB is:

$ gdb --version
GNU gdb (GDB) Fedora (7.3-41.fc15)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug mi/13149] Some pretty printers don't work in MI mode
  2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
@ 2011-09-05 15:47 ` mjw at redhat dot com
  2011-11-11 16:45 ` tromey at redhat dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mjw at redhat dot com @ 2011-09-05 15:47 UTC (permalink / raw)
  To: gdb-prs

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

Mark Wielaard <mjw at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mjw at redhat dot com

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug mi/13149] Some pretty printers don't work in MI mode
  2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
  2011-09-05 15:47 ` [Bug mi/13149] " mjw at redhat dot com
@ 2011-11-11 16:45 ` tromey at redhat dot com
  2011-12-21 14:54 ` dodji at seketeli dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at redhat dot com @ 2011-11-11 16:45 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |tromey at redhat dot com

--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2011-11-11 16:44:57 UTC ---
This works fine for me, with gdb 7.3 (7.3.1, I suppose, I built it from
the branch), provided I pass --all-values to -var-list-children:

(gdb) 
-var-create - * v 
^done,name="var1",numchild="0",value="{...}",type="std::vector<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >
>",thread-id="1",displayhint="array",dynamic="1",has_more="1"
(gdb) 
-var-list-children --all-values var1
^done,numchild="1",displayhint="array",children=[child={name="var1.[0]",exp="[0]",numchild="0",value="
\"ein\"",type="std::basic_string<char, std::char_traits<char>,
std::allocator<char>
>",thread-id="1",displayhint="string",dynamic="1"}],has_more="0"


I looked, and nemiver seems to always pass that option.
Is this still a problem for you?

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug mi/13149] Some pretty printers don't work in MI mode
  2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
  2011-09-05 15:47 ` [Bug mi/13149] " mjw at redhat dot com
  2011-11-11 16:45 ` tromey at redhat dot com
@ 2011-12-21 14:54 ` dodji at seketeli dot org
  2011-12-21 15:00 ` tromey at redhat dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dodji at seketeli dot org @ 2011-12-21 14:54 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from dodji at seketeli dot org 2011-12-21 14:54:14 UTC ---
Sorry for my late reply.  I tried to test this on Fedora 15 and then I
hit the crash that I reported at
http://sourceware.org/bugzilla/show_bug.cgi?id=13535.  I'll try this again
with a GDB built from Archer and let you know.

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug mi/13149] Some pretty printers don't work in MI mode
  2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
                   ` (2 preceding siblings ...)
  2011-12-21 14:54 ` dodji at seketeli dot org
@ 2011-12-21 15:00 ` tromey at redhat dot com
  2011-12-22 15:11 ` dodji at seketeli dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at redhat dot com @ 2011-12-21 15:00 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2011-12-21 14:58:43 UTC ---
(In reply to comment #2)
> Sorry for my late reply.  I tried to test this on Fedora 15 and then I
> hit the crash that I reported at
> http://sourceware.org/bugzilla/show_bug.cgi?id=13535.  I'll try this again
> with a GDB built from Archer and let you know.

I think trying the 7.4 prerelease would be best.

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug mi/13149] Some pretty printers don't work in MI mode
  2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
                   ` (3 preceding siblings ...)
  2011-12-21 15:00 ` tromey at redhat dot com
@ 2011-12-22 15:11 ` dodji at seketeli dot org
  2011-12-22 15:56 ` tromey at redhat dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dodji at seketeli dot org @ 2011-12-22 15:11 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from dodji at seketeli dot org 2011-12-22 15:10:33 UTC ---
So I finally tried and the same problem remains.  I think I haven't
explained the problem well in the first place.

Please look at the creation of the problematic vector:

    -var-create - * v
   
^done,name="var2",numchild="0",value="{...}",type="std::vector<std::basic_string<char,
    std::char_traits<char>, std::allocator<char> >,
    std::allocator<std::basic_string<char, std::char_traits<char>,
    std::allocator<char> > >
    >",thread-id="1",displayhint="array",dynamic="1",has_more="1"
    (gdb)

Look more particularly at the numchild="0" part.  When the MI client
sees that, it follows that it won't propose to the user to unfold the
tree node representing the vector 'v', as that means the node has no
children to unfold.  And as the -var-list-children is emitted only
when the user clicks to unfold the node, that command is not issued.

So that nodes shows a content of "{...}", with no chance for the user
to expand it.

So I think fixing the numchild="0" part to make it be
numchild="<actual-num-children>" instead would fix this.

And yes passing --all-value to -var-list-children helps, as you
suggested.  But the above problem remains.

Thank you.

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug mi/13149] Some pretty printers don't work in MI mode
  2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
                   ` (4 preceding siblings ...)
  2011-12-22 15:11 ` dodji at seketeli dot org
@ 2011-12-22 15:56 ` tromey at redhat dot com
  2012-02-18 13:17 ` dodji at seketeli dot org
  2012-02-18 13:18 ` dodji at seketeli dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at redhat dot com @ 2011-12-22 15:56 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom Tromey <tromey at redhat dot com> 2011-12-22 15:56:05 UTC ---
(In reply to comment #4)
> So I finally tried and the same problem remains.  I think I haven't
> explained the problem well in the first place.

> Look more particularly at the numchild="0" part.

Ok, I see.
I don't remember the rationale any more, but IIRC this was part of
Vladimir's design here.
>From the docs:

`numchild'
     The number of children of the varobj.  This number is not
     necessarily reliable for a dynamic varobj.  Instead, you must
     examine the `has_more' attribute.

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug mi/13149] Some pretty printers don't work in MI mode
  2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
                   ` (5 preceding siblings ...)
  2011-12-22 15:56 ` tromey at redhat dot com
@ 2012-02-18 13:17 ` dodji at seketeli dot org
  2012-02-18 13:18 ` dodji at seketeli dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dodji at seketeli dot org @ 2012-02-18 13:17 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from dodji at seketeli dot org 2012-02-18 13:16:48 UTC ---
"tromey at redhat dot com" <sourceware-bugzilla@sourceware.org> a écrit:

> Ok, I see.
> I don't remember the rationale any more, but IIRC this was part of
> Vladimir's design here.
> From the docs:
>
> `numchild'
>      The number of children of the varobj.  This number is not
>      necessarily reliable for a dynamic varobj.  Instead, you must
>      examine the `has_more' attribute.

Great.  Thank you for the hand-holding.  Looking at has_more for dynamic
varobjs works as expected.  I wonder why I missed this in the first
place.

Thanks!

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug mi/13149] Some pretty printers don't work in MI mode
  2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
                   ` (6 preceding siblings ...)
  2012-02-18 13:17 ` dodji at seketeli dot org
@ 2012-02-18 13:18 ` dodji at seketeli dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dodji at seketeli dot org @ 2012-02-18 13:18 UTC (permalink / raw)
  To: gdb-prs

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

dodji at seketeli dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID

-- 
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.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-02-18 13:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02 21:17 [Bug mi/13149] New: Some pretty printers don't work in MI mode dodji at seketeli dot org
2011-09-05 15:47 ` [Bug mi/13149] " mjw at redhat dot com
2011-11-11 16:45 ` tromey at redhat dot com
2011-12-21 14:54 ` dodji at seketeli dot org
2011-12-21 15:00 ` tromey at redhat dot com
2011-12-22 15:11 ` dodji at seketeli dot org
2011-12-22 15:56 ` tromey at redhat dot com
2012-02-18 13:17 ` dodji at seketeli dot org
2012-02-18 13:18 ` dodji at seketeli dot org

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).