Re: [PATCH] Fixes issue when debugging debug builds of Perf.

From: Arnaldo Carvalho de Melo
Date: Tue Oct 29 2019 - 10:26:53 EST


Em Tue, Oct 29, 2019 at 11:18:52AM -0300, Arnaldo Carvalho de Melo escreveu:
> And here is the first patch out of your larger one, I changed the
> subject line to reflect that this is not tools/perf specific, as
> tools/objtool/ also uses libsubcmd, added Josh, objtool's maintainer so
> that he is made aware.

And the second patch:


commit d0381449fd9ab733ec2daf527263da9f73f1e94e
Author: James Clark <James.Clark@xxxxxxx>
Date: Mon Oct 28 11:34:01 2019 +0000

libsubcmd: Use -O0 with DEBUG=1

When a 'make DEBUG=1' build is done, the command parser is still built
with -O6 and is hard to step through, fix it making it use -O0 in that
case.

Signed-off-by: James Clark <james.clark@xxxxxxx>
Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: Ian Rogers <irogers@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: nd <nd@xxxxxxx>
Link: http://lore.kernel.org/lkml/20191028113340.4282-1-james.clark@xxxxxxx
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile
index 352c6062deba..1c777a72bb39 100644
--- a/tools/lib/subcmd/Makefile
+++ b/tools/lib/subcmd/Makefile
@@ -27,7 +27,9 @@ ifeq ($(DEBUG),0)
endif
endif

-ifeq ($(CC_NO_CLANG), 0)
+ifeq ($(DEBUG),1)
+ CFLAGS += -O0
+else ifeq ($(CC_NO_CLANG), 0)
CFLAGS += -O3
else
CFLAGS += -O6