games/mirrormagic crashes on start

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

games/mirrormagic crashes on start

Klemens Nanni-2
There are only two duplicate symbols so it might be an easy fix
(FreeBSD still packages 2.0.2, FWIW) but the game reproducibly crashes
for me on startup on amd64;  here's a debug build with `COPTS=-fcommon':

        Program terminated with signal SIGSEGV, Segmentation fault.
        #0  0x00000b0f4be95937 in SDL_DestroyTexture_REAL ()
           from /usr/local/lib/libSDL2.so.0.9
        [Current thread is 1 (process 477861)]
        (gdb) bt
        #0  0x00000b0f4be95937 in SDL_DestroyTexture_REAL ()
           from /usr/local/lib/libSDL2.so.0.9
        #1  0x00000b0c85304c9b in SDLFreeBitmapTextures (bitmap=<optimized out>) at sdl.c:486
        #2  0x00000b0c852f1f48 in FreeImageTextures (pos=2245) at image.c:380
        #3  FreeAllImageTextures () at image.c:391
        #4  0x00000b0c8524a114 in InitImageTextures () at init.c:266
        #5  0x00000b0c8526cf95 in ChangeViewportPropertiesIfNeeded () at tools.c:9311
        #6  0x00000b0c8526f29c in DrawMainMenu () at screens.c:1531
        #7  0x00000b0c852528d3 in OpenAll () at init.c:6080
        #8  0x00000b0c85249991 in main (argc=<optimized out>, argv=<optimized out>) at main.c:7758

It briefly shows a window that looks like a loading screen, things move
but then it segfaults after about a second.

Cc'ing people since this might be a regression somewhere:

        revision 1.11
        date: 2019/03/14 13:58:56;  author: bcallah;  state: Exp;  lines: +25 -16;  com     17 mitid: TzjgHRY6EiIvDZYF;
        Update to mirrormagic-3.0.0
        Moves to SDL2, among other updates.

        ok bentley@ kirby@

Reply | Threaded
Open this post in threaded view
|

Re: games/mirrormagic crashes on start

Brian Callahan-6
On Tuesday, February 16th, 2021 at 6:37 PM, Klemens Nanni <[hidden email]> wrote:

> There are only two duplicate symbols so it might be an easy fix
>
> (FreeBSD still packages 2.0.2, FWIW) but the game reproducibly crashes
>
> for me on startup on amd64; here's a debug build with `COPTS=-fcommon':
>
> Program terminated with signal SIGSEGV, Segmentation fault.
>
> #0 0x00000b0f4be95937 in SDL_DestroyTexture_REAL ()
>
> from /usr/local/lib/libSDL2.so.0.9
>
> [Current thread is 1 (process 477861)]
>
> (gdb) bt
>
> #0 0x00000b0f4be95937 in SDL_DestroyTexture_REAL ()
>
> from /usr/local/lib/libSDL2.so.0.9
>
> #1 0x00000b0c85304c9b in SDLFreeBitmapTextures (bitmap=<optimized out>) at sdl.c:486
>
>     #2  0x00000b0c852f1f48 in FreeImageTextures (pos=2245) at image.c:380
>     #3  FreeAllImageTextures () at image.c:391
>     #4  0x00000b0c8524a114 in InitImageTextures () at init.c:266
>     #5  0x00000b0c8526cf95 in ChangeViewportPropertiesIfNeeded () at tools.c:9311
>     #6  0x00000b0c8526f29c in DrawMainMenu () at screens.c:1531
>     #7  0x00000b0c852528d3 in OpenAll () at init.c:6080
>     #8  0x00000b0c85249991 in main (argc=<optimized out>, argv=<optimized out>) at main.c:7758
>
>
> It briefly shows a window that looks like a loading screen, things move
>
> but then it segfaults after about a second.
>

Does the update I posted a few days back help?
https://marc.info/?l=openbsd-ports&m=161332490221938&w=2

The update works on my amd64 machine.

~Brian

Reply | Threaded
Open this post in threaded view
|

Re: games/mirrormagic crashes on start

