libretro/tyrquake

Segfaults on Raspberry Pi as of 7a26ad29b54a305aab91e1198548d0892d649a6e

Closed this issue · 2 comments

/opt/retropie/emulators/retroarch/bin/retroarch -L ./tyrquake_libretro.so --config /opt/retropie/configs/quake/retroarch.cfg /home/pi/RetroPie/roms/ports/quake/id1/pak0.pak --verbose

RetroArch [INFO] :: === Build =======================================RetroArch [INFO] :: [CPUID]: Features:
Built: Oct  5 2015
RetroArch [INFO] :: Version: 1.2.2
RetroArch [INFO] :: Git: c6c250b
RetroArch [INFO] :: =================================================
RetroArch [INFO] :: [CPUID]: Features:
RetroArch [INFO] :: Config: appending config "/tmp/retroarch.cfg"
RetroArch [INFO] :: Config: loading config from: /opt/retropie/configs/quake/retroarch.cfg.
RetroArch [INFO] :: Loading dynamic libretro core from: "/home/pi/tyrquake/tyrquake_libretro.so"
RetroArch [INFO] :: Environ SET_VARIABLES.
RetroArch [INFO] :: Environ SET_CONTROLLER_INFO.
RetroArch [INFO] :: Controller port: 1
RetroArch [INFO] ::    RetroPad (ID: 1)
RetroArch [INFO] ::    RetroKeyboard/Mouse (ID: 3)
RetroArch [INFO] :: Remaps: core name: TyrQuake
RetroArch [INFO] :: Remaps: game name: /home/pi/RetroPie/roms/ports/quake/id1/pak0
RetroArch [INFO] :: Remaps: remap directory: /opt/retropie/configs/quake/
RetroArch [INFO] :: Remaps: no game-specific remap found at /opt/retropie/configs/quake/TyrQuake/pak0.rmp
RetroArch [INFO] :: Remaps: no core-specific remap found at /opt/retropie/configs/quake/TyrQuake/TyrQuake.rmp
RetroArch [INFO] :: Version of libretro API: 1
RetroArch [INFO] :: Compiled against API: 1
RetroArch [INFO] :: Environ GET_LOG_INTERFACE.
RetroArch [INFO] :: Content loading skipped. Implementation will load it on its own.
RetroArch [INFO] :: Environ SET_INPUT_DESCRIPTORS:
RetroArch [INFO] ::     RetroPad, User 1, Button "B (bottom)" => "Jump"
RetroArch [INFO] ::     RetroPad, User 1, Button "Y (left)" => "Fire"
RetroArch [INFO] ::     RetroPad, User 1, Button "Select" => "Toggle Run Mode"
RetroArch [INFO] ::     RetroPad, User 1, Button "Start" => "Settings"
RetroArch [INFO] ::     RetroPad, User 1, Button "D-Pad Up" => "D-Pad Up"
RetroArch [INFO] ::     RetroPad, User 1, Button "D-Pad Down" => "D-Pad Down"
RetroArch [INFO] ::     RetroPad, User 1, Button "D-Pad Left" => "D-Pad Left"
RetroArch [INFO] ::     RetroPad, User 1, Button "D-Pad Right" => "D-Pad Right"
RetroArch [INFO] ::     RetroPad, User 1, Button "A (right)" => "Cycle Weapon"
RetroArch [INFO] ::     RetroPad, User 1, Button "X (up)" => "Freelook"
RetroArch [INFO] ::     RetroPad, User 1, Button "L" => "Strafe Left"
RetroArch [INFO] ::     RetroPad, User 1, Button "R" => "Strafe Right"
RetroArch [INFO] :: Environ GET_VARIABLE tyrquake_resolution:
RetroArch [INFO] ::     320x200
RetroArch [libretro INFO] ::  :: Got size: 320 x 200.
Segmentation fault

bisected to 7a26ad2

7a26ad29b54a305aab91e1198548d0892d649a6e is the first bad commit
commit 7a26ad29b54a305aab91e1198548d0892d649a6e
Author: twinaphex <libretro@gmail.com>
Date:   Tue Sep 29 20:18:43 2015 +0200

    Static code analysis cleanups

:040000 040000 3dd636733a27713e03d2190d733a8d3d1b4513a5 7753af534255f602d3a9caff090e59c697eb5d43 M  QW
:040000 040000 57df1b91f63cc77465c0d3155b3fe5149adde8f8 9a9d5e3858c00d4380fd5d1d1c2a510bc92a4784 M  common

This is building with just "make"

building with -O0 and it doesn't crash... so is this the fault of the compiler or the code - perhaps undefined behaviour of something ? (gcc 4.7.2 on arm7l)

backtrace (building from HEAD with -O1 and -g which does still crash)

Program received signal SIGSEGV, Segmentation fault.
0x765436c0 in COM_InitArgv (argc=1, argv=0x7678b8b4) at common/common.c:1090
1090          while ((n < (CMDLINE_LENGTH - 1)) && argv[j][i])
(gdb) bt
#0  0x765436c0 in COM_InitArgv (argc=1, argv=0x7678b8b4) at common/common.c:1090
#1  0x765838c8 in retro_load_game (info=<optimized out>) at common/libretro.c:760
#2  0x0002140c in load_content (content=0x1c7af8, special=<optimized out>) at content.c:513
#3  init_content_file () at content.c:657
#4  0x0001a330 in event_init_content () at command_event.c:696
#5  event_init_core () at command_event.c:757
#6  event_command (cmd=cmd@entry=EVENT_CMD_CORE_INIT) at command_event.c:1374
#7  0x00016458 in rarch_main_init (argc=1989641632, argv=0x1451f0, argv@entry=0x7efff774) at retroarch.c:1180
#8  0x00013d9c in main_load_content (argc=81308, argc@entry=7, argv=argv@entry=0x7efff774, args=args@entry=0x0, 
    environ_get=<optimized out>, process_args=0) at frontend/frontend.c:260
#9  0x000141bc in rarch_main (argc=7, argv=0x7efff774, data=0x0) at frontend/frontend.c:315
#10 0x76acc81c in __libc_start_main (main=0x7efff774, argc=1992167424, ubp_av=0x76acc81c, init=<optimized out>, 
    fini=0xf30b8 <__libc_csu_fini>, rtld_fini=0x76fe85a4, stack_end=0x7efff774) at libc-start.c:244
#11 0x0001114c in _start ()

Looking at that commit, I notice variable i is not being set to 0 at the beginning of every iteration (compared to before).

0d60d98

Try seeing if this fixes your issues.

Yeh, I just noticed that and made the change and it sorts it. thanks :)