From: Daniel Jacobowitz <drow@false.org>
To: Wu Zhou <woodzltc@cn.ibm.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] Decimal Floating Point support for GDB (Part 1: patch)
Date: Sun, 09 Oct 2005 20:08:00 -0000 [thread overview]
Message-ID: <20051009200814.GB7107@nevyn.them.org> (raw)
In-Reply-To: <Pine.LNX.4.63.0510091252390.4752@linux.site>
On Sun, Oct 09, 2005 at 01:27:10PM +0800, Wu Zhou wrote:
> > I'm afraid I am not very happy with this approach :-(
> >
> > * c-exp.y (parse_number): Parse the decimal floating point, which
> > has a suffix ('df', 'dd' or 'dl') and return STRING here.
>
> In fact. I am not very happy with that either. But this is what came out
> of my mind at this time, provided that gcc and glibc support for DFP is
> not ready yet. If the gdb-building compiler already support dfp types
> (_Decimal32, _Decimal64 and _Decimal64) and sscanf (GDB uses it to parse
> floating point number) could recognize and scan decimal types, I won't
> adopt this method.
I'd rather work with decNumber than mix host and target types.
> > (gdb) p 1.2df
> > evaluation of this expression requires the target program to be active
>
> Didn't predict that. So all string expression handling need the target
> program to be active?
Yes. The expression 'print "1"' calls malloc(2) in the inferior
program to allocate space for the string, pokes the value into target
memory, and generally leaks a bit of memory too.
> > [Side effect of string handling]
> >
> > (gdb) p 1.2df
> > $1 = "1.2"
>
> Predicted this. It seems that it is still acceptable. Right?
Please no! "p 1.2df" should give me back either 1.2 or 1.2df.
> > If we have a GDB type system representation for decimal floats, the C
> > parser should use it, and for lexing purposes it should probably be a
> > FLOAT.
>
> Okay. I didn't thought of adding a gdb type for decimal floats. Maybe I
> should (It seems to be a good approach). But I am not very familar
> with GDB's type system. Any clue about how to start? adding a
> builtin_type for DFP and letting it have three or more fields (like sign,
> coefficient, exponent...)? I will take some more looks into the code.
Or just use the decNumber packed representation, in value_contents().
Take a look at all the references to FLOATFORMAT to see how we handle
floating point types.
We'd want to handle printing not only dfp variables, but dfp fields in
structures, et cetera.
--
Daniel Jacobowitz
CodeSourcery, LLC
next prev parent reply other threads:[~2005-10-09 20:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-28 4:40 Wu Zhou
2005-09-28 18:40 ` Eli Zaretskii
2005-09-29 2:12 ` Wu Zhou
2005-09-29 3:34 ` Eli Zaretskii
2005-10-02 21:00 ` Daniel Jacobowitz
2005-10-03 15:38 ` [RFC] Decimal Floating Point support for GDB (Part 1: patch)(a sidebar) Paul Gilliam
2005-10-03 15:41 ` Daniel Jacobowitz
2005-10-09 4:06 ` Wu Zhou
2005-10-09 5:23 ` [RFC] Decimal Floating Point support for GDB (Part 1: patch) Wu Zhou
2005-10-09 20:08 ` Daniel Jacobowitz [this message]
2005-10-12 14:42 ` Wu Zhou
2005-10-12 14:49 ` Daniel Jacobowitz
2005-10-18 10:02 ` [RFC] Decimal Floating Point support for GDB (Part 1: patch - Rewrited) Wu Zhou
2005-09-29 5:14 [RFC] Decimal Floating Point support for GDB (Part 1: patch) Wu Zhou
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=20051009200814.GB7107@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=woodzltc@cn.ibm.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