[PATCH v2] gdb: add a numeric check after the exponent (PR cli/24124)

Tom Tromey tom@tromey.com
Wed Sep 21 18:12:45 GMT 2022


>>>>> 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,
something like "80e" is a valid number.

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

Tom


More information about the Gdb-patches mailing list