Debugging Ports

Enabling Debugging During Build

Whether ports are built with debugging symbols can be controlled by the settings in /etc/make.conf.

Enable debugging for all ports:

WITH_DEBUG=     yes

Enable debugging for select ports:

WITH_DEBUG_PORTS=       mail/dovecot security/krb5

If debugging is enabled for a specific port, the ports system will:

To customize the changes to CFLAGS in debugging mode:

DEBUG_FLAGS=    -g -O0

This will instruct the compiler to:

Checking Debugging Symbols

After a port has been built with the above debugging steps, you can check they have worked by using file(1) to analyze the installed binaries.

$ file /usr/local/sbin/dovecot
/usr/local/sbin/dovecot: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.0 (1200054), FreeBSD-style, with debug_info, not stripped

Note that this file has debug_info and is not stripped.

DebuggingPorts (last edited 2023-05-08T16:53:37+0000 by DanielEbdrup)