bmx-ng / sdl.mod

SDL backend for BlitzMax
7 stars 6 forks source link

SDL library update leads to segfault on debug-linux64-builds #15

Closed GWRon closed 5 years ago

GWRon commented 5 years ago

After this commit: https://github.com/bmx-ng/sdl.mod/commit/20437bab7306c68cc3e48ecec3ab1d6253b39a66

I receive segfaults on startup for the linux 64 bit debug builds of test files with graphics output (so as they use the sdl backend - compared to the brl.graphics one in vanilla). Release builds work fine but debug fails in some SDL-X11 code files:


Thread 1 "test.visual.off" received signal SIGSEGV, Segmentation fault.
X11_InitModes (_this=_this@entry=0x173e7a0)
    at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/video/x11/SDL_x11modes.c:609
609        if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) &&
(gdb) bt
#0  X11_InitModes (_this=_this@entry=0x173e7a0)
    at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/video/x11/SDL_x11modes.c:609
#1  0x0000000000c9c5a0 in X11_VideoInit (_this=0x173e7a0)
    at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/video/x11/SDL_x11video.c:441
#2  0x0000000000c6950e in SDL_VideoInit_REAL (
    driver_name=driver_name@entry=0x0)
    at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/video/SDL_video.c:532
#3  0x0000000000c4a427 in SDL_InitSubSystem_REAL (flags=16416)
    at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/SDL.c:171
#4  SDL_Init_REAL (flags=<optimized out>)
    at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/sdl.mod/SDL/src/SDL.c:256
#5  0x0000000000bc9069 in __bb_sdl_sdlgraphics_sdlgraphics ()
    at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/sdlgraphics.mod/sdlgraphics.bmx:304
#6  0x0000000000ba9f20 in _bb_sdl_gl2sdlmax2d_main ()
    at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/gl2sdlmax2d.mod/main.bmx:295
#7  0x0000000000b98744 in __bb_sdl_gl2sdlmax2d_gl2sdlmax2d ()
---Type <return> to continue, or q <return> to quit---

eit/Programmieren/Tools/BlitzMaxNG/mod/sdl.mod/gl2sdlmax2d.mod/.bmx/gl2sdlmax2d.bmx.debug.linux.x64.c:7
#8  0x0000000000412068 in _bb_dig_base_util_graphicsmanager_ng () at /home/ronny/Arbeit/Programmieren/Projekte/TVTower.WorkingCopy/TVTower.git/source/Dig/base.util.graphicsmanager.ng.bmx:58
#9  0x00000000004119ab in _bb_dig_base_util_graphicsmanager () at /home/ronny/Arbeit/Programmieren/Projekte/TVTower.WorkingCopy/TVTower.git/source/Dig/.bmx/base.util.graphicsmanager.bmx.debug.linux.x64.c:8
#10 0x000000000040f5ae in _bb_main () at /home/ronny/Arbeit/Programmieren/Projekte/TVTower.WorkingCopy/TVTower.git/tests/test.visual.office.statistics.bmx:380
#11 0x0000000000e46053 in __bb_brl_appstub_appstub () at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/brl.mod/appstub.mod/appstub.bmx:77
#12 0x000000000040ce9f in main () 
GWRon commented 5 years ago

Maybe I am doing something wrong - or it is a different kind of error.

So I reverted back to the commit before - and the app executes "fine" (it takes a long while until the black screen vanishes and the game is show n... maybe because of the following). EXCEPT when I run it through GDB:

[New Thread 0x7fffef70e700 (LWP 8757)]
GL2 (with shaders) Active
GL2 (with shaders) Active
[13:53:22] INFO     | CORE: Starting TVTower, v0.6.2-dev Build "12.01.19 13:33".
[13:53:22] LOAD     | TEVENTMANAGER.INIT(): OK
[New Thread 0x7fffed647700 (LWP 8758)]
[13:53:22] DBG      | SOUNDMANAGER.SETAUDIOENGINE(): initialized with engine "AUTOMATIC".
[13:53:22] DBG      | TSOUNDMANAGER.MUTEMUSIC(): Muting music
[13:53:22] DBG      | TSOUNDMANAGER.MUTESFX(): Muting all sound effects
[13:53:22] DBG      | GRAPHICSMANAGER.INITGRAPHICS(): Initializing graphics.
[13:53:22] DBG      |                               : SetGraphicsDriver "GL2SDL".
GL2 (with shaders) Active
[13:53:23] DBG      |                               : Initialized graphics with "GL2SDL".
[13:53:23] DBG      |                               : Initialized virtual graphics (for optional letterboxes).
[13:53:23] DBG      | APP.CREATE(): Loading base resources.
[13:53:23] DBG      | APP.LOADRESOURCES(): Loading resources from "config/startup.xml".
[New Thread 0x7fffecce6700 (LWP 8759)]
[13:53:23] LOAD     | APP.ONLOADRESOURCE: Loading "default" [bitmapfont]