Klemens Nanni-2
On Wed, Feb 17, 2021 at 12:33:58AM +0000, Brian Callahan wrote:
> Does the update I posted a few days back help?
> https://marc.info/?l=openbsd-ports&m=161332490221938&w=2
>
> The update works on my amd64 machine.
No, it still crashes right away on my X230 (default `vm.malloc_conf').

Here's full output of `mirrormagic -v --debug' in case it helps plus the
backtrace with your fix on the latest snapshot with latest packages;
I built with DEBUG_PACKAGES=${BUILD_PACKAGES} to install
debug-mirrormagic for egdb:

        $ mirrormagic -v --debug
        mirrormagic: cannot open configuration file '/home/kn/.mirrormagic/setup.conf'
        mirrormagic: using default setup values
        mirrormagic: cannot open configuration file '/home/kn/.mirrormagic/autosetup.conf'
        mirrormagic: Using private, single-user scores directory.
        mirrormagic: warning: configuration file '/home/kn/.mirrormagic/cache/artworkinfo.cache' is empty
        mirrormagic: warning: no game controller base mappings found
        mirrormagic: cannot open configuration file '/home/kn/.mirrormagic/levelsetup.conf'
        mirrormagic: using default setup values
        mirrormagic: cannot open configuration file '/home/kn/.mirrormagic/levelsetup/classic_deflektor/levelsetup.conf'
        mirrormagic: using default setup values
        -------------------------------------------------------------------------------
        mirrormagic: dynamic token(s) found in config file:
        mirrormagic: - config file: '/usr/local/share/mirrormagic/graphics/gfx_mirrormagic/graphicsinfo.conf'
        mirrormagic: - dynamic token: 'font.text_1.INFO'
        mirrormagic: - dynamic token: 'font.text_1.INFO.x'
        mirrormagic: - dynamic token: 'font.text_1.INFO.y'
        mirrormagic: - dynamic token: 'font.text_1.INFO.width'
        mirrormagic: - dynamic token: 'font.text_1.INFO.height'
        mirrormagic: - dynamic token: 'font.text_4.INFO'
        mirrormagic: - dynamic token: 'font.text_4.INFO.x'
        mirrormagic: - dynamic token: 'font.text_4.INFO.y'
        mirrormagic: - dynamic token: 'font.text_4.INFO.width'
        mirrormagic: - dynamic token: 'font.text_4.INFO.xoffset'
        mirrormagic: - dynamic token: 'font.text_4.INFO.height'
        -------------------------------------------------------------------------------
        mirrormagic: cannot open configuration file '/home/kn/.mirrormagic/editorcascade.conf'
        mirrormagic: cannot open configuration file '/home/kn/.mirrormagic/editorsetup.conf'

        $ egdb --quiet mirrormagic mirrormagic.core
        Reading symbols from mirrormagic...Reading symbols from /usr/local/bin/.debug/mirrormagic.dbg...done.
        [New process 523646]
        [New process 448942]
        Core was generated by `mirrormagic'.
        Program terminated with signal SIGSEGV, Segmentation fault.
        #0  0x0000062c6b061937 in SDL_DestroyTexture_REAL () from /usr/local/lib/libSDL2.so.0.9
        [Current thread is 1 (process 523646)]
        (gdb) bt
        #0  0x0000062c6b061937 in SDL_DestroyTexture_REAL () from /usr/local/lib/libSDL2.so.0.9
        #1  0x0000062982980c89 in SDLFreeBitmapTextures (bitmap=0x62c6e2e5480) at sdl.c:484
        #2  0x000006298296df48 in FreeImageTextures (pos=8) at image.c:380
        #3  FreeAllImageTextures () at image.c:391
        #4  0x00000629828c6114 in InitImageTextures () at init.c:266
        #5  0x00000629828e8f95 in ChangeViewportPropertiesIfNeeded () at tools.c:9311
        #6  0x00000629828eb29c in DrawMainMenu () at screens.c:1531
        #7  0x00000629828ce8d3 in OpenAll () at init.c:6080
        #8  0x00000629828c5991 in main (argc=<optimized out>, argv=<optimized out>) at main.c:7758

Since it crashes at texture handling, I poked around a bit:

        (gdb) fr 1
        (gdb) p *bitmap
        $1 = {
          source_filename = 0x62c5efa8a00 "/usr/local/share/mirrormagic/graphics/gfx_classic/RocksElements.png",
          width = 512, height = 480, surface = 0x62c5efa8880, surface_masked = 0x62c5efa8c00,
          texture = 0x62bc748d900, texture_masked = 0x62c31a91a00}

        (gdb) p bitmap->texture
        $2 = (SDL_Texture *) 0x62bc748d900
        (gdb) p *bitmap->texture
        $3 = <incomplete type>

Looking at  /usr/local/include/SDL2/SDL_render.h:

        /**
         *  \brief An efficient driver-specific representation of pixel data
         */
        struct SDL_Texture;
        typedef struct SDL_Texture SDL_Texture;

SDL seems to omit the struct definition, so I try printing it as
something to see if the pointer is valid:

        (gdb) p (char)*bitmap->texture
        Cannot access memory at address 0x62bc748d900

So perhaps some texture corruption or its memory already being freed at
this point? `texture_masked' has something in memory at least:

        (gdb) p bitmap->texture_masked
        $4 = (SDL_Texture *) 0x62c31a91a00
        (gdb) p *bitmap->texture_masked
        $5 = <incomplete type>
        (gdb) p (char)*bitmap->texture_masked
        $6 = -128 '\200'

I don't know stuff about SDL, mirrormagic or game textures... this is
really just stabbing around in the dark.