[PATCH 5/5] perf script: Enable IP fields for callchains

From: Jiri Olsa
Date: Thu May 07 2020 - 05:51:19 EST


In case the callchains were deleted in pipe mode,
we need to ensure that the IP fields are enabled,
otherwise the callchain is not displayed.

Enabling IP and SYM, which should be enough for
callchains.

Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/builtin-script.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 5c4a580c048a..ecc8bd4c5e57 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -2118,8 +2118,6 @@ static int process_attr(struct perf_tool *tool, union perf_event *event,
return 0;
}

- set_print_ip_opts(&evsel->core.attr);
-
if (evsel->core.attr.sample_type) {
err = perf_evsel__check_attr(evsel, scr->session);
if (err)
@@ -2132,6 +2130,13 @@ static int process_attr(struct perf_tool *tool, union perf_event *event,
*/
sample_type = perf_evlist__combined_sample_type(evlist);
callchain_param_setup(sample_type);
+
+ /* Enable fields for callchain entries, if it got enabled. */
+ if (callchain_param.record_mode != CALLCHAIN_NONE) {
+ output[output_type(evsel->core.attr.type)].fields |= PERF_OUTPUT_IP |
+ PERF_OUTPUT_SYM;
+ }
+ set_print_ip_opts(&evsel->core.attr);
return 0;
}

--
2.25.4