This is a pretty tricky post. I have a simple application made in Haxe. This application is converted to C ++ using hxcpp, which is an automatic tool used to compile and deploy the application on different systems by transcribing Haxe C ++ code.
The same application, when compiled for Windows or Linux, works fine. When compiling for OSX, it throws an error from within the system library.
There is a long thread about it on GitHub .
The summary is that for some reason I cannot understand, the code that serializes the structure for the string (it is a recursive function) makes snprintf () throw an exception for no apparent reason.
The stack trace is as follows:
MBP-di-Valerio:test-snow-empty tanis$ lldb bin/mac64/snow_empty.app/Contents/MacOS/snow_empty
(lldb) target create "bin/mac64/snow_empty.app/Contents/MacOS/snow_empty"
Current executable set to 'bin/mac64/snow_empty.app/Contents/MacOS/snow_empty' (x86_64).
(lldb) run
Process 9216 launched: '/Users/tanis/Documents/test-snow-empty/bin/mac64/snow_empty.app/Contents/MacOS/snow_empty' (x86_64)
Debugger:Starting App side debugger support.
Debugger:Connected to debugging server at localhost:6972.
Process 9216 stopped
* thread
frame
libsystem_c.dylib`_vsnprintf:
-> 0x7fff96d94d6d <+20>: movq %r9, -0x1e8(%rbp)
0x7fff96d94d74 <+27>: movq %r8, %r15
0x7fff96d94d77 <+30>: movq %rcx, %rbx
0x7fff96d94d7a <+33>: movq %rdx, %r14
(lldb) bt
warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.
* thread #2: tid = 0xee65, 0x00007fff96d94d6d libsystem_c.dylib`_vsnprintf + 20, stop reason = EXC_BAD_ACCESS (code=2, address=0x102100f68)
* frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
frame
(lldb)
, , snprintf(), :
typedef char buf[100];
snprintf(buf, 100, "%d", 12);
12 - int, ( , )
snprintf OSX vsnprintf , , , , :
int String::snprintf(char *str,size_t count,const char *fmt,...)
{
va_list ap;
va_start(ap, fmt);
(void) vsnprintf(str, count, fmt, ap);
va_end(ap);
return(strlen(str));
}
. - libsystem_c.dylib _vsnprintf`.
, OSX, .
. , .