Cannot enter floating point (double) numbers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gdb |
Unknown
|
Unknown
|
|||
gdb (Ubuntu) |
New
|
Low
|
Unassigned |
Bug Description
(gdb) show version
GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://
Find the GDB manual and other documentation resources online at:
<http://
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) p 1.0
Invalid number "1.0".
Yet, the latest git (tested 76bd66cfb520713
After further investigation it seems that gdb assumes that floating-point numbers use . as decimal mark, as these lines from c-exp.y show
else if (!got_dot && *p == '.')
got_dot = 1;
but, later, the function parse_float() (in parse.c) feeds the string into sscanf
num = sscanf (copy, "%" DOUBLEST_ SCAN_FORMAT "%n", d, &n);
and, apparently, sscanf is locale-sensitive, so, if the current locale has , as decimal mark, sscanf will leave everything past the . sign unscanned. gdb, then, notices that something is unscanned and says "invalid number"