Commit fac6968
fw/services/analytics: actually pack the native heartbeat record
The packed attribute was placed before the struct keyword, where GCC
silently ignores it, so native_heartbeat_record was serialized with
natural alignment (e.g. timestamp at offset 8 instead of 1, plus padding
between every misaligned member). The DLS blob therefore did not match
the compact layout the source implies.
Because the BLE disconnect counters sit at the end of the record, they
absorbed all the upstream offset drift and decoded as garbage (the
ble_disconnect_conn_spvn_tmo_count field in particular). Blobs whose tail
fields happened to be zero still decoded plausibly, masking the issue.
Move the attribute between the struct keyword and the tag using the
PACKED macro so it is honored, yielding the intended compact layout. Add
a static assertion that the record size equals the sum of its members
(computed from analytics.def) to catch any future padding regression.
The record version is left unchanged: decoders resolve the per-build
layout from DWARF via the embedded build_id, so this is not an encoding
scheme change.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>1 parent dacd9d3 commit fac6968
1 file changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
45 | 66 | | |
46 | 67 | | |
47 | 68 | | |
| |||
0 commit comments