Closed AeroStun closed 4 years ago
Update: within a single stacktrace, two frames accessing the same address obtain different results
Only possible explanation is that the DLL somehow ends up with a different virtual memory space, but this is supposedly impossible since previous demos have demonstrated that user-code actions can be observed by the main thread
Better yet, with Clang: from a single stack frame, depending on how the pointer to the object is accessed, different results are obtained (see that from the lambda I get a pin_modes
of size 1, and from the global, which points at the same address, I get a pin_modes
of size 0)
Update: tried setting an x86 hardware watchpoint using LLDB on board_info->pins_caps._M_impl._M_start
(yes I use libstdc++), and the watchpoint does not fire
We have reached a whole other level
It only gets better...
For those who don't read hex, basically the memory shows a vector containing one element, but somehow the evaluation (and the runtime code) believes that it reads three consecutive NULLs in memory (which is obviously not the case since otherwise the whole highlighted memory would be full of only 00s)
Have I mentioned that debuggers are useless?
This seems like the definition of an undefined behavior. Is there something that's not initialized perhaps?
Undefined behavior does not affect operator sizeof
since its operands are unevaluated (only the type of the expression is used)
I suspect that LLDB is trying to JIT some of its evaluations with different build options
EDIT: suspicion confirmed: LLDB does seem to be doing some broken dark magic resulting in two completely different evaluation contexts, where one is based on the debug symbols, and the other on some JIT-compiled snippets using the wrong compiler options
Next assumption: broken ABI
CONFIRMED: broken ABI
std::__cxx1998::vector
std::__debug::vector
Morale of the story: too much debugging kills the debugging And second morale is that debuggers can't be trusted since they don't tell the user how they got the results from expression evaluation; only Valgrind stands trustworthy
Direct cause of this CI failure