Env: macOS 13.6.4, Xcode 15.2, MBP M1 Pro
I am building/debugging a fairly simple C++ app which is meant to show some basic .dylib functionality. I received the Xcode project/source/libraries, which compile just fine, but when I attempt to run the "debug" version, it crashes before it gets to main():
Debug Navigator:
Thread 1 Queue : com.apple.main-thread (serial)
#0 0x0000000192544704 in __pthread_kill ()
#1 0x00000001049cab84 in pthread_kill ()
#2 0x0000000192489ae8 in abort ()
#3 0x00000002210fe948 in __report_load.cold.1 ()
#4 0x00000002210fe638 in __report_load ()
#5 0x00000001922401d8 in invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const::$_0::operator()() const ()
#6 0x0000000192281e94 in invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const ()
#7 0x00000001922751a4 in invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const ()
#8 0x00000001922202d8 in dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const ()
#9 0x00000001922741cc in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const ()
#10 0x0000000192281958 in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const ()
#11 0x000000019223c85c in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const ()
#12 0x000000019223cc10 in dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const ()
#13 0x000000019223cbec in dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const ()
#14 0x000000019223cbec in dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&) const ()
#15 0x0000000192240264 in dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_1::operator()() const ()
#16 0x000000019223cd90 in dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const ()
#17 0x0000000192260984 in dyld4::APIs::runAllInitializersForMain() ()
#18 0x00000001922252d0 in dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) ()
#19 0x0000000192223e18 in start ()
Thread 2 Queue : com.apple.CoreAnalytics::Client XPC Send (serial)
#0 0x0000000104bd50d4 in _dispatch_introspection_continuation_get_info ()
#1 0x0000000104bd667c in _dispatch_introspection_queue_item_dequeue_hook ()
#2 0x0000000104b9fbe0 in _dispatch_lane_serial_drain ()
#3 0x0000000104ba0d8c in _dispatch_lane_invoke ()
#4 0x0000000104bb0954 in _dispatch_workloop_worker_thread ()
#5 0x00000001049cbcc8 in _pthread_wqthread ()
And in the code window (Thread 1: signal SIGABRT at the line with the arrow):
libsystem_kernel.dylib`:
0x1925446fc <+0>: mov x16, #0x148
0x192544700 <+4>: svc #0x80
-> 0x192544704 <+8>: b.lo 0x192544724 ; <+40>
0x192544708 <+12>: pacibsp
0x19254470c <+16>: stp x29, x30, [sp, #-0x10]!
0x192544710 <+20>: mov x29, sp
0x192544714 <+24>: bl 0x19253c8a8 ; cerror_nocancel
0x192544718 <+28>: mov sp, x29
0x19254471c <+32>: ldp x29, x30, [sp], #0x10
0x192544720 <+36>: retab
0x192544724 <+40>: ret
I am not that familiar with Xcode debugging - where can I look to find why findAndRunAllInitializers()
is failing?