Saturday, May 3, 2025

How to install debug symbols for Golf package on Debian/Ubuntu

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-src
URIs: https://ppa.launchpadcontent.net/golf-lang/golf/ubuntu/
Suites: noble
Components: main main/debug

Next, update the repos:

sudo apt update

And now you can install debug symbols:

sudo apt install golf-dbgsym

Also you can get the source code for Golf (you may need to install dpkg-dev for this to work):

apt source golf 

Once you get the source in the current directory, you can reference it in gdb:

(gdb) directory <path to source>

This is how you can use gdb with Golf even if you didn't install from source. Of course, installing from source makes it easy, but then you won't have package management, if that matters to you.

And finally, this process is true for any Debian/Ubuntu package, not just Golf.