Debugging on Arch

I'm working on a project in c called tt and I keep running into various issues. I figured I could use a debugging tool to make the whole process a lot easier.

Available tools

In my case I chose to go with valgrind as it's more modern and I have more experience with it.

However, there's a problem you'll encounter pretty quickly. It turns out this is because on arch, glibc is stripped and non-stripped glibc isn't provided. No worries, we'll just have to compile it ourselves.

Compiling glibc

First things first, we need to get our hands on glibc's PKGBUILD.

On Arch:

git clone
cd svntogit-packages/trunk
git checkout packages/glibc

On Artix:

git clone
cd glibc/trunk

Then we need to modify the PKGBUILD to disable stripping and enable debug. which is done by adding debug !strip to options.

sed -i 's/options=(/options=(debug !strip /' PKGBUILD

Finally we compile the glibc and install the resulting package.

makepkg --skipchecksums
doas pacman -U glibc*.tar.zst