From: Simon Marchi <simark@simark.ca>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Handle half-float in 'x' command
Date: Thu, 2 Mar 2023 16:00:00 -0500 [thread overview]
Message-ID: <82763e1a-2d25-1ab0-ce08-09ce3719faaa@simark.ca> (raw)
In-Reply-To: <87mt4vb19j.fsf@tromey.com>
On 3/2/23 10:50, Tom Tromey wrote:
> Simon> Can you add a comment before the section you added, to indicate what it
> Simon> intends to test?
>
> I mean to say, I did it. Thanks for the review.
Oops, this causes:
p/f *(short *)s^M
$41 = 1.7345e-05^M
(gdb) FAIL: gdb.base/long_long.exp: p/f *(short *)s
x/2hf h^M
0x555555558060 <h>: 1.7345e-05 -0.028046^M
(gdb) FAIL: gdb.base/long_long.exp: x/2hf h
I think it's just the test outcomes that need to be updated.
It goes through that code:
https://gitlab.com/gnutools/binutils-gdb/-/blob/70728e1d396475e8e630bfdd3fb8e8c8211bdbbd/gdb/printcmd.c#L455-464
/* Printing a non-float type as 'f' will interpret the data as if it were
of a floating-point type of the same length, if that exists. Otherwise,
the data is printed as integer. */
char format = options->format;
if (format == 'f' && type->code () != TYPE_CODE_FLT)
{
type = float_type_from_length (type);
if (type->code () != TYPE_CODE_FLT)
format = 0;
}
Before, we didn't find a 2-byte float format, so it was printed as
integers, and now we do, so it's printed as a float. It seems
consistent with the comment in the code.
Simon
prev parent reply other threads:[~2023-03-02 21:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-24 16:38 Tom Tromey
2023-03-02 2:21 ` Simon Marchi
2023-03-02 15:50 ` Tom Tromey
2023-03-02 15:50 ` Tom Tromey
2023-03-02 21:00 ` Simon Marchi [this message]
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=82763e1a-2d25-1ab0-ce08-09ce3719faaa@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).