This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] printf support for DFP values
- From: Eli Zaretskii <eliz at gnu dot org>
- To: luisgpm at linux dot vnet dot ibm dot com
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 27 Oct 2007 11:22:08 +0200
- Subject: Re: [PATCH] printf support for DFP values
- References: <1193449497.6950.22.camel@localhost>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: Luis Machado <luisgpm@linux.vnet.ibm.com>
> Date: Fri, 26 Oct 2007 22:44:57 -0300
>
> GDB's printf command currently does not support printing of DFP values
> (Decimal32, Decimal64 and Decimal128). The following patch proposes to
> fix that by allowing GDB's printf command to deal with those numbers.
Thanks.
> Native DFP printing support with printf is not yet ready, but it should
> be in some time eventually. Due to this, i'm testing for native printf
> support for DFP in the configure script and setting a constant to
> reflect the result (PRINTF_HAS_DECFLOAT). Based on that GDB has two ways
> of dealing with the problem:
>
> 1 - If we have native support (and thus PRINTF_HAS_DECFLOAT is set), we
> just send the DFP value straight to the standard printing routine with
> its format specifiers (printf_filtered).
>
> 2 - If there's currently no support, we stick with converting the DFP
> values to strings and using string format specifiers to print them. This
> should make things flexible enough for both systems, one that has native
> printf support for DFP and one that doesn't.
>
> I'd appreciate comments on this one.
If we can implement DFP printing in GDB, why should we also check for
native DFP support and use that if available? Are there any
advantages in the native DFP printing, and if so, what are they?
Also, if this patch is accepted, please submit also a suitable patch
for the manual (doc/gdb.texinfo), where we describe the format
conversions supported by the `printf' command (node "Output").
A few questions/comments to the patch itself:
> - double_arg, long_double_arg
> + double_arg, long_double_arg, decfloat_arg
You are using decfloat_arg unconditionally, but I don't see it defined
anywhere in today's CVS. Am I missing something?
> + /* Replace %H, %D and %DD for %s's. */
Did you mean "Replace ... _with_ %s's"?