Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2014 22:51:42 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        freebsd-toolchain@FreeBSD.org, freebsd-dtrace@FreeBSD.org
Subject:   Re: WITH_CTF vs -g
Message-ID:  <20140925225142.GC2501@ip-172-31-25-62.ec2.internal>
In-Reply-To: <54108909.7050908@FreeBSD.org>
References:  <54108909.7050908@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 10, 2014 at 08:23:21PM +0300, Andriy Gapon wrote:
> 
> In my opinion WITH_CTF should imply -g in CFLAGS otherwise, as far as I can see,
> there is nothing to generate CTF data from.  Forcing an end-user to remember to
> additionally pass -g is not nice.
> 
> Also, I think that we can always have -g in CTFFLAGS, because the stripping step
> takes care of the original DWARF data in any case.  But I am not 100% sure about
> this.
> 
> What do you think?
> Thanks!

Hi Andriy,

Are you planning to go through with this? I was just about to post this
exact question, but then I remembered that you already have. :)

FWIW, the diff I have in mind is below. It also removes some checks that
I think are unnecessary from bsd.{lib,prog}.mk. It is not fully tested,
but seems to work for me. I'm also not sure about unconditionally
passing -g to ctfconvert and ctfmerge.

Thanks,
-Mark

diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index f0acf16..c6b689d 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -36,7 +36,7 @@ NO_WERROR=
 .if defined(DEBUG_FLAGS)
 CFLAGS+= ${DEBUG_FLAGS}
 
-.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
+.if ${MK_CTF} != "no"
 CTFFLAGS+= -g
 .endif
 .else
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 486914b..32556a1 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -128,6 +128,7 @@ __<bsd.own.mk>__:
 
 .if ${MK_CTF} != "no"
 CTFCONVERT_CMD=	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
+DEBUG_FLAGS?=	-g
 .elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300)
 CTFCONVERT_CMD=
 .else
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 340950a..e4f7104 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -20,7 +20,7 @@ NO_WERROR=
 CFLAGS+=${DEBUG_FLAGS}
 CXXFLAGS+=${DEBUG_FLAGS}
 
-.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
+.if ${MK_CTF} != "no"
 CTFFLAGS+= -g
 .endif
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140925225142.GC2501>