public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/51956] New: [patch] improve shared_ptr and weak_ptr pretty-printers for gdb
@ 2012-01-23  7:23 b.r.longbons at gmail dot com
  2012-01-23  9:31 ` [Bug libstdc++/51956] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: b.r.longbons at gmail dot com @ 2012-01-23  7:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51956

             Bug #: 51956
           Summary: [patch] improve shared_ptr and weak_ptr
                    pretty-printers for gdb
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: b.r.longbons@gmail.com


Created attachment 26422
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26422
show weak count as well as strong

Some ignorant guy was complaining about how GDB was inferior because it didn't
print smart pointers and such "properly". Although we easily proved him wrong,
he *did* bring up that it would be nice to see the weak count as well as the
strong.

I don't even know python, but I managed to make this patch so it shows both the
strong and weak refcount.

I think this patch is trivial, so copyright assignment shouldn't be an issue.
But if it need be, just send me the form.


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

* [Bug libstdc++/51956] [patch] improve shared_ptr and weak_ptr pretty-printers for gdb
  2012-01-23  7:23 [Bug libstdc++/51956] New: [patch] improve shared_ptr and weak_ptr pretty-printers for gdb b.r.longbons at gmail dot com
@ 2012-01-23  9:31 ` redi at gcc dot gnu.org
  2012-02-05 13:29 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-01-23  9:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51956

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-01-23
         AssignedTo|unassigned at gcc dot       |redi at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-23 09:01:06 UTC ---
Thanks, I've been meaning to do that for some time.


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

* [Bug libstdc++/51956] [patch] improve shared_ptr and weak_ptr pretty-printers for gdb
  2012-01-23  7:23 [Bug libstdc++/51956] New: [patch] improve shared_ptr and weak_ptr pretty-printers for gdb b.r.longbons at gmail dot com
  2012-01-23  9:31 ` [Bug libstdc++/51956] " redi at gcc dot gnu.org
@ 2012-02-05 13:29 ` redi at gcc dot gnu.org
  2012-02-05 19:10 ` redi at gcc dot gnu.org
  2012-02-05 19:13 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-05 13:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51956

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-05 13:29:07 UTC ---
I think my preferred format is (count N + M weak)

(gdb) p sp
$2 = std::shared_ptr (count 1 + 1 weak) 0x602010
(gdb) p wp
$3 = std::weak_ptr (count 1 + 1 weak) 0x602010

I'm also going to make it print the type, shared_ptr<int> would be much more
helpful than just shared_ptr


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

* [Bug libstdc++/51956] [patch] improve shared_ptr and weak_ptr pretty-printers for gdb
  2012-01-23  7:23 [Bug libstdc++/51956] New: [patch] improve shared_ptr and weak_ptr pretty-printers for gdb b.r.longbons at gmail dot com
  2012-01-23  9:31 ` [Bug libstdc++/51956] " redi at gcc dot gnu.org
  2012-02-05 13:29 ` redi at gcc dot gnu.org
@ 2012-02-05 19:10 ` redi at gcc dot gnu.org
  2012-02-05 19:13 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-05 19:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51956

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-05 19:10:26 UTC ---
Author: redi
Date: Sun Feb  5 19:10:15 2012
New Revision: 183914

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183914
Log:
    PR libstdc++/51956
    * python/libstdcxx/v6/printers.py (StdPointerPrinter): Rename to...
    (SharedPointerPrinter): This. Also show weak count.
    * testsuite/libstdc++-prettyprinters/shared_ptr.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/libstdc++-prettyprinters/shared_ptr.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/python/libstdcxx/v6/printers.py


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

* [Bug libstdc++/51956] [patch] improve shared_ptr and weak_ptr pretty-printers for gdb
  2012-01-23  7:23 [Bug libstdc++/51956] New: [patch] improve shared_ptr and weak_ptr pretty-printers for gdb b.r.longbons at gmail dot com
                   ` (2 preceding siblings ...)
  2012-02-05 19:10 ` redi at gcc dot gnu.org
@ 2012-02-05 19:13 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-02-05 19:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51956

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-02-05 19:13:06 UTC ---
I didn't use your patch, as it printed the wrong thing for the weak count
(_M_weak_count is #weak + (#shared != 0) not #weak + #nshared)

now it prints one of:

(count N, M weak)
(expired, M weak) for an expired weak pointer
(empty)           for an empty pointer


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-23  7:23 [Bug libstdc++/51956] New: [patch] improve shared_ptr and weak_ptr pretty-printers for gdb b.r.longbons at gmail dot com
2012-01-23  9:31 ` [Bug libstdc++/51956] " redi at gcc dot gnu.org
2012-02-05 13:29 ` redi at gcc dot gnu.org
2012-02-05 19:10 ` redi at gcc dot gnu.org
2012-02-05 19:13 ` redi at gcc dot gnu.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).