Em Tue, Nov 27, 2018 at 11:10:36AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Nov 06, 2018 at 11:07:10PM +0200, Adrian Hunter escreveu:
> > For branch stacks or branch samples, the sample cpumode might not be
> > correct because it applies only to the sample 'ip' and not necessary to
> > 'addr' or branch stack addresses. Add fallback functions that can be used
> > to deal with those cases
> 
> I've split this into two, and the first is causing this:
> 
> root@quaco ~]# perf top
> perf: Segmentation fault
> -------- backtrace --------
> perf[0x59baca]
> /lib64/libc.so.6(+0x385bf)[0x7fa2775dc5bf]
> perf(perf_env__arch+0x34)[0x4b4514]
> perf(perf_env__single_address_space+0x1b)[0x57944b]
> perf(perf_session__new+0x17c)[0x4fdb3c]
> perf(cmd_top+0x162c)[0x45109c]
> perf[0x4a621e]
> perf(main+0x61c)[0x42cbfc]
> /lib64/libc.so.6(__libc_start_main+0xf2)[0x7fa2775c8412]
> perf(_start+0x2d)[0x42ce2d]
> [root@quaco ~]#
> 
> Its the case where the env info comes from the running machine, via
> uname(), I'm working on a fix.

So I'll graft this just before your patch.

- Arnaldo

diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index 59f38c7693f8..4c23779e271a 100644
--- a/tools/perf/util/env.c
+++ b/tools/perf/util/env.c
@@ -166,7 +166,7 @@ const char *perf_env__arch(struct perf_env *env)
        struct utsname uts;
        char *arch_name;
 
-       if (!env) { /* Assume local operation */
+       if (!env || !env->arch) { /* Assume local operation */
                if (uname(&uts) < 0)
                        return NULL;
                arch_name = uts.machine;

Reply via email to