Bug 17291 - IWBN if the print format was available to pretty-printers.
Summary: IWBN if the print format was available to pretty-printers.
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: HEAD
: P2 enhancement
Target Milestone: 13.1
Assignee: Tom Tromey
URL:
Keywords:
: 29186 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-08-19 16:33 UTC by dje
Modified: 2023-07-21 14:14 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
attachment-1929023-0.html (1.04 KB, text/html)
2023-07-21 14:14 UTC, YEN-TE SHIH
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dje 2014-08-19 16:33:25 UTC
IWBN if pretty-printers had access to the print options (struct value_print_options).
Comment 1 Tom Tromey 2022-06-05 16:19:41 UTC
*** Bug 29186 has been marked as a duplicate of this bug. ***
Comment 2 Tom Tromey 2022-06-07 15:29:33 UTC
I have a patch.
Comment 3 Sourceware Commits 2022-07-15 15:28:53 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c4a3dbaf1132105586586617a59d0e7566eefd41

commit c4a3dbaf1132105586586617a59d0e7566eefd41
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Jun 6 09:54:45 2022 -0600

    Expose current 'print' settings to Python
    
    PR python/17291 asks for access to the current print options.  While I
    think this need is largely satisfied by the existence of
    Value.format_string, it seemed to me that a bit more could be done.
    
    First, while Value.format_string uses the user's settings, it does not
    react to temporary settings such as "print/x".  This patch changes
    this.
    
    Second, there is no good way to examine the current settings (in
    particular the temporary ones in effect for just a single "print").
    This patch adds this as well.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=17291
Comment 4 Tom Tromey 2022-07-15 15:29:31 UTC
Fixed.
Comment 5 YEN-TE SHIH 2022-08-30 02:28:01 UTC
Will this have documentation or sample code?
Thanks.
Comment 6 YEN-TE SHIH 2023-07-21 07:55:29 UTC
(In reply to Tom Tromey from comment #4)
> Fixed.

Hi Tom,

Is it available now in 13.2? Is there any documentation about how to use it?

Thank you very much.
Comment 7 Tom Tromey 2023-07-21 12:22:28 UTC
(In reply to YEN-TE SHIH from comment #6)

> Is it available now in 13.2? Is there any documentation about how to use it?

Yes, this was in the 13.1 release.
The new facility is documented in the manual.
Here's a link to just the manual part of the patch:

https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff;f=gdb/doc/python.texi;h=4573ba677341dee63e94462a5897c2d65b07bd31;hp=19ae33012c30cb5784549668a4754636da26b3be;hb=c4a3dbaf1132105586586617a59d0e7566eefd41;hpb=aa63b0a77e193b5181390f19465f33c314d0490e
Comment 8 YEN-TE SHIH 2023-07-21 14:14:13 UTC
Created attachment 14994 [details]
attachment-1929023-0.html

Thank you!

________________________________
From: tromey at sourceware dot org <sourceware-bugzilla@sourceware.org>
Sent: Friday, July 21, 2023 20:22
To: shihyente@hotmail.com <shihyente@hotmail.com>
Subject: [Bug python/17291] IWBN if the print format was available to pretty-printers.

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

--- Comment #7 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to YEN-TE SHIH from comment #6)

> Is it available now in 13.2? Is there any documentation about how to use it?

Yes, this was in the 13.1 release.
The new facility is documented in the manual.
Here's a link to just the manual part of the patch:

https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff;f=gdb/doc/python.texi;h=4573ba677341dee63e94462a5897c2d65b07bd31;hp=19ae33012c30cb5784549668a4754636da26b3be;hb=c4a3dbaf1132105586586617a59d0e7566eefd41;hpb=aa63b0a77e193b5181390f19465f33c314d0490e

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