public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "md5i at md5i dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug python/30057] New: Pretty printing doesn't seem to happen for static members
Date: Fri, 27 Jan 2023 20:41:05 +0000	[thread overview]
Message-ID: <bug-30057-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-01-27 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 20:41 md5i at md5i dot com [this message]
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

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