public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/10710] New: libstdc++ UniquePointerPrinter GDB Python printer does not work
@ 2009-09-30 13:32 pmuldoon at redhat dot com
  2009-10-01 20:28 ` [Bug python/10710] " tromey at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pmuldoon at redhat dot com @ 2009-09-30 13:32 UTC (permalink / raw)
  To: gdb-prs

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.


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

* [Bug python/10710] libstdc++ UniquePointerPrinter GDB Python printer does not work
  2009-09-30 13:32 [Bug python/10710] New: libstdc++ UniquePointerPrinter GDB Python printer does not work pmuldoon at redhat dot com
@ 2009-10-01 20:28 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at redhat dot com @ 2009-10-01 20:28 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From tromey at redhat dot com  2009-10-01 20:28 -------
We discussed this on irc & agreed that maybe a tuple printer
would be a better (more general) solution.

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


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.


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

* [Bug python/10710] libstdc++ UniquePointerPrinter GDB Python printer does not work
  2009-09-30 13:32 [Bug python/10710] New: libstdc++ UniquePointerPrinter GDB Python printer does not work pmuldoon at redhat dot com
  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
  2 siblings, 0 replies; 4+ messages in thread
From: pmuldoon at redhat dot com @ 2009-10-21 11:57 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at sourceware dot|pmuldoon at redhat dot com
                   |org                         |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1


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.


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

* [Bug python/10710] libstdc++ UniquePointerPrinter GDB Python printer does not work
  2009-09-30 13:32 [Bug python/10710] New: libstdc++ UniquePointerPrinter GDB Python printer does not work pmuldoon at redhat dot com
  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
  2 siblings, 0 replies; 4+ messages in thread
From: pmuldoon at redhat dot com @ 2009-10-21 11:59 UTC (permalink / raw)
  To: gdb-prs


------- Additional Comments From pmuldoon at redhat dot com  2009-10-21 11:59 -------
This was fixed recently with the inclusion of a std::tuple printer in the
libstdc++ library. 

http://gcc.gnu.org/ml/gcc-cvs/2009-10/msg00666.html

Author: pmuldoon
Date: Tue Oct 20 13:52:34 2009
New Revision: 153013

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153013
Log:


	* python/libstdcxx/v6/printers.py (StdTuplePrinter): New printer.
	(build_libstdcxx_dictionary): Add StdTuplePrinter registration.


Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/python/libstdcxx/v6/printers.py


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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.


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

end of thread, other threads:[~2009-10-21 11:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-30 13:32 [Bug python/10710] New: libstdc++ UniquePointerPrinter GDB Python printer does not work pmuldoon at redhat dot com
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

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