SDL_UpdateRects crashes on X.org system

Hi all here,

I have a problem with the call of the function SDL_UpdateRects(). The program is running fine but if i run it on an X.org system it crashes with a Segmentation fault. The strange thing is, if i set the DISPLAY variable to an other system the same compilation runs fine. The same is with the other direction if i run the game on an other computer but set the DISPLAY variable to the computer where the game crashes it runs fine. that means it crashes only if i run and play it on the same computer with X.org.

Here is a backtrace dump gdb gave me:

(gdb) run
Starting program: /home/steffen/bomberclone/src/bomberclone

Program received signal SIGSEGV, Segmentation fault.
0x40089a3f in SDL_FreeRW () from /usr/lib/libSDL-1.2.so.0

(gdb) bt

#0 0x40089a3f in SDL_FreeRW () from /usr/lib/libSDL-1.2.so.0
#1 0x40089c3b in SDL_HasMMX () from /usr/lib/libSDL-1.2.so.0
#2 0x40067b8d in SDL_CalculateBlitN () from /usr/lib/libSDL-1.2.so.0
#3 0x4005a765 in SDL_CalculateBlit () from /usr/lib/libSDL-1.2.so.0
#4 0x4006a9d7 in SDL_MapSurface () from /usr/lib/libSDL-1.2.so.0
#5 0x4006ad71 in SDL_LowerBlit () from /usr/lib/libSDL-1.2.so.0
#6 0x4006c286 in SDL_UpdateRects () from /usr/lib/libSDL-1.2.so.0
#7 0x080536cf in gfx_blitupdaterectdraw () at gfxengine.c:52
#8 0x080539d7 in gfx_blitdraw () at gfxengine.c:118
#9 0x080628d9 in menu_loop (menu=0x8167050) at menu.c:529
#10 0x0807766b in playernamemenu () at playermenu.c:448
#11 0x0806c1a4 in config_init (argc=1, argv=0xbffff6a4) at configuration.c:140
#12 0x08049b41 in main (argc=1, argv=0xbffff6a4) at main.c:43

(gdb) frame 7

#7 0x080536cf in gfx_blitupdaterectdraw () at gfxengine.c:52
52 SDL_UpdateRects (gfx.screen, blitrects_nr, blitrects);

(gdb) display blitrects_nr

1: blitrects_nr = 1

(gdb) display *blitrects

2: *blitrects = {x = 0, y = 0, w = 640, h = 480}

(gdb)

I hope someone know what to do because the variables seem to be set right.

have a good time,
Steffen

I have a problem with the call of the function SDL_UpdateRects(). The program is running fine but if i run it on an X.org system it crashes with a Segmentation fault. The strange thing is, if i set the DISPLAY variable to an other system the same compilation runs fine. The same is with the other direction if i run the game on an other computer but set the DISPLAY variable to the computer where the game crashes it runs fine. that means it crashes only if i run and play it on the same computer with X.org.

Here is a backtrace dump gdb gave me:

(gdb) run
Starting program: /home/steffen/bomberclone/src/bomberclone

Program received signal SIGSEGV, Segmentation fault.
0x40089a3f in SDL_FreeRW () from /usr/lib/libSDL-1.2.so.0

(gdb) bt

#0 0x40089a3f in SDL_FreeRW () from /usr/lib/libSDL-1.2.so.0
#1 0x40089c3b in SDL_HasMMX () from /usr/lib/libSDL-1.2.so.0
#2 0x40067b8d in SDL_CalculateBlitN () from /usr/lib/libSDL-1.2.so.0
#3 0x4005a765 in SDL_CalculateBlit () from /usr/lib/libSDL-1.2.so.0
#4 0x4006a9d7 in SDL_MapSurface () from /usr/lib/libSDL-1.2.so.0
#5 0x4006ad71 in SDL_LowerBlit () from /usr/lib/libSDL-1.2.so.0
#6 0x4006c286 in SDL_UpdateRects () from /usr/lib/libSDL-1.2.so.0
#7 0x080536cf in gfx_blitupdaterectdraw () at gfxengine.c:52
#8 0x080539d7 in gfx_blitdraw () at gfxengine.c:118
#9 0x080628d9 in menu_loop (menu=0x8167050) at menu.c:529
#10 0x0807766b in playernamemenu () at playermenu.c:448
#11 0x0806c1a4 in config_init (argc=1, argv=0xbffff6a4) at configuration.c:140
#12 0x08049b41 in main (argc=1, argv=0xbffff6a4) at main.c:43

Try grabbing the latest CVS snapshot and building it on your computer.
http://www.libsdl.org/cvs/SDL-1.2.tar.gz
It looks like your version of SDL might be using bad MMX instructions.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sam Lantinga wrote:

#0 0x40089a3f in SDL_FreeRW () from /usr/lib/libSDL-1.2.so.0
#1 0x40089c3b in SDL_HasMMX () from /usr/lib/libSDL-1.2.so.0
#2 0x40067b8d in SDL_CalculateBlitN () from /usr/lib/libSDL-1.2.so.0
#3 0x4005a765 in SDL_CalculateBlit () from /usr/lib/libSDL-1.2.so.0
#4 0x4006a9d7 in SDL_MapSurface () from /usr/lib/libSDL-1.2.so.0
#5 0x4006ad71 in SDL_LowerBlit () from /usr/lib/libSDL-1.2.so.0
#6 0x4006c286 in SDL_UpdateRects () from /usr/lib/libSDL-1.2.so.0
#7 0x080536cf in gfx_blitupdaterectdraw () at gfxengine.c:52
#8 0x080539d7 in gfx_blitdraw () at gfxengine.c:118
#9 0x080628d9 in menu_loop (menu=0x8167050) at menu.c:529
#10 0x0807766b in playernamemenu () at playermenu.c:448
#11 0x0806c1a4 in config_init (argc=1, argv=0xbffff6a4) at configuration.c:140
#12 0x08049b41 in main (argc=1, argv=0xbffff6a4) at main.c:43

Try grabbing the latest CVS snapshot and building it on your computer.
http://www.libsdl.org/cvs/SDL-1.2.tar.gz
It looks like your version of SDL might be using bad MMX instructions.

Hmm, I didn’t get the original post for that one. Is it stuck somewhere ?
An illegal instruction would generate a SIGILL, though. So there’s
probably something else.

Stephane

hi all

about the problem i had, i just had to hear that it was a problem with libsdl and gcc3.4. And that it is fixed already. That was what i have heard from people in #rocklinux channel where i asked some people to test my game.

thanks all
Steffen