If you installed Golf from a package using a repository like Launchpad, such as like this:
sudo add-apt-repository ppa:golf-lang/golf -y
sudo apt update
sudo apt -y install golf
then in order to be able to use gdb and step through Golf itself, you can obtain the debug package and Golf sources.
To get the apt debug package, open the source list for Golf (this is for Ubuntu "Noble", the exact path may vary):
sudo vi /etc/apt/sources.list.d/golf-lang-ubuntu-golf-noble.sources
and then find the instances of "main" used to describe the package, and change it to "main main/debug", so that you get debug packages too. Also, add deb-src as the source. Here's an example if you're using line-by-line sources:
deb https://ppa.launchpadcontent.net/golf-lang/golf/ubuntu noble main main/debug
deb-src https://ppa.launchpadcontent.net/golf-lang/golf/ubuntu noble main main/debug
If you have a 'section-style' sources, then it might look like:Types: deb deb-srcURIs: https://ppa.launchpadcontent.net/golf-lang/golf/ubuntu/Suites: nobleComponents: main main/debug
sudo apt update
sudo apt install golf-dbgsym
wget "https://github.com/golf-lang/golf/archive/refs/tags/<version>.tar.gz"
tar xvfz <version>.tar.gz
(gdb) directory <path to source>