Skip to content

perf annotate: Use libcapstone as a disasssembler

Namhyung Kim linux-perf-users lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 4 repliesIn review
  2. v14 patches 3 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5perf annotate: Use ins__is_xxx() if possibletools/perf/util/annotate.c+4 -40 replies
2/5perf annotate: Add and use ins__is_nop()tools/perf/util/annotate.c tools/perf/util/annotate.h+7 -10 replies
3/5perf annotate: Split out util/disasm.ctools/perf/util/Build tools/perf/util/annotate.c tools/perf/util/annotate.h +2 more+1757 -17104 replies
4/5perf annotate: Use libcapstone to disassembletools/perf/util/disasm.c+160 -00 replies
5/5perf annotate: Add symbol name when using capstonetools/perf/util/disasm.c+71 -30 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchIan Rogers
1/5T-b
2/5T-b
3/5T-b
4/5T-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/5] perf annotate: Use libcapstone as a disasssembler

Hello,

As we've added libcapstone support, it's natural to use it for perf annotate as well. This change added the capstone support on x86 first. Other archs can be added later (by someone who can verify it doesn't break things).

* v2 changes
- Show global symbols in the comment (Changbin)
- Update the commit message for split (Ian)
- Add Ian's Tested-by

For now it tries to use capstone (if available) before objdump. But it doesn't support source file and line number info. So users should use the objdump (by passing --objdump=PATH option) if they need them. For example, this command line will keep the existing behavior (i.e. using objdump).

  # not to use capstone for disassembly
  $ perf annotate --objdump=objdump

The capstone uses LLVM objdump style output which is slightly different than the GNU objdump. But it should not have differences besides that. I've verified the result of data type profiling and it produced the same output but gave me ~3x speedups.

Thanks,
Namhyung

Namhyung Kim (5):
perf annotate: Use ins__is_xxx() if possible perf annotate: Add and use ins__is_nop() perf annotate: Split out util/disasm.c perf annotate: Use libcapstone to disassemble perf annotate: Add symbol name when using capstone

 tools/perf/util/Build      |    1 +
 tools/perf/util/annotate.c | 1711 ++--------------------------------
 tools/perf/util/annotate.h |   59 +-
 tools/perf/util/disasm.c   | 1814 ++++++++++++++++++++++++++++++++++++
 tools/perf/util/disasm.h   |  112 +++
 5 files changed, 1989 insertions(+), 1708 deletions(-)
 create mode 100644 tools/perf/util/disasm.c
 create mode 100644 tools/perf/util/disasm.h
Signature · 1 line
2.44.0.478.gd926399ef9-goog