From owner-dev-commits-src-all@freebsd.org Sun Aug 15 21:03:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 624816665F8; Sun, 15 Aug 2021 21:03:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GnqWn3Hq3z4bBt; Sun, 15 Aug 2021 21:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DC561CFD5; Sun, 15 Aug 2021 21:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17FL3HQp006056; Sun, 15 Aug 2021 21:03:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17FL3Had006055; Sun, 15 Aug 2021 21:03:17 GMT (envelope-from git) Date: Sun, 15 Aug 2021 21:03:17 GMT Message-Id: <202108152103.17FL3Had006055@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: c8faaf378709 - stable/13 - ports.7: Document DEBUG_FLAGS and the process of debugging ports MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c8faaf378709f4ce4661da7ca73ee88e1cc63d54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Aug 2021 21:03:18 -0000 The branch stable/13 has been updated by 0mp (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c8faaf378709f4ce4661da7ca73ee88e1cc63d54 commit c8faaf378709f4ce4661da7ca73ee88e1cc63d54 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2021-04-17 20:51:54 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2021-08-15 21:02:08 +0000 ports.7: Document DEBUG_FLAGS and the process of debugging ports Loosely based on https://wiki.freebsd.org/BenWoods/DebuggingPorts. Reviewed by: crees MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27296 (cherry picked from commit d25f7d324a9d0c33655876b920ba590918d16f4c) --- share/man/man7/ports.7 | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index 1c3cce31d2f0..797fed0d3ec6 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -558,6 +558,13 @@ If set, debugging symbols are installed for ports binaries. .It Va WITH_DEBUG_PORTS A list of origins for which to set .Va WITH_DEBUG . +.It Va DEBUG_FLAGS +.Pq Default: Ql -g +Additional +.Va CFLAGS +to set when +.Va WITH_DEBUG +is set. .It Va WITH_CCACHE_BUILD .Pq Vt bool If set, enables the use of @@ -643,6 +650,58 @@ DISABLE_MAKE_JOBS= yes TRYBROKEN= yes \&.endif .Ed +.It Sy Example 6\&: No Debugging Ports +By default ports are built and packaged without debugging support (e.g., +debugging symbols are stripped from binaries, optimization flags are used for +compiling, verbose logging is disabled). +Whether ports are built with debugging symbols can be controlled by the +settings in +.Xr make.conf 5 , +e.g., +.Bd -literal -offset 2n +# Enable debugging for all ports. +WITH_DEBUG= yes +# Enable debugging for selected ports. +WITH_DEBUG_PORTS= mail/dovecot security/krb5 +.Ed +.Pp +It is also possible to use the debug variables on the command line: +.Bd -literal -offset 2n +.Li # Ic make -DWITH_DEBUG DEBUG_FLAGS="-g -O0" build +.Ed +.Pp +See the +.Sx MAKE VARIABLES +section to learn more about the debug variables. +.Pp +To understand the details of what happens when the debug variables are set it +is best to consult the files located at +.Pa ${PORTSDIR}/Mk/* +.Po Pa bsd.port.mk +in particular +.Pc . +.Pp +If debugging is enabled for a specific port, the ports framework will: +.Bl -bullet +.It +Add +.Va DEBUG_FLAGS +(defaults to +.Ql -g ) +to +.Va CFLAGS . +.It +Try to prevent the binaries from being stripped (including checking the install +target to replace +.Ql install-strip +with +.Ql install ) . +Whether a binary has been stripped can be checked with +.Xr file 1 . +.It +Try to enable other debugging features like debug build type or verbose logging. +However, this is port-specific and the ports framework might not be aware of +each supported debugging feature a given piece of software has to offer). .El .Sh SEE ALSO .Xr make 1 ,