Page 1 of 1

Debugging double values, incorrectly reported

Posted: Thu Jan 23, 2020 12:15 pm
by elagil
Hello,

I am using an STM32F746 with Chibios 19.1.3 and a J-Link debugger (latest firmware/gdb server) and the latest arm-none-eabi-gdb.

When debugging, I get incorrect double value readout. Integer values are fine, though.

For example, I have a certain variable that reads as follows in gdb:

Code: Select all

p dds.dds_set->fref
$1 = 5.4493361955084617e-315


Especially:

Code: Select all

x/g &(dds.dds_set->fref)
0x20009d90 <dds_set>:   0x41bdcd6500000000


Specifying the size of the value at test does not help:

Code: Select all

x/fg &dds.dds_set->fref
0x20009d90 <dds_set>:   5.4493361955084617e-315


However, I know from caluclations that this value is actually 500e6 in memory. Putting the hex number into a double conversion tool, it indeed reports 500e6.

This is very likely not a ChibiOS problem, but maybe someone still knows a reason.

Compiler options are:

Code: Select all

# Compiler options here.
-O0 -ggdb -fomit-frame-pointer -falign-functions=16 -lm


Thanks in advance,
Adrian

Re: Debugging double values, incorrectly reported

Posted: Sat Feb 08, 2020 2:25 pm
by rew
Could it be an endianness problem? i.e. what does 0x000000065cdbd41 do as a double (in your conversion tool), or what do you get reported if you poke that value into the memory location?

(update: The E-305 sounds awfully close to the E-308 minimum size reported for a double. That would be consistent with a zero exponent part. ).

Re: Debugging double values, incorrectly reported

Posted: Mon Feb 10, 2020 12:26 pm
by elagil
I have already tried swapping endianness for gdb, there is a setting for it, but it did not help. My converter gives me this number for the reordered hex key:
8.438553016e-315 (subnormal number)

It is small but not quite the same. I will try to insert some values into memory later and see what gdb makes out of it.