• Victor Kamensky's avatar
    perf symbols: Take into account symfs setting when reading file build ID · 9b200653
    Victor Kamensky authored
    After commit 5baecbcd ("perf symbols: we can now read separate
    debug-info files based on a build ID") and when --symfs option is used
    perf failed to pick up symbols for file with the same name between host
    and sysroot specified by --symfs option.  One can see message like this:
    
      bin/bash with build id 26f0062cb6950d4d1ab0fd9c43eae8b10ca42062 not found, continuing without symbols
    
    It happens because code added by 5baecbcd opens files directly by
    dso->long_name without symbol_conf.symfs consideration, which as result
    picks one from the host. It reads its build ID and later even code finds
    another proper file in directory pointed by --symfs perf ignores it
    because build id mismatches.
    
    Fix is to use __symbol__join_symfs to adjust file name according to
    --symfs setting. If no --symfs passed the operation would noop and picks
    the same host file as before.
    
    Also note in latter tree after 5baecbcd commit additional check for
    '!dso->has_build_id' was added, so to observe error condition 'perf
    record' should run with --no-buildid, so perf.data itself would not have
    build id for target binary in buildid perf section and 'perf report'
    will pass '!dso->has_build_id' condition. Or target binary should not
    have build id, but the same binary on host has build id, again
    '!dso->has_build_id' will pass in this case and incorrect build id could
    be read if --symfs is used.
    Signed-off-by: default avatarVictor Kamensky <kamensky@cisco.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Chris Phlipot <cphlipot0@gmail.com>
    Cc: Dima Kogan <dima@secretsauce.net>
    Cc: He Kuang <hekuang@huawei.com>
    Cc: Kan Liang <kan.liang@intel.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Cc: xe-linux-external@cisco.com
    Fixes: 5baecbcd ("perf symbols: we can now read separate debug-info files based on a build ID")
    Link: http://lkml.kernel.org/r/1486424908-17094-1-git-send-email-kamensky@cisco.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    9b200653
symbol.c 46.9 KB