I’m trying to debug this function: NavEKF3_core::correctEkfOriginHeight()
from libraries/AP_NavEKF3/AP_NavEKF3_Measurements.cpp file
To learn EK3_OGN_HGT_MASK parameter behavior.
Firstly I thought that this is because I was running SITL from autotests code. So I tried different ways:
Debugging from native gdb + sim_vehicle.py.
Attach from VS Code extentions + sim_vehicle.py
Attach from VS Code + autotest.py
Use gdbserver instead of gdb and attach from other terminal with gdb
Use gdbserver and attach from VS Code.
In all cases I got this weird results:
Variables originHgtObsVar and ratio are <optimized out>
And execution is jumping randomly inside function sometimes. When I use step over or next command from gdb.
Next thing that I did was adding log to the function: