Post not yet marked as solved
Post marked as unsolved with 1 replies, 743 views
Hi,
I need help with this cryptic error I am having:
After some lib updates, I suddenly experience a segfault error in some of my executable products of my project.
The line of code crashing is simply in the likes of this:
shared_pointer<Object> p = make_shared<Object>(params);
// [ a lot of lines of code and different files later...]
coud << p << endl;
The pointer p appears valid, and lldb provides the following information of it:
p std::__1::shared_ptr<const wolf::StateBlock>::element_type @ 0x0000000102706998 strong=4 weak=2
and I can navigate through all the fields of the pointed Object (of type wolf::StateBlock).
I can "fix" this error with, for example, a cast of the pointer into an unsigned int:
shared_pointer<Object> p = make_shared<Object>(params);
[ a lot of lines of code and different files later...]
unsigned int pui = (unsigned int)p;
coud << pui << endl;
with the result of my code crashing somewhere else with a similar error.
Notes:
The error appears when I compile and execute the code in macOS Monterey.
The same code compiles and runs just fine in Ubuntu.
The error message is:
EXC_BAD_ACCESS (code=1, address=0x50)
The dumped assembler code reads:
7FF81EB1527C: 4C 89 E6 movq %r12, %rsi
7FF81EB1527F: 4C 89 EA movq %r13, %rdx
7FF81EB15282: 4D 89 F0 movq %r14, %r8
7FF81EB15285: 41 FF 51 50 callq *0x50(%r9)
7FF81EB15289: 48 85 C0 testq %rax, %rax
7FF81EB1528C: 75 17 jne 0x7ff81eb152a5 ; <+261>
7FF81EB1528E: 48 8B 03 movq (%rbx), %rax
where the error is at the line 7FF81EB15285: 41 FF 51 50 callq *0x50(%r9)
Crash report