GDB cannot evaluate hexadecimal floating-point numbers with negative exponent
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gdb (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Trying to print a hexadecimal floating-point number evaluates to a wrong double.
This makes fp-based programs harder to debug.
In the example below, the parser seems to recognize 0xa.0p as (double)10 and 4 as an int, and a subtraction '-', thus the result '6'.
GNU gdb (Ubuntu 7.7.1-0ubuntu5~
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) print /f 0xa.0p-4
$1 = 6
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: gdb 7.7.1-0ubuntu5~
ProcVersionSign
Uname: Linux 3.13.0-49-generic x86_64
NonfreeKernelMo
ApportVersion: 2.14.1-0ubuntu3.10
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Apr 24 15:43:39 2015
InstallationDate: Installed on 2014-11-06 (168 days ago)
InstallationMedia: Ubuntu 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.2)
SourcePackage: gdb
UpgradeStatus: No upgrade log present (probably fresh install)
description: | updated |
A bug was filed on Sourceware Bugzilla for GDB at https:/ /www.sourceware .org/bugzilla/ show_bug. cgi?id= 18318 as it affects GDB 7.9 too.