Debugging ET:Legacy and SDL for an access violation
Most of my day today went to debugging an ET:Legacy crash issue, which I found to be happening within the SDL library.
ET:Legacy, a community continuation of the development of the Wolfenstein: Enemy Territory source code recently released its first stable version 2.71. I was already using and recommending the pre-releases 2.71 RC4, as a lot of improvements were already in there. Especially for ATI users with driver issues with older OpenGL versions like W:ET uses – causing low and inconsistent FPS – could be solved by using ET:L.
Surprisingly, from RC4 to release version, they made a switch from SDL1 to SDL2 (now that was not really an release candidate then). This obviously changed some stuff. And one of those things was that I was not able to start ET:L any more.
The ET:L README provides compilation instruction which made it pretty easy to set up a build and development environment locally – even though the instructions themselves were not really optimal (with multiple alternatives).
Once compiled, using Visual Studio and attaching its debugger to the running process made it possible to debug – even without a (VS) project file. This gave first clues, but did not provide an SDL stack trace, where the access violation was thrown.
The SDL2 sources provide a file VisualC.html which contain instructions for compilation, which also made it pretty easy to compile a debug DLL with. I was then able to just replace the ET:L SDL library files, recompile, and debug again. Now with a complete stack trace.
I created an ET:L bug ticket with my findings.
Subsequently, I created a minimal program that would still cause the access violation in SDL. This made it pretty clear, that it’s an issue with SDL itself. I thus created a bug ticket on the SDL bug tracker.
Talking with some of the people from ET:L and SDL live on IRC freenode was good as well of course. Especially since I’m not familiar with SDL, and what it actually guarantees or is robust against, or what it expects the user to just do correctly or in the correct order.
I also love that my Visual Studio installation is no longer a feature-reduced cripple “community edition”, but a full featured one – after their licensing policy change last year.
It took me several hours to work on this, but I got to know the SDL a bit, just as ET:L, and maybe this is a start for a more productive week. I have been wanting to program on FOSS projects (in my free time) again for a long time now, but time is limited. Maybe this week I can still get some of my stuff for Mumble done.