Nowadays binary files collected in the .debug directory either have the explicit name of "elf", "kallsyms" and "vdso" rather than the build id:
home/mpoirier/.debug/ ├── home │ └── linaro │ └── main │ └── 9a6850fab2ebbe386d3619bce3674a55622f2872 │ └── elf ├── [kernel.kallsyms] │ └── 460b314b8040fb8f3871b67b7ff3d3498e74bc22 │ └── kallsyms ├── lib │ └── aarch64-linux-gnu │ ├── ld-2.21.so │ │ └── 94912dc5a1dc8c7ef2c4e4649d4b1639b6ebc8b7 │ │ └── elf │ └── libc-2.21.so │ └── 169a143e9c40cfd9d09695333e45fd67743cd2d6 │ └── elf ├── opt │ └── lib │ └── libcstest.so.1.0 │ └── 3b3051b8a67f212a66e383fc90db3c2bde8f936f │ └── elf └── [vdso] └── c610c0514acb76a39a3419ff719f80dfea9db5fe └── vdso
This patch adds the right filename based on the "buildid_list" output. The directory path is also adjusted to include a forward slash characters ('/') when needed (kallsyms and vsdo).
Signed-off-by: Mathieu Poirier mathieu.poirier@linaro.org --- tools/perf/scripts/python/cs-trace-disasm.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/tools/perf/scripts/python/cs-trace-disasm.py b/tools/perf/scripts/python/cs-trace-disasm.py index 429d0d2d7a23..75f67d314a42 100644 --- a/tools/perf/scripts/python/cs-trace-disasm.py +++ b/tools/perf/scripts/python/cs-trace-disasm.py @@ -48,9 +48,19 @@ def trace_begin(): for line in cmd_output: m = bid_re.search(line) if (m != None) : + if (m.group(2) == "[kernel.kallsyms]") : + append = "/kallsyms" + dirname = "/" + m.group(2) + elif (m.group(2) == "[vdso]") : + append = "/vdso" + dirname = "/" + m.group(2) + else: + append = "/elf" + dirname = m.group(2) + build_ids[m.group(2)] = \ os.environ['PERF_BUILDID_DIR'] + \ - m.group(2) + "/" + m.group(1); + dirname + "/" + m.group(1) + append;
if ((options.vmlinux_name != None) and ("[kernel.kallsyms]" in build_ids)): build_ids['[kernel.kallsyms]'] = options.vmlinux_name;
With this patch it is possible to handle library files that don't end with ".so". Something like ".so.0.1" is now supported and will add the proper entry in the mmaps dictionary.
(Modification to the regular expression was suggested by Tor Jeremiassen)
Signed-off-by: Mathieu Poirier mathieu.poirier@linaro.org --- tools/perf/scripts/python/cs-trace-disasm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/scripts/python/cs-trace-disasm.py b/tools/perf/scripts/python/cs-trace-disasm.py index 75f67d314a42..54700b859f7f 100644 --- a/tools/perf/scripts/python/cs-trace-disasm.py +++ b/tools/perf/scripts/python/cs-trace-disasm.py @@ -67,7 +67,7 @@ def trace_begin(): else: del build_ids['[kernel.kallsyms]']
- mmap_re = re.compile("PERF_RECORD_MMAP2 -?[0-9]+/[0-9]+: [(0x[0-9a-fA-F]+).*:\s.*\s(.*.so)") + mmap_re = re.compile("PERF_RECORD_MMAP2 -?[0-9]+/[0-9]+: [(0x[0-9a-fA-F]+).*:\s.*\s(\S*)") cmd_output= check_output("perf script --show-mmap-events | fgrep PERF_RECORD_MMAP2",shell=True).split('\n') for line in cmd_output: m = mmap_re.search(line)