Skip to content

Instantly share code, notes, and snippets.

@Akdeniz
Created December 29, 2025 15:45
Show Gist options
  • Select an option

  • Save Akdeniz/492300f3776c5ee7f38f3dfd4ebc3f9f to your computer and use it in GitHub Desktop.

Select an option

Save Akdeniz/492300f3776c5ee7f38f3dfd4ebc3f9f to your computer and use it in GitHub Desktop.
Install GDB libcxx printers.
# determines what version you want
version=heads/main
# path=tags/llvmorg-21-init
mkdir -p ~/.config/gdb/libcxx
wget https://github.com/llvm/llvm-project/raw/refs/$version/libcxx/utils/gdb/libcxx/printers.py -O ~/.config/gdb/libcxx/printers.py
touch ~/.config/gdb/libcxx/__init__.py
if [ ! -f ~/.gdbinit ]; then
echo "
set print pretty on
set print object on
" | tee ~/.gdbinit
fi
echo "
# libc++ pretty printers
# See: https://github.com/koutheir/libcxx-pretty-printers
python
import sys
sys.path.insert(0, '$(eval echo ~)/.config/gdb')
from libcxx.printers import register_libcxx_printer_loader
register_libcxx_printer_loader()
end
" | tee -a ~/.gdbinit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment