From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2] tools/Rules.mk: Don't optimize debug builds; add macro debugging information Date: Thu, 8 Jan 2015 17:16:04 +0000 Message-ID: <1420737364.19787.121.camel@citrix.com> References: <1417435968.29138.19.camel@citrix.com> <1417443665-30809-1-git-send-email-euan.harris@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1417443665-30809-1-git-send-email-euan.harris@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Euan Harris Cc: Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2014-12-01 at 14:21 +0000, Euan Harris wrote: > Tools debug builds are built with optimization level -O1, inherited from > the CFLAGS definition in StdGNU.mk. Optimizations confuse the debugger, > and the comment justifying -O1 in StdGNU.mk should not apply for a > userspace library. (For others, that comment reads: Less than -O1 produces bad code and large stack frames) > Disable optimization by appending -O0 to CFLAGS, > which overrides the -O1 flag specified earlier. > > Also specify -g3, to add macro debugging information which allows > gdb to expand macro invocations. This is useful as libxl uses many > non-trivial macros. > > Signed-off-by: Euan Harris > > Changes since v1: > * moved flag override to tools/Rules.mk so it affects all tools > --- > tools/Rules.mk | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/tools/Rules.mk b/tools/Rules.mk > index 87a56dc..7ef1ce5 100644 > --- a/tools/Rules.mk > +++ b/tools/Rules.mk > @@ -54,6 +54,11 @@ CFLAGS_libxenvchan = -I$(XEN_LIBVCHAN) > LDLIBS_libxenvchan = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) -L$(XEN_LIBVCHAN) -lxenvchan > SHLIB_libxenvchan = -Wl,-rpath-link=$(XEN_LIBVCHAN) > > +ifeq ($(debug),y) > +# Disable optimizations and debugging information for macros ^enable ... or else it looks like you are saying it should be turning of macro debug info too. This is something which can be done on commit. Acked-by: Ian Campbell > +CFLAGS += -O0 -g3 > +endif > + > LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2) > > ifeq ($(LIBXL_BLKTAP),y)