Question

On my linux machine, evaluating a floater larger than FLT_MAX results in infinity, as shown below:

sacha@sacha-XPS13:~$ gdb 
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) p 1e39f
$1 = inf
(gdb)

Question: Why isn't it the same when using the android NDK? As you can see below, it wraps around instead of returning infinity:

sacha@sacha-XPS13:~$ ~/lib/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb
GNU gdb (GDB) 7.3.1-gg2
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "--host=x86_64-linux-gnu --target=arm-linux-android".
For bug reporting instructions, please see:
<http://source.android.com/source/report-bugs.html>.
(gdb) p 1e39f
$1 = -5.5173927e-39
(gdb) 
Was it helpful?

Solution

Stock gdb before 7.6 has the same issue until it's fixed by this patch. Fix in gdb-7.3.x in NDK is tracked here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top