Debugging double values, incorrectly reported

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: barthess, RoccoMarco

elagil
Posts: 76
Joined: Tue Sep 19, 2017 7:38 am
Has thanked: 7 times
Been thanked: 5 times

Debugging double values, incorrectly reported

Postby elagil » Thu Jan 23, 2020 12:15 pm

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

rew
Posts: 348
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 12 times

Re: Debugging double values, incorrectly reported

Postby rew » Sat Feb 08, 2020 2:25 pm

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. ).

elagil
Posts: 76
Joined: Tue Sep 19, 2017 7:38 am
Has thanked: 7 times
Been thanked: 5 times

Re: Debugging double values, incorrectly reported

Postby elagil » Mon Feb 10, 2020 12:26 pm

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.


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 8 guests