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
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
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 ` md5i at md5i dot com
2023-01-27 20:43 ` md5i at md5i dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: md5i at md5i dot com @ 2023-01-27 20:42 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
Michael Welsh Duggan <md5i at md5i dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #14635|0 |1
is obsolete| |
--- Comment #1 from Michael Welsh Duggan <md5i at md5i dot com> ---
Created attachment 14636
--> https://sourceware.org/bugzilla/attachment.cgi?id=14636&action=edit
test program (previous was wrong file)
I attached the wrong file 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
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
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
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: md5i at md5i dot com @ 2023-01-27 20:43 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
--- Comment #2 from Michael Welsh Duggan <md5i at md5i dot com> ---
Created attachment 14637
--> https://sourceware.org/bugzilla/attachment.cgi?id=14637&action=edit
The python pretty-printer
Attached the pretty printer
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
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
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ssbssa at sourceware dot org @ 2023-01-28 20:00 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--- Comment #3 from Hannes Domani <ssbssa at sourceware dot org> ---
With gdb-8.1.1 everything is output as expected (including member variable d).
And with gdb-8.2.1 onward I can reproduce the behavior of this bug report.
So both the <same as static member of an already seen type> output, and the
missing pretty printing of static members, start with 8.2.1.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
2023-01-27 20:41 [Bug python/30057] New: Pretty printing doesn't seem to happen for static members md5i at md5i dot com
` (2 preceding siblings ...)
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
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2023-04-22 0:55 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-04-22
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
2023-01-27 20:41 [Bug python/30057] New: Pretty printing doesn't seem to happen for static members md5i at md5i dot com
` (3 preceding siblings ...)
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
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2023-04-22 1:15 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
I think the issue is the code to check for a repeated static member
is local to cp-valprint, so cp_print_static_field short-circuits
value printing to handle this case.
This also seems to miss that a union can have a static member.
This seems like something that should instead be handled globally
by the top-level value printer.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
2023-01-27 20:41 [Bug python/30057] New: Pretty printing doesn't seem to happen for static members md5i at md5i dot com
` (4 preceding siblings ...)
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
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2023-04-27 2:39 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at sourceware dot org |tromey at sourceware dot org
--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
I have a patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
2023-01-27 20:41 [Bug python/30057] New: Pretty printing doesn't seem to happen for static members md5i at md5i dot com
` (5 preceding siblings ...)
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
8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2023-04-27 14:32 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
https://sourceware.org/pipermail/gdb-patches/2023-April/199138.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
2023-01-27 20:41 [Bug python/30057] New: Pretty printing doesn't seem to happen for static members md5i at md5i dot com
` (6 preceding siblings ...)
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
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-06 16:49 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3c0e312054aa6c46f0efba0ab111f83f0ea4caed
commit 3c0e312054aa6c46f0efba0ab111f83f0ea4caed
Author: Tom Tromey <tom@tromey.com>
Date: Fri Apr 21 18:53:48 2023 -0600
Allow pretty-print of static members
Python pretty-printers haven't applied to static members for quite
some time. I tracked this down to the call to cp_print_value_fields
in cp_print_static_field -- it doesn't let pretty-printers have a
chance to print the value. This patch fixes the problem.
The way that static members are handled is very weird to me. I tend
to think this should be done more globally, like in value_print.
However, I haven't made any big change.
Reviewed-by: Keith Seitz <keiths@redhat.com>
Tested-by: Keith Seitz <keiths@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30057
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug python/30057] Pretty printing doesn't seem to happen for static members
2023-01-27 20:41 [Bug python/30057] New: Pretty printing doesn't seem to happen for static members md5i at md5i dot com
` (7 preceding siblings ...)
2023-05-06 16:49 ` cvs-commit at gcc dot gnu.org
@ 2023-05-06 16:51 ` tromey at sourceware dot org
8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2023-05-06 16:51 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30057
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Target Milestone|--- |14.1
Resolution|--- |FIXED
--- Comment #8 from Tom Tromey <tromey at sourceware dot org> ---
Fixed.
--
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).