From: Andrew Cagney <ac131313@cygnus.com>
To: Mark Kettenis <kettenis@science.uva.nl>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfc/patch] extract/store typed floating ()
Date: Sun, 23 Sep 2001 13:06:00 -0000 [thread overview]
Message-ID: <3BAE40CB.9080702@cygnus.com> (raw)
In-Reply-To: <s3i7kuqc9u5.fsf@soliton.wins.uva.nl>
>
> I'm not sure whether zeroing out the buffer in store_typed_floating()
> is desirable. I've (almost) convinced myself that it isn't. Here's a
> part of a comment that I added to the doublest.c in my current tree:
>
> /* ...
>
> It is debatable whether we should zero out any remaining
> bytes in the target buffer, when converting from a type that
> has a smaller length than the target type. Right now we
> don't do that. A typical case where this situation arises is
> when we convert a i387 floating-point register to a `long
> double' in memory. On the target, that operation only stores
> the first 10 bytes, and leaves alone the remaining 2 bytes.
> It makes sense to mimick this behaviour here. */
>
> This comment comes from a function convert_floating() that I intend to
> add to doublest.c. I'll submit a patch after you've checked yours in.
Don't forget that the routines are expecting to manipulate a GDB
internal buffer freshly allocated from the heap and not target memory.
Failing to initialize it would leave it containing complete garbage
(perhaphs I should set it to 0xdeadbeef). That garbage would then be
written back to the target since (well from memory) GDB writes all
length bytes from a value buffer.
To ``do the write thing'', I suspect ``struct value'' and the value <->
memory transfer routines would all need to be modified so that they only
write a sub-section of the buffer. Other ideas also come to mind:
edit_typed_floating() that edits an floating point buffer in place; add
an ``old buffer'' parameter that can be used to optionally initialize
unused bytes; or use the raw floatformat routines(1) where needed.
The case that would worry me is with i387 registers. For that, I think
the target should just specify the 10 byte FP type so that GDB won't
touch any padding bytes.
Andrew
(1) Would need to fix the problem of TYPE_FLOATFORMAT not always being
initialized.
next prev parent reply other threads:[~2001-09-23 13:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-20 15:36 Andrew Cagney
[not found] ` <s3i7kuqc9u5.fsf@soliton.wins.uva.nl>
2001-09-23 13:06 ` Andrew Cagney [this message]
2001-09-24 10:21 ` Andrew Cagney
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=3BAE40CB.9080702@cygnus.com \
--to=ac131313@cygnus.com \
--cc=gdb-patches@sources.redhat.com \
--cc=kettenis@science.uva.nl \
/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