public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug python/30057] New: Pretty printing doesn't seem to happen for static members
@ 2023-01-27 20:41 md5i at md5i dot com
  2023-01-27 20:42 ` [Bug python/30057] " md5i at md5i dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: md5i at md5i dot com @ 2023-01-27 20:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30057

            Bug ID: 30057
           Summary: Pretty printing doesn't seem to happen for static
                    members
           Product: gdb
           Version: 12.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: md5i at md5i dot com
  Target Milestone: ---

Created attachment 14635
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14635&action=edit
test program

For some reason, I'm having difficulty getting Python pretty printers to work
properly on static members.  For example:

I compile the included program, foo.cpp:

  g++ -std=c++20 -ggdb3 -o foo foo.cpp

Then I set run gdb on the executable:

  gdb --quiet foo

Here is the session without the pretty printer:

  Reading symbols from foo...
  (gdb) start
  Temporary breakpoint 1 at 0x112d: file foo.cpp, line 22.
  Starting program: /home/md5i/tmp/gdbtest/foo 
  [Thread debugging using libthread_db enabled]
  Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

  Temporary breakpoint 1, main () at foo.cpp:22
  22        X x;
  (gdb) n
  23      }
  (gdb) p x
  $1 = {a = {x = 0}, static b = {x = 1}, c = {x = 2}, 
    static d = <same as static member of an already seen type>}
  (gdb) p x.b
  $2 = {x = 1}
  (gdb) p x.d
  $3 = {x = 3}

Pretty much what you would expect, though what is that "<same as ... >" thing?

Then, loading the included python pretty printer:

  (gdb) source foo.py
  (gdb) p x
  $4 = {a = {Foo_A_B_C = 0}, static b = {x = 1}, c = {Foo_B_C_A = 2}, 
    static d = <same as static member of an already seen type>}
  (gdb) p x.b
  $5 = {Foo_A_B_C = 1}
  (gdb) p x.d
  $6 = {Foo_B_C_A = 3}

As you can see, b as part of x does not use the pretty printer.  And d has the
same "<same as ... >" problem as before.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-05-06 16:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 20:41 [Bug python/30057] New: Pretty printing doesn't seem to happen for static members md5i at md5i dot com
2023-01-27 20:42 ` [Bug python/30057] " md5i at md5i dot com
2023-01-27 20:43 ` md5i at md5i dot com
2023-01-28 20:00 ` ssbssa at sourceware dot org
2023-04-22  0:55 ` tromey at sourceware dot org
2023-04-22  1:15 ` tromey at sourceware dot org
2023-04-27  2:39 ` tromey at sourceware dot org
2023-04-27 14:32 ` tromey at sourceware dot org
2023-05-06 16:49 ` cvs-commit at gcc dot gnu.org
2023-05-06 16:51 ` tromey at sourceware 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).