ksl
ksl

Reputation: 4719

C++ program crashes before main when run from Xcode (but OK from the command line)

The following program crashes before main is called when run from Xcode 6.3.2 on OS X 10.10.5 (Yosemite) in both debug mode and release mode.

#include <boost/network/uri.hpp>

int main() 
{ 
    boost::network::uri::uri url; 
    url << boost::network::uri::scheme("http"); 
    return 0; 
}

The application uses cpp-netlib v0.11.2. The crash does not occur with cpp-netlib v0.11.0.

Xcode displays a window which states 'Xcode quit unexpectedly', with 3 options - 'Ignore', 'Report' and 'Reopen'. If I select 'Report' then another window opens, which contains more information. I've included a snippet of it below.

Note that the crash does NOT occur if I run the application from the command line.

How do I figure out what the exact cause is?

Process:               Xcode [10190]
Path:                  /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               6.3.2 (7718)
Build Info:            IDEFrameworks-7718000000000000~2
App Item ID:           497799835
App External ID:       812404257
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [10190]
User ID:               501

Date/Time:             2015-11-03 10:47:56.517 +0000
OS Version:            Mac OS X 10.10.5 (14F27)
Report Version:        11
Anonymous UUID:        FC1A7EB1-54F4-E985-58AC-A097ABAD05B9

Sleep/Wake UUID:       E1BB13F1-08A2-47C5-BF97-CF63B595B260

Time Awake Since Boot: 1200000 seconds
Time Since Wake:       1100 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGILL)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
ProductBuildVersion: 6D2105

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8fa364de mach_msg_trap + 10
1   libsystem_kernel.dylib          0x00007fff8fa3564f mach_msg + 55
2   com.apple.CoreFoundation        0x00007fff93e43eb4 __CFRunLoopServiceMachPort + 212
3   com.apple.CoreFoundation        0x00007fff93e4337b __CFRunLoopRun + 1371
4   com.apple.CoreFoundation        0x00007fff93e42bd8 CFRunLoopRunSpecific + 296
5   com.apple.HIToolbox             0x00007fff9829256f RunCurrentEventLoopInMode + 235
6   com.apple.HIToolbox             0x00007fff982922ea ReceiveNextEventCommon + 431
7   com.apple.HIToolbox             0x00007fff9829212b _BlockUntilNextEventMatchingListInModeWithFilter + 71
8   com.apple.AppKit                0x00007fff95e678ab _DPSNextEvent + 978
9   com.apple.AppKit                0x00007fff95e66e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
10  com.apple.dt.DVTKit             0x000000010ce67aaa -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 237
11  com.apple.AppKit                0x00007fff95e5caf3 -[NSApplication run] + 594
12  com.apple.AppKit                0x00007fff95dd9244 NSApplicationMain + 1832
13  libdyld.dylib                   0x00007fff8fac15c9 start + 1

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x00007fff8fa3c232 kevent64 + 10
1   libdispatch.dylib               0x00007fff8e89ca6a _dispatch_mgr_thread + 52

Thread 2:
0   libsystem_kernel.dylib          0x00007fff8fa3651a semaphore_wait_trap + 10
1   libdispatch.dylib               0x00007fff8e8a3b9c _dispatch_group_wait_slow + 218
2   com.apple.CFNetwork             0x00007fff942347be -[NSHost resolveCurrentHostWithHandler:] + 707
3   com.apple.CFNetwork             0x00007fff9423440c __18-[NSHost resolve:]_block_invoke + 298
4   libdispatch.dylib               0x00007fff8e89e323 _dispatch_call_block_and_release + 12
5   libdispatch.dylib               0x00007fff8e899c13 _dispatch_client_callout + 8
6   libdispatch.dylib               0x00007fff8e89d365 _dispatch_queue_drain + 1100
7   libdispatch.dylib               0x00007fff8e89eecc _dispatch_queue_invoke + 202
8   libdispatch.dylib               0x00007fff8e89c6b7 _dispatch_root_queue_drain + 463
9   libdispatch.dylib               0x00007fff8e8aafe4 _dispatch_worker_thread3 + 91
10  libsystem_pthread.dylib         0x00007fff8fdada9d _pthread_wqthread + 729
11  libsystem_pthread.dylib         0x00007fff8fdab3dd start_wqthread + 13

Upvotes: 0

Views: 671

Answers (1)

Dean Michael
Dean Michael

Reputation: 3496

This was caused by very long symbols in debug builds making Xcode fail to load the symbols from the debugger. This has since been fixed in the master branch of the project, and should be fixed in the 0.12.0 release.

Upvotes: 0

Related Questions