yeti3d unexplainable segfault


j0e

Member
Joined
Jul 9, 2011
Messages
153
Edit: Thank you for all your help, but it turns out that actually some SDL functions in the main.c file were being redeclared as empty (if that makes sense). Commenting out that bit fixed it, but now I've run into another problem: the program segfaults as soon as it runs. Running it through the debugger produces this:
#0 0x0001c250 in ?? ()
#1 0x0000ad64 in ?? ()
I've read that debugging it can show you where the segfault took place but in this case it seems not to. I have tried putting print statements here and there to find where exactly execution stops, but to no avail. Could anyone provide any help? Again, if you need any code then I will be happy to provide it to you. thank you.
 
 
 

original post said:
 
Hey guys,
I've been fiddling around with Yeti3d pro lately (using the SDL main.c). I'm compiling it with code::blocks and the mingw32 compiler on Windows, and the C development tools package on my Pandora. On Windows, it works perfectly well but on the Pandora it halts at SDL_Init. I modified the SDL initialisation routine to look like this:

Code:
int initsdl = SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_AUDIO);
if (initsdl < 0)
{
    printf("Unable to init SDL: %s (%d)\n", SDL_GetError(), initsdl);
    exit(1);
}
 
and ran the executable again. The only thing that is displayed is "Unable to init SDL:  (-1)", meaning that SDL_GetError() isn't returning anything about what the error may be.
I'm using the cdevtools include and lib files for SDL. Is this a matter of upgrading the SDL binaries on my Pandora? If so, how would I go about doing that?
If you need any code or whatever, just ask. thanks for any help.
 
EDIT: Putting SDL_Init(SDL_TIMER) worked okay (apart from the fact that it couldn't set up the video screen, obviously), and doing SDL_Init(SDL_TIMER|SDL_AUDIO) worked although initialising SDL_Mixer caused a similar error with still nothing being returned by SDL_GetError(). Any mention of SDL_VIDEO in the SDL_Init function causes SDL to not start in the same way as described above.
 
Last edited by a moderator:
I tried your code with cdevtools on my Pandora - it works fine (initsdl is always 0). I've tried other SDL apps before, and I've never had a problem. I suspect it's something your code is doing earlier that is causing the problem.
 
Thank you for all your help, but it turns out that actually some SDL functions in the main.c file were being redeclared as empty (if that makes sense). Commenting out that bit fixed it, but now I've run into another problem: the program segfaults as soon as it runs. Running it through the debugger produces this:

#0 0x0001c250 in ?? ()

#1 0x0000ad64 in ?? ()

I've read that debugging it can show you where the segfault took place but in this case it seems not to. I have tried putting print statements here and there to find where exactly execution stops, but to no avail. Could anyone provide any help? Again, if you need any code then I will be happy to provide it to you. thank you.
 
also, you can try a strace yourprogram   it will show you info of the call stack at the segfault. And don't forget to compile with "-g" so have debug information.

It can be tricky sometimes, for example, for Cannonball, I had to rename an array called "connect" in the ym2151 emulator, because SDL would try to call this connect instead of the X11 one...
 
Last edited by a moderator:
okey, generated 3 "strace ./yeti3d" files: 1 is a direct strace ./yeti3d, 2 and 3 are using modified scripts from other games that change LD_LIBRARY_PATH etc.
 

Attachments

  • str.txt
    79.2 KB · Views: 230
  • str2.txt
    3.9 KB · Views: 245
  • str3.txt
    115.2 KB · Views: 226
Last edited by a moderator:
Hum, try to disable sound first. I had some bad experience with SDL Sound lately. See if it segfault or not without sound.

If it segfault, ok, it's something else. Put some Printf in the code to pinpoint the segfaulting function...

If it doesn't segfault, start by trying to enlarge the sound buffer. Do a *5 and see if it runs...
 
I disabled sound by commenting out SDL_INIT_AUDIO and the game still segfaulted ( I edited the code so the menu was visible, but as soon as I pressed "New game" to enter a new game it segfaulted as usual ).

However, I have found a fix to the problem by using the code base of the GP2X port and compiling with the compiler and libraries found in the latest Code::Blocks PND. Thank you for your help, and expect a Yeti3d game in the repo soon... :)
 
Back
Top