Messages in this thread Patch in this message | | | Date | Wed, 20 May 2015 18:16:51 +0200 | From | Martin Liška <> | Subject | Re: [PATCH] perf: fix wrong DEBUG configuration |
| |
On 05/20/2015 04:55 PM, Ingo Molnar wrote: > > * Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > >> Em Wed, May 20, 2015 at 03:29:37PM +0200, Martin Liška escreveu: >>> On 05/20/2015 03:17 PM, Arnaldo Carvalho de Melo wrote: >>>> Em Wed, May 20, 2015 at 03:07:39PM +0200, Martin Liška escreveu: >>>>> Currently, GCC optimizes -O6 same as -O3 level. Right optimize debugging >>>>> experience is given by passing -Og to compiler. >> >>>> Is this is this -Og available in old gcc versions? When was it >>>> introduced? Do you know? >> >>> GCC 4.8.0 is the first version capable of the option: https://gcc.gnu.org/gcc-4.8/changes.html. >>> That can be problematic, which GCC version do you support in linux/perf? >> >> So the rule has been: What are the kernel requirements for the >> toolchain? tools/perf/ should build with that. > > So we could use -Og if it works, like Kbuild does it: > > KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387) > > the 'cc-option' Make function does some magic of silently calling GCC > with that option and observing the result. > > See: > > scripts/Kbuild.include:cc-option = $(call try-run,\ > > et al. > > Thanks, > > Ingo >
Hi.
I am sorry, I did mistake in understanding of DEBUG variable. Following patch should be fixed, except missing auto-detection of -Og option.
Unfortunately, following hunk does not work, no -Ox is added to CFLAGS?
-- CFLAGS += -Og ++ CFLAGS += $(call cc-option,-Og,-O0)
Thanks, Martin From 98ef10fcb27afc3ae7aaab3ebd157ab90b3b1afe Mon Sep 17 00:00:00 2001 From: mliska <mliska@suse.cz> Date: Thu, 2 Apr 2015 15:24:49 +0200 Subject: [PATCH] perf: fix wrong DEBUG configuration
Currently, GCC optimizes -O6 same as -O3 level, thus change the value to -O6. Right optimize debugging experience is given by passing -Og to compiler. Assign default value for pointers that are identified by compiler as non-initialized.
Signed-off-by: Martin Liska <mliska@suse.cz> --- tools/perf/arch/common.c | 2 +- tools/perf/config/Makefile | 4 +++- tools/perf/util/symbol.c | 2 +- tools/perf/util/trace-event-parse.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c index 49776f1..b7bb42c 100644 --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c @@ -61,7 +61,7 @@ const char *const mips_triplets[] = { static bool lookup_path(char *name) { bool found = false; - char *path, *tmp; + char *path, *tmp = NULL; char buf[PATH_MAX]; char *env = getenv("PATH"); diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index e3b3724..6a29320 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -129,7 +129,9 @@ ifndef DEBUG endif ifeq ($(DEBUG),0) - CFLAGS += -O6 + CFLAGS += -O3 +else + CFLAGS += -Og endif ifdef PARSER_DEBUG diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 82a31fd..a19fbd4 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -400,7 +400,7 @@ static struct symbol *symbols__find_by_name(struct rb_root *symbols, const char *name) { struct rb_node *n; - struct symbol_name_rb_node *s; + struct symbol_name_rb_node *s = NULL; if (symbols == NULL) return NULL; diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 25d6c73..d495741 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c @@ -173,7 +173,7 @@ void parse_ftrace_printk(struct pevent *pevent, char *line; char *next = NULL; char *addr_str; - char *fmt; + char *fmt = NULL; line = strtok_r(file, "\n", &next); while (line) { -- 2.1.4
| |