Closed vizanto closed 7 years ago
I'm guessing that font->glyphs->__get(character) is returning a
cpp:VirtualArray rather than an Array
Quickly looking at the swflite code - it seems to be strongly typed (from what I can see - unless there is some serialization going on somewhere) so I think I would need a project to reproduce this.
Another possibility would be to try an overnight build, since RC1 is getting a bit old now, eg: http://hxbuilds.s3-website-us-east-1.amazonaws.com/builds/haxe/index.html
On Fri, Aug 26, 2016 at 8:12 PM, Simon Krajewski notifications@github.com wrote:
Assigned #502 https://github.com/HaxeFoundation/hxcpp/issues/502 to @hughsando https://github.com/hughsando.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/HaxeFoundation/hxcpp/issues/502#event-768824739, or mute the thread https://github.com/notifications/unsubscribe-auth/ABlp1mxRIcPrJifbh3t_Q4q-H-0j4I-kks5qjtgggaJpZM4JuBCV .
Nightly versions haxe-3.3.0-rc1-dev-0558013
until and including latest haxe-3.3.0-rc1-dev-05abf4c
fail to compile:
Error: While running :xcrun --sdk macosx10.11 clang++ -I/Users/danny/Development/Laerdal/export_openfl/mac64/cpp/debug/obj/obj/darwin64-debug/__pch/haxe -Iinclude -c -fvisibility=hidden -stdlib=libstdc++ -g -I/usr/local/lib/haxe/lib/hxcpp/git/include -DHX_MACOS -m64 -Wno-parentheses -Wno-null-dereference -Wno-unused-value -Wno-format-extra-args -Wno-bool-conversion -DHXCPP_DEBUG -DHXCPP_M64 -DHXCPP_VISIT_ALLOCS -DHXCPP_API_LEVEL=330 -stdlib=libc++ -x c++ -frtti -Wno-invalid-offsetof ./src/openfl/display3D/Program3D.cpp -o/Users/danny/Development/Laerdal/export_openfl/mac64/cpp/debug/obj/obj/darwin64-debug/18ff17e6_Program3D.o
./src/openfl/display3D/Program3D.cpp:176:72: error: cannot cast from type '::Dynamic' to pointer type '::hx::Object *'
HXDLIN( 102) HX_VARI( ::Dynamic,result) = Dynamic(hx::DynamicPtr(( ( ::hx::Object *)(this2(hx::DynamicPtr(this->_hx___programID->id),i)) )));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
@Simn is this or similar bug already reported somewhere?
With the last haxe-3.3.0-rc1-dev-3e5c08d
nightly that compiles, I have tried to get the vtable information, but am unsure if this is what you mean:
(lldb) expr _g1
(Array<Dynamic>) $0 = {
hx::ObjectPtr<Array_obj<Dynamic> > = {
mPtr = 0x0000000117cfb410
}
}
(lldb) expr font->glyphs->__get(character)
(Dynamic) $1 = {
hx::ObjectPtr<hx::Object> = (mPtr = 0x0000000117cfb410)
}
(lldb) expr font->glyphs->__get(character)->__GetType()
(int) $2 = 5
(lldb) expr font->glyphs->__get(character)->__GetRealObject()->__GetType()
(int) $7 = 5
(lldb) expr _g1->__GetType()
error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=2, address=0x102801790).
The process has been returned to the state before expression evaluation.
the vtable on visual studio is easy - you can just expand the little crosses, and it shows which class the functions are implemented in.
On lldb, I guess it would be a matter of printing the "mPtr" field - but I'm not sure if this shows the contents of the vtable.
On Mon, Aug 29, 2016 at 6:55 PM, Danny Wilson notifications@github.com wrote:
With the last haxe-3.3.0-rc1-dev-3e5c08d nightly that compiles, I have tried to get the vtable information, but am unsure if this is what you mean:
(lldb) expr _g1 (Array
) $0 = { hx::ObjectPtr<Array_obj > = { mPtr = 0x0000000117cfb410 } } (lldb) expr font->glyphs->get(character) (Dynamic) $1 = { hx::ObjectPtrhx::Object = (mPtr = 0x0000000117cfb410) } (lldb) expr font->glyphs->get(character)->GetType() (int) $2 = 5 (lldb) expr font->glyphs->get(character)->GetRealObject()->GetType() (int) $7 = 5 (lldb) expr _g1->__GetType() error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=2, address=0x102801790). The process has been returned to the state before expression evaluation.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/HaxeFoundation/hxcpp/issues/502#issuecomment-243093645, or mute the thread https://github.com/notifications/unsubscribe-auth/ABlp1uuLBBSyqrUPQxjS3LYx4iLg42adks5qkrq7gaJpZM4JuBCV .
Ah you mean this?
(lldb) expr font->glyphs->__get(character).mPtr
(cpp::VirtualArray_obj *) $2 = 0x00000001174fb410
(lldb) expr _g1.mPtr
(cpp::VirtualArray_obj *) $3 = 0x00000001174fb410
Small update: latest nightlies seem to be very much in flux. Can't get the generated C++ to compile with seemingly different errors every other nightly build. :)
haxe-3.3.0-rc1-dev-09af1ee
has issues with cpp.Pointer and friends.
I think this should be fixed in 3.4.
Using Haxe nightly and hxcpp-git (and also with Haxe 3.3.0-RC1) we're getting a strange null pointer on startup:
I've been digging around using lldb to find the cause of this:
So a null pointer to an Enum is being dereferenced...
Jumping up to frames to get into the calling function:
This is the loop generated by openfl/swf that switches on enum values.
For context I've added some more of the generated code here:
Digging around the stack, you can see StaticCast changes the mPtr location:
Calling toString() reveals the enum does exist:
But doesn't with the pointer that was StaticCast:
Am I way off here or is StaticCast broken? @hughsando :)