🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

TestExceptionMemory fails on Linux

Started by
13 comments, last by dkrusu 8 years, 11 months ago

I recently switched my laptop to Fedora 22 and it also fails this test:http://pastebin.com/zYddH5vg, I'm not seeing a easy way to install older GCC versions in Fedora like you can in Ubuntu, if I figure out a way I'll test with older versions (specifically 4.8.x which works for you).

Advertisement

Interesting. Perhaps it is just RedHat that is doing something differently then.

Hopefully when I figure out the solution for the problem on Ubuntu it will work for Fedora as well.

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

I've identified what it is that causes the crash on Ubuntu.

The following line in the inline assembler code in X64_CallFunction is the cause:


" .cfi_def_cfa_register r15 \n"

Unfortunately I can't just remove this line, because that causes the crash to happen on RedHat instead.

I'm still trying to figure out how to determine when the line must be included and when not.

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

It turns out that it wasn't something specific to Ubuntu or RedHat after all.

Instead it was caused by compiler optimization. By default the library is built without any optimizations, but with my tests on RedHat I had turned on the optimizations some time back and forgotten about it. Turning off the optimization caused the problem to happen on RedHat too with the original code. Once I figured this out the solution was simple:


#ifdef __OPTIMIZE__
// Make sure the stack unwind logic knows we've backed up the stack pointer in register r15
// This should only be done if any optimization is done. If no optimization (-O0) is used,
// then the compiler already backups the rsp before entering the inline assembler code
" .cfi_def_cfa_register r15 \n"
#endif

Now everything works with or without optimizations turned on, and on both Ubuntu and RedHat. (Most likely it will work on Fedora too)

The fix is available in revision 2197.

Thanks for letting me access your Ubuntu machine. Without it I would most likely not have figured it out.

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

Thanks, it works on Fedora 22, all tests pass. Anytime you need access just use the same login, if it's down for some reason PM me.

This topic is closed to new replies.

Advertisement