public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "pmuldoon at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/10710] New: libstdc++ UniquePointerPrinter GDB Python printer does not work
Date: Wed, 30 Sep 2009 13:32:00 -0000	[thread overview]
Message-ID: <20090930133204.10710.pmuldoon@redhat.com> (raw)

Given this example:

std::unique_ptr<char[]> t_uptr (new char[1]);
t_uptr[0] = 'z';

The output from the pretty printer reads:

t_uptr = {
  <std::_Tuple_impl<0ul, char*, std::default_delete<char []> >> = {
    <std::_Tuple_impl<1ul, std::default_delete<char []> >> = {
      <std::_Tuple_impl<2ul>> = {<No data fields>},
      <std::_Head_base<1ul, std::default_delete<char []>, true>> = {
        <std::default_delete<char []>> = {<No data fields>}, <No data fields>},
<No data fields>},
    <std::_Head_base<0ul, char*, false>> = {
      _M_head_impl = 0x61b7b0 "z"
    }, <No data fields>}, <No data fields>}

Which is incorrect. It seems the printer needs to access _M_head_impl. The
following trivial patch fixes it in this simple case, but I've not tested this
at all beyond my one case. If this patch is applied, the output is:

(gdb) p t_uptr 
$1 = 0x61b7b0 "z"


Index: libstdc++-v3/python/libstdcxx/v6/printers.py
===================================================================
--- libstdc++-v3/python/libstdcxx/v6/printers.py	(revision 152325)
+++ libstdc++-v3/python/libstdcxx/v6/printers.py	(working copy)
@@ -40,7 +40,7 @@
         self.val = val
 
     def to_string (self):
-        return self.val['_M_t']
+        return self.val['_M_t']['_M_head_impl']
 
 class StdListPrinter:
     "Print a std::list"

-- 
           Summary: libstdc++ UniquePointerPrinter GDB Python printer does
                    not work
           Product: gdb
           Version: archer
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: pmuldoon at redhat dot com
                CC: gdb-prs at sourceware dot org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


             reply	other threads:[~2009-09-30 13:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 13:32 pmuldoon at redhat dot com [this message]
2009-10-01 20:28 ` [Bug python/10710] " tromey at redhat dot com
2009-10-21 11:57 ` pmuldoon at redhat dot com
2009-10-21 11:59 ` pmuldoon at redhat dot com

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=20090930133204.10710.pmuldoon@redhat.com \
    --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).