perf report: Fix initializion of annotate symbol priv area

We only allocate it when in TUI mode. In --stdio mode unconditionally
initializing this area leads to memory corruption.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7c940c18
...@@ -44,6 +44,7 @@ static const char default_pretty_printing_style[] = "normal"; ...@@ -44,6 +44,7 @@ static const char default_pretty_printing_style[] = "normal";
static const char *pretty_printing_style = default_pretty_printing_style; static const char *pretty_printing_style = default_pretty_printing_style;
static char callchain_default_opt[] = "fractal,0.5"; static char callchain_default_opt[] = "fractal,0.5";
static symbol_filter_t annotate_init;
static struct hists *perf_session__hists_findnew(struct perf_session *self, static struct hists *perf_session__hists_findnew(struct perf_session *self,
u64 event_stream, u32 type, u64 event_stream, u32 type,
...@@ -167,7 +168,7 @@ static int process_sample_event(union perf_event *event, ...@@ -167,7 +168,7 @@ static int process_sample_event(union perf_event *event,
struct perf_event_attr *attr; struct perf_event_attr *attr;
if (perf_event__preprocess_sample(event, session, &al, sample, if (perf_event__preprocess_sample(event, session, &al, sample,
symbol__annotate_init) < 0) { annotate_init) < 0) {
fprintf(stderr, "problem processing %d event, skipping it.\n", fprintf(stderr, "problem processing %d event, skipping it.\n",
event->header.type); event->header.type);
return -1; return -1;
...@@ -520,6 +521,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __used) ...@@ -520,6 +521,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
*/ */
if (use_browser > 0) { if (use_browser > 0) {
symbol_conf.priv_size = sizeof(struct annotation); symbol_conf.priv_size = sizeof(struct annotation);
annotate_init = symbol__annotate_init;
/* /*
* For searching by name on the "Browse map details". * For searching by name on the "Browse map details".
* providing it only in verbose mode not to bloat too * providing it only in verbose mode not to bloat too
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment