Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Mac OS X 32-bits crash


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
28 replies to this topic

#21 m4ttbush   Members   -  Reputation: 125

Like
0Likes
Like

Posted 12 April 2012 - 11:14 AM

Unfortunately removing the UNUSED_VAR macros doesn't help.

Are you sure it's not passing the address of the parameter?
It looks correct here:
http://snag.gy/q98dS.jpg

Down the bottom of the image you can see that
&args is 0xbffff294
&paramSize is 0xbffff290 (-4)
and &func is 0xbffff28c (-8)
And edx seems to be set to 0xbffff294.

Thanks for your help, and no rush, 1.22.1 is still working.
And the mac build of Dustforce isn't out for another 3 weeks :P

Sponsor:

#22 Andreas Jonsson   Moderators   -  Reputation: 3061

Like
0Likes
Like

Posted 12 April 2012 - 11:45 AM

Yes, I'm sure. The paramSize should be at an address 4 bytes higher than args not lower.

You're seeing the addresses of the local variables, and not the arguments. If the local variables had been layed out in the same order as the arguments then it would still have worked, but unfortunately the order was inverted inverted.



AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#23 m4ttbush   Members   -  Reputation: 125

Like
0Likes
Like

Posted 12 April 2012 - 09:17 PM

Ah, you're right. If I put the function parameters in an array on the stack in the correct order, and pass that array in to the assembly code it works, in debug at least.

#24 Andreas Jonsson   Moderators   -  Reputation: 3061

Like
0Likes
Like

Posted 18 April 2012 - 05:16 PM

I've fixed this problem now in revision 1269. At least the changes I did is working on Linux, but then, it was working before too.

I ended up putting the function arguments in a local array like you did in your test. That is only solution I found that worked for all of the functions. The functions that has fewer arguments could be solved by passing each argument in individual registers, but that would require more changes and would make the code less maintainable.

I'd appreciate it if both Matt and Vasil can confirm that the changes have fixed the problem.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#25 m4ttbush   Members   -  Reputation: 125

Like
0Likes
Like

Posted 18 April 2012 - 11:57 PM

This is what I'm getting if I run just the native calling convention tests:

Same in debug/release apple/gcc compiler

AngelScript version: 2.23.1 WIP
AngelScript options: AS_MAC AS_X86
-- TestExecute passed
--- Assert failed ---
func: void ExecuteString()
mdle: ExecuteString
sect: ExecuteString
line: 1
---------------------
Failed on line 76 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp

TestReturn: cfunction didn't return properly

Failed on line 84 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp
--- Assert failed ---
func: void ExecuteString()
mdle: ExecuteString
sect: ExecuteString
line: 1
---------------------
Failed on line 88 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp
--- Assert failed ---
func: void ExecuteString()
mdle: ExecuteString
sect: ExecuteString
line: 1
---------------------
Failed on line 100 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp
Failed on line 248 in /Users/Matt/Downloads/trunk 2/sdk/tests/test_feature/projects/xcode/../../source/test_cdecl_return.cpp
--------------------------------------------
One of the tests failed, see details above.


I'll see if I can get a better idea of what's going wrong, let me know if there's any other information I can give you.

I don't know if you have any interest in upgrading your mac, and please don't feel obligated to do so.
But I just made a small donation on behalf of Hitbox for your contribution to Dustforce, which might help out if you did want to upgrade.

Thanks,
Matt

#26 Andreas Jonsson   Moderators   -  Reputation: 3061

Like
0Likes
Like

Posted 19 April 2012 - 12:07 PM

At least it seems the changes improved things, which shows that we're moving in the right direction.

That the test_cdecl_return test fails tells me that the returned value in the registers EAX:EDX seems to be getting lost for some reason.

Can you provide a new disassembly of the CallCDeclFunction() function and also the CallSystemFunctionNative() function? I'm pretty sure the EAX:EDX is populated correctly, but they are either overwritten with an incorrect value, or never read from. I'm most inclined to believe it is the latter, caused by the fact that the compiler sees that the CallCDeclFunctionQWord function pointer is really pointing to a function that returns void, and therefore ignores the value in EAX:EDX.

If I'm right, I'll probably have to change the inline assembly to store the value of EAX:EDX in a variable and return that value from the CallCDeclFunction, and all the others too.


Thanks a lot for the donation. It is greatly appreciated. Posted Image

Though the Mac is a great computer, the one I have is mostly gathering dust. I only have it because I received it as a donation from a previous AngelScript user on Mac. I only bring it up once in a while to do some tests like these for AngelScript. Given that Apple seems to have changed so much in the way XCode/GCC/Clang/LLVM works it seems it won't be much of use for that either nowadays. For that reason I do not feel inclined to spend money on buying a new Mac as the destiny for it will likely be the same.

I feel we've almost uncovered the problem and once this problem is fixed, there probably won't be any further problems until Apple decides to change things again.

Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#27 Andreas Jonsson   Moderators   -  Reputation: 3061

Like
0Likes
Like

Posted 20 April 2012 - 07:08 PM

I've made some further changes in revision 1277 that I believe will fix the last problems.

I made the changes based on the suspicion that the return value is ignored due to the functions being declared as returning void.

Please give this new version a try and let me know if any problem remains.

Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#28 m4ttbush   Members   -  Reputation: 125

Like
0Likes
Like

Posted 22 April 2012 - 02:50 AM

All of the tests passed with success.


Awesome.

Thanks so much for your help with that, and I'm really glad you got it sorted without having to shell out for a new mac.

#29 Andreas Jonsson   Moderators   -  Reputation: 3061

Like
0Likes
Like

Posted 22 April 2012 - 08:57 AM

Great! Thanks for confirming that the fix works.

And thank you for all the help in finding the problem.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS