Setting up Flycast GDB

Jump to navigation Jump to search

Clone dev branch of Flycast

git clone -b dev
cd flycast
git submodule update --init --recursive

Build with GDB Support

mkdir build
cd build
make -j$(nproc)

Enable GDB in Config File

Briefly launch Flycast to make sure config file exists


Edit config file to enable GDB

Path on Linux: ~/.config/flycast/emu.cfg

Under "[config]" make sure GDBEnabled is set to yes

Debug.GDBEnabled = yes
Debug.GDBPort = 3263

Start GDB Session

Start a gdb with SH4 support, I use gdb-multiarch from my package manager


In the GDB shell run the following commands to configure the GDB session

set arch sh4
set endian little

Start Flycast Emulation and then connect to running core

target remote :3263

This will pause execution of the game upon connecting

From here you can set breakpoints, instruction step, and read/write memory using normal GDB commands Handy reference: GDB Cheat Sheet

The following commands show a terminal interface of the registers and instructions:

layout asm on
layout regs on

Single Instruction Step


Pressing Enter with no command typed will just repeat the last command (good for stepping)