I tried to utilize atomic approach, but it seems I did it wrong, as soon as _atomic_report looks to be optimized out anyway (first screenshot). It only shows up if the source data (report) is preserved as a symbol in the binary with my recent approach (second screnshot).
yes, I’d like to be able to see some locals in optimized binary. I use emacs + lldb + openocd. It works great with debug binary, when all symbols in place, but llvm optimizer does its job carefully, so it is tricky to make it keep the symbol with ‘fast’ or ‘small’ target.
of course, I use it. The problem is that llvm’s optimizer may not keep local variables, using general registers for vars, so no memory to refer to and no debug info is required/present in the optimized binary. I struggle to keep selected variables to be kept as memory references. If they are references, debug info (symbol name, mapping, etc.) is kept in binary and available during debug session.
std.mem.doNotOptimizeAway(&report); makes the compiler believe the address of report is used and allocates the variable in memory (because a register does not have an address).