public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Enze Li <enze.li@hotmail.com>
To: Tom Tromey <tom@tromey.com>
Cc: Enze Li via Gdb-patches <gdb-patches@sourceware.org>,
	schwab@linux-m68k.org,  enze.li@gmx.com
Subject: Re: [PATCH v2] gdb: add a numeric check after the exponent (PR cli/24124)
Date: Thu, 22 Sep 2022 22:09:18 +0800	[thread overview]
Message-ID: <OS3P286MB215280F9135C41BEDBB2B684F04E9@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <875yhg38bm.fsf@tromey.com> (Tom Tromey's message of "Wed, 21 Sep 2022 12:12:45 -0600")

Hi Tom,

Thanks for your review.  A few questions, please see below.

On Wed, Sep 21 2022 at 12:12:45 PM -0600, Tom Tromey wrote:

>>>>>> Enze Li via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>> PR cli/24124 points out that `b *804874d` or `b *804874f` gives output
>> `Invalid number "804874d".` or `Invalid number "804874f".`  And the
>> output of `b *804874e` is `Breakpoint 1 at 0xc480a`.
>
> Thank you for the patch.
>
>> That is to say, when "e" or "E" appears after a decimal value, it will
>> be incorrectly parsed as a floating point number.  Importantly, this
>> parsing is not consistent with the C language.
>
> I suspect the change has to be in c-exp.y:parse_number, in order to
> support the case where the input radix is 16.  In this situation,
                                            ^^
Sorry, I didn't get that.  Shouldn't this radix be 10?

> something like "80e" is a valid number.

If the radix is 16, is that mean that we should treat the "80" as a hex
number, and "80e" equals "128e0"(radix is 10)?

>
> The input radix seems like a misfeature, IMNSHO, but I think people do
> actually use it.

In addition, do these test cases below meet expectations?
......
+    gdb_test "break *804874d" "Invalid number.*" "804874d is an invalid number"
+    gdb_test "break *804874e" "Invalid number.*" "804874e is an invalid number"
+    gdb_test "print 80d" "Invalid number.*" "(print) 80d is an invalid number"
+    gdb_test "ptype 80d" "Invalid number.*" "(ptype) 80d is an invalid number"
+    gdb_test "print 80e" "Invalid number.*" "(print) 80e is an invalid number"
+    gdb_test "ptype 80e" "Invalid number.*" "(ptype) 80e is an invalid number"
+    gdb_test "print 80e0" " = 80" "(print) 80e0"
+    gdb_test "print 80e1" " = 800" "(print) 80e1"
+    gdb_test "print 80e+2" " = 8000" "(print) 80e+2"
+    gdb_test "ptype 80e-1" " = double" "(ptype) 80e-1"
......

Thanks,
Enze

  reply	other threads:[~2022-09-22 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-04  8:36 [PATCH] " Enze Li
2022-09-04  8:42 ` Andreas Schwab
2022-09-04 10:01   ` Enze Li
2022-09-05 13:57 ` [PATCH v2] " Enze Li
2022-09-21 18:12   ` Tom Tromey
2022-09-22 14:09     ` Enze Li [this message]
2022-09-23 13:47       ` Tom Tromey
2022-10-02 12:15         ` Enze Li

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=OS3P286MB215280F9135C41BEDBB2B684F04E9@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM \
    --to=enze.li@hotmail.com \
    --cc=enze.li@gmx.com \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@linux-m68k.org \
    --cc=tom@tromey.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).