this quite complicated post. have simple app made in haxe. app being converted c++ hxcpp, automated tool used compile , deploy app on different systems transcompiling haxe code c++.
this same app, when compiled windows or linux works fine. when compiled osx throws error inside system library.
there's long thread on github.
the summary reason cannot understand, code serializes structure string (it's recursive function) making snprintf() throw exception no apparent reason.
the stack trace following:
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 '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 debugging server @ localhost:6972. process 9216 stopped * thread #2: tid = 0xee65, 0x00007fff96d94d6d libsystem_c.dylib`_vsnprintf + 20, stop reason = exc_bad_access (code=2, address=0x102100f68) frame #0: 0x00007fff96d94d6d libsystem_c.dylib`_vsnprintf + 20 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: not load objective-c class information. reduce 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 #0: 0x00007fff96d94d6d libsystem_c.dylib`_vsnprintf + 20 frame #1: 0x00007fff96d9500c libsystem_c.dylib`vsnprintf_l + 41 frame #2: 0x00007fff96d853b2 libsystem_c.dylib`snprintf + 188 frame #3: 0x000000010041da73 snow_empty`string::string(this=0x00000001021014c0, inrhs=0x0000000100d3710c) + 83 @ string.cpp:311 frame #4: 0x000000010041dbcd snow_empty`string::string(this=0x00000001021014c0, inrhs=0x0000000100d3710c) + 29 @ string.cpp:309 frame #5: 0x0000000100417aa3 snow_empty`hx::intdata::tostring(this=0x0000000100d37104) + 35 @ dynamic.cpp:55 frame #6: 0x000000010036b779 snow_empty`std_obj::string(s=dynamic @ 0x00000001021014b8) + 361 @ std.cpp:67 frame #7: 0x000000010036a0fb snow_empty`stringbuf_obj::add(this=0x0000000100e40a18, x=dynamic @ 0x0000000102101690) + 315 @ stringbuf.cpp:44 frame #8: 0x00000001002ac50a snow_empty`haxe::serializer_obj::serializestring(this=0x0000000100e409ec, s=(length = 20, __s = "snow%2fapi%2flibs.hx")) + 1530 @ serializer.cpp:123 frame #9: 0x00000001002ae8a9 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102104958) + 4409 @ serializer.cpp:300 frame #10: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102107128) + 34688 @ serializer.cpp:796 frame #11: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021098f8) + 34688 @ serializer.cpp:796 frame #12: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010210c0c8) + 34688 @ serializer.cpp:796 frame #13: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010210e898) + 34688 @ serializer.cpp:796 frame #14: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102111068) + 34688 @ serializer.cpp:796 frame #15: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102113838) + 34688 @ serializer.cpp:796 frame #16: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102116008) + 34688 @ serializer.cpp:796 frame #17: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021187d8) + 34688 @ serializer.cpp:796 frame #18: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010211afa8) + 34688 @ serializer.cpp:796 frame #19: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010211d778) + 34688 @ serializer.cpp:796 frame #20: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010211ff48) + 34688 @ serializer.cpp:796 frame #21: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102122718) + 34688 @ serializer.cpp:796 frame #22: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102124ee8) + 34688 @ serializer.cpp:796 frame #23: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021276b8) + 34688 @ serializer.cpp:796 frame #24: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102129e88) + 34688 @ serializer.cpp:796 frame #25: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010212c658) + 34688 @ serializer.cpp:796 frame #26: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010212ee28) + 34688 @ serializer.cpp:796 frame #27: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021315f8) + 34688 @ serializer.cpp:796 frame #28: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102133dc8) + 34688 @ serializer.cpp:796 frame #29: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102136598) + 34688 @ serializer.cpp:796 frame #30: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102138d68) + 34688 @ serializer.cpp:796 frame #31: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010213b538) + 34688 @ serializer.cpp:796 frame #32: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010213dd08) + 34688 @ serializer.cpp:796 frame #33: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021404d8) + 34688 @ serializer.cpp:796 frame #34: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102142ca8) + 34688 @ serializer.cpp:796 frame #35: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102145478) + 34688 @ serializer.cpp:796 frame #36: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102147c48) + 34688 @ serializer.cpp:796 frame #37: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010214a418) + 34688 @ serializer.cpp:796 frame #38: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010214cbe8) + 34688 @ serializer.cpp:796 frame #39: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010214f3b8) + 34688 @ serializer.cpp:796 frame #40: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102151b88) + 34688 @ serializer.cpp:796 frame #41: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102154358) + 34688 @ serializer.cpp:796 frame #42: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102156b28) + 34688 @ serializer.cpp:796 frame #43: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021592f8) + 34688 @ serializer.cpp:796 frame #44: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010215bac8) + 34688 @ serializer.cpp:796 frame #45: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010215e298) + 34688 @ serializer.cpp:796 frame #46: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102160a68) + 34688 @ serializer.cpp:796 frame #47: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102163238) + 34688 @ serializer.cpp:796 frame #48: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102165a08) + 34688 @ serializer.cpp:796 frame #49: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021681d8) + 34688 @ serializer.cpp:796 frame #50: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010216a9a8) + 34688 @ serializer.cpp:796 frame #51: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010216d178) + 34688 @ serializer.cpp:796 frame #52: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010216f948) + 34688 @ serializer.cpp:796 frame #53: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102172118) + 34688 @ serializer.cpp:796 frame #54: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021748e8) + 34688 @ serializer.cpp:796 frame #55: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x00000001021770b8) + 34688 @ serializer.cpp:796 frame #56: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102179888) + 34688 @ serializer.cpp:796 frame #57: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010217c058) + 34688 @ serializer.cpp:796 frame #58: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x000000010217e828) + 34688 @ serializer.cpp:796 frame #59: 0x00000001002b5ef0 snow_empty`haxe::serializer_obj::serialize(this=0x0000000100e409ec, v=dynamic @ 0x0000000102180710) + 34688 @ serializer.cpp:796 frame #60: 0x00000001002b6747 snow_empty`haxe::serializer_obj::run(v=dynamic @ 0x0000000102180980) + 423 @ serializer.cpp:842 frame #61: 0x00000001002e4f30 snow_empty`debugger::haxeprotocol_obj::writedynamic(output=(mptr = 0x0000000100e36cd0), value=dynamic @ 0x0000000102180a98) + 304 @ haxeprotocol.cpp:237 frame #62: 0x00000001002e56e4 snow_empty`debugger::haxeprotocol_obj::writemessage(output=(mptr = 0x0000000100e36cd0), message=debugger::message @ 0x0000000102180cb0) + 340 @ haxeprotocol.cpp:148 frame #63: 0x00000001002df947 snow_empty`debugger::haxeremote_obj::writethreadloop(this=0x0000000100e36be8) + 759 @ haxeremote.cpp:233 frame #64: 0x00000001002e1a09 snow_empty`debugger::haxeremote_obj::__construct(this=0x0000000100e36fc8)::_function_1_1::run() + 217 @ haxeremote.cpp:75 frame #65: 0x00000001002e18f3 snow_empty`debugger::haxeremote_obj::__construct(this=0x0000000100e36fc8)::_function_1_1::__run() + 35 @ haxeremote.cpp:79 frame #66: 0x00000001003eb018 snow_empty`hxthreadfunc(ininfo=0x0000000100e36fdc) + 184 @ thread.cpp:255 frame #67: 0x00007fff8dbac05a libsystem_pthread.dylib`_pthread_body + 131 frame #68: 0x00007fff8dbabfd7 libsystem_pthread.dylib`_pthread_start + 176 frame #69: 0x00007fff8dba93ed libsystem_pthread.dylib`thread_start + 13 (lldb)
i tried inspecting variables function calling snprintf() boils down this:
typedef char buf[100]; snprintf(buf, 100, "%d", 12);
where 12
int being passed function (it's length of string it's serializing)
since snprintf on osx uses vsnprintf internally ventured rewriting in own code check parameters passed , if ok:
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)); }
and in fact seems fine. still crashes in inner libsystem_c.dylib
_vsnprintf`. cannot understand what's going on , why happening on osx , not on other systems.
this original offending code. i'm open suggestion try , narrow down issue.
Comments
Post a Comment