diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 46ec6c5ca47f..6d8fa543dcff 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -2564,6 +2564,7 @@ int perf_session__read_header(struct perf_session *session) return -ENOMEM; session->evlist->env = &header->env; + session->machines.host.env = &header->env; if (perf_data_file__is_pipe(file)) return perf_header__read_pipe(session); diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 6309f7ceb08f..fd1efeafb343 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -35,6 +35,7 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid) machine->last_match = NULL; machine->vdso_info = NULL; + machine->env = NULL; machine->pid = pid; diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index ea5cb4a621db..9dfc4281f940 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h @@ -34,6 +34,7 @@ struct machine { struct list_head dead_threads; struct thread *last_match; struct vdso_info *vdso_info; + struct perf_env *env; struct dsos dsos; struct map_groups kmaps; struct map *vmlinux_maps[MAP__NR_TYPES]; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 728cb115fbb8..d1a43a322f96 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -138,6 +138,8 @@ struct perf_session *perf_session__new(struct perf_data_file *file, perf_session__set_id_hdr_size(session); perf_session__set_comm_exec(session); } + } else { + session->machines.host.env = &perf_env; } if (!file || perf_data_file__is_write(file)) {