From: Chris Moller <cmoller@redhat.com>
To: tromey@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: PR11067 patch
Date: Tue, 09 Feb 2010 17:31:00 -0000 [thread overview]
Message-ID: <4B719BF6.1040207@redhat.com> (raw)
In-Reply-To: <m3aavj4cmp.fsf@fleche.redhat.com>
On 02/08/10 16:54, Tom Tromey wrote:
>>>>>> "Chris" == Chris Moller<cmoller@redhat.com> writes:
>>>>>>
>
> Chris> The attached patch fixes bug 11067 "p<enum constant> should print the
> Chris> constant's value" by providing a means of setting a format string to
> Chris> be used in printing enums. The string is set with
>
> Chris> set enum-fmt<string>
>
> I would rather not introduce a new option for this, particularly a
> formatting option. We don't have this sort of thing elsewhere in gdb --
> we just pick a printing format or two.
>
The argument still applies that, no matter which format(s) are defined
for multifaceted data (in this case, numeric value, symbolic value, and
enum tag), it's not going to meet everyone's needs--the discussion on
this thread demonstrates that fairly well. The patch I'm suggesting
offers the flexibility to easily define, using a simple, printf-like
format string, without the necessity of writing Python code or whatever,
any format people find useful.
The patch I'm suggesting is completely transparent to people who don't
use it. The presence of the set enum-fmt operation can be utterly
ignored, with no loss of existing gdb capability, by people who don't
need it, but at the same time offers flexibility to people who can make
use of it.
The same mechanism, BTW, could be used for other presently fixed-format
multifaceted data such as characters (including, possibly, multibyte,
UTF-style or wchar_t, characters, if gdb supports that kind of thing,
but I haven't looked in detail at this.). The mechanism also, BTW,
introduces very little additional overhead in printing values--the user
specified format string is translated, once, when set, into a printf
format string subsequently used by vfprintf_filtered.
> I re-read the thread on the archer list. I propose having it print
> like:
>
> $2 = ENUMERATOR = (enum tag) 23
>
> However, i would suppress the extra stuff in structs and when printing
> in summary mode.
>
It's certainly possible to provide for multiple formats that are
selected based on context--the only thing I don't know just off hand is
how to determine that context.
> Tom
>
next prev parent reply other threads:[~2010-02-09 17:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-06 13:37 Chris Moller
2010-02-06 19:40 ` Eli Zaretskii
2010-02-08 21:54 ` Tom Tromey
2010-02-08 22:08 ` Chris Moller
2010-02-08 22:32 ` Pedro Alves
2010-02-08 22:47 ` Chris Moller
2010-02-08 23:25 ` Pedro Alves
2010-02-09 4:13 ` Joel Brobecker
2010-02-09 4:13 ` Eli Zaretskii
2010-02-09 17:31 ` Chris Moller [this message]
2010-02-09 23:48 ` Tom Tromey
2010-02-10 3:03 ` Chris Moller
2010-02-10 8:19 ` Joel Brobecker
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=4B719BF6.1040207@redhat.com \
--to=cmoller@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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