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 mi/13149] New: Some pretty printers don't work in MI mode
Date: Fri, 02 Sep 2011 21:17:00 -0000	[thread overview]
Message-ID: <bug-13149-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2011-09-02 10:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02 21:17 dodji at seketeli dot org [this message]
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

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