Thread 1 "TVTower.debug" received signal SIGPWR, Power fail/restart.
0x00007ffff7620c1d in nanosleep () at ../sysdeps/unix/syscall-template.S:84
84  ../sysdeps/unix/syscall-template.S: Datei oder Verzeichnis nicht gefunden.
(gdb) q
A debugging session is active.

    Inferior 1 [process 8751] will be killed.

Quit anyway? (y or n) y

This might be the source of the "delay" until the game screen is shown.

GWRon commented 5 years ago

The "SIGPWR" Error is thrown by some Garbage Collector stuff:

(gdb) bt
#0  0x00007ffff7620c1d in nanosleep () at ../sysdeps/unix/syscall-template.S:84
#1  0x000000000110a855 in GC_lock () at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/brl.mod/blitz.mod/bdwgc/pthread_support.c:2100
#2  0x000000000110cb4d in GC_lock () at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/brl.mod/blitz.mod/bdwgc/pthread_support.c:2052
#3  0x00000000010fa7e5 in GC_disable () at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/brl.mod/blitz.mod/bdwgc/misc.c:1968
#4  0x00000000010f87b5 in bbGCSuspend () at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/brl.mod/blitz.mod/blitz_gc.c:133
#5  0x000000000104c920 in brl_appstub_debugger_mt_stdio_OnDebugLeaveScope () at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/brl.mod/appstub.mod/.bmx/debugger_mt.stdio.bmx.debug.linux.x64.c:1599
#6  0x00000000004a281f in __m_base_util_registry_TRegistryLoader_LoadFromXML_Si (o=0x2673ea0, bbt_file=0x249dd80, bbt_forceDirectLoad=1)
    at /home/ronny/Arbeit/Programmieren/Projekte/TVTower.WorkingCopy/TVTower.git/source/Dig/.bmx/base.util.registry.bmx.debug.linux.x64.c:1148
#7  0x0000000000413c5c in __m_main_TApp_LoadResources_Si (o=0x2655c00, bbt_path=0x1546990 <_s200>, bbt_directLoad=1)
    at /home/ronny/Arbeit/Programmieren/Projekte/TVTower.WorkingCopy/TVTower.git/source/.bmx/main.bmx.debug.linux.x64.c:13098
#8  0x00000000004312ff in _m_main_TApp_Create_TTApp_iiii (bbt_updatesPerSecond=bbt_updatesPerSecond@entry=60, bbt_framesPerSecond=bbt_framesPerSecond@entry=-1, bbt_vsync=bbt_vsync@entry=1, bbt_initializeGUI=bbt_initializeGUI@entry=1)
    at /home/ronny/Arbeit/Programmieren/Projekte/TVTower.WorkingCopy/TVTower.git/source/.bmx/main.bmx.debug.linux.x64.c:12278
#9  0x0000000000498067 in _m_main_StartTVTower (bbt_start=bbt_start@entry=1) at /home/ronny/Arbeit/Programmieren/Projekte/TVTower.WorkingCopy/TVTower.git/source/.bmx/main.bmx.debug.linux.x64.c:48006
#10 0x000000000040d06b in _bb_main () at /home/ronny/Arbeit/Programmieren/Projekte/TVTower.WorkingCopy/TVTower.git/.bmx/TVTower.bmx.console.debug.linux.x64.c:27
#11 0x000000000104c613 in __bb_brl_appstub_appstub () at /home/ronny/Arbeit/Programmieren/Tools/BlitzMaxNG/mod/brl.mod/appstub.mod/.bmx/appstub.bmx.debug.linux.x64.c:8
#12 0x000000000040ceaf in main ()

So it is not related to the SDL error above. Also I get this error for release builds (run through GDB) too.

woollybah commented 5 years ago

Is this still a problem?

GWRon commented 5 years ago

Don't think so... but I am not using the most current bcc/bmk/modules as last tim I checked them the GC changes lead to "random" segfaults in my game.

woollybah commented 5 years ago

Is this still a problem?

GWRon commented 5 years ago

I think it works now ... could recreate or reopen the issue if it pops up again. Thanks for the reminder.