The branch stack feature flag is set by 'perf record' when recording
data that contains branch stacks.  Consequently, when 'perf inject'
synthesizes branch stacks, the feature flag should be set also.

Signed-off-by: Adrian Hunter <adrian.hun...@intel.com>
---
 tools/perf/builtin-inject.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index f62c49b35be0..8638fad8a085 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -537,9 +537,13 @@ static int __cmd_inject(struct perf_inject *inject)
                 * The AUX areas have been removed and replaced with
                 * synthesized hardware events, so clear the feature flag.
                 */
-               if (inject->itrace_synth_opts.set)
+               if (inject->itrace_synth_opts.set) {
                        perf_header__clear_feat(&session->header,
                                                HEADER_AUXTRACE);
+                       if (inject->itrace_synth_opts.last_branch)
+                               perf_header__set_feat(&session->header,
+                                                     HEADER_BRANCH_STACK);
+               }
                session->header.data_offset = output_data_offset;
                session->header.data_size = inject->bytes_written;
                perf_session__write_header(session, session->evlist, fd, true);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to