perf tools: Add OCaml demangling
authorFabian Hemmer <copy@copy.sh>
Wed, 3 Feb 2021 21:15:37 +0000 (16:15 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 17 Feb 2021 18:15:06 +0000 (15:15 -0300)
commitcef7af25c9d3a7ea5d0c82424dc8bf93a95b6fc3
treec55d0626aaa0f3dfdf360a476599b64b73453032
parent48859e5293a261437deb0231d78a388e242ed2d3
perf tools: Add OCaml demangling

Detect symbols generated by the OCaml compiler based on their prefix.

Demangle OCaml symbols, returning a newly allocated string (like the
existing Java demangling functionality).

Move a helper function (hex) from tests/code-reading.c to util/string.c

To test:

  echo 'Printf.printf "%d\n" (Random.int 42)' > test.ml
  perf record ocamlopt.opt test.ml
  perf report -d ocamlopt.opt

Signed-off-by: Fabian Hemmer <copy@copy.sh>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LPU-Reference: 20210203211537.b25ytjb6dq5jfbwx@nyu
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/Build
tools/perf/tests/builtin-test.c
tools/perf/tests/code-reading.c
tools/perf/tests/demangle-ocaml-test.c [new file with mode: 0644]
tools/perf/tests/tests.h
tools/perf/util/Build
tools/perf/util/demangle-ocaml.c [new file with mode: 0644]
tools/perf/util/demangle-ocaml.h [new file with mode: 0644]
tools/perf/util/string.c
tools/perf/util/string2.h
tools/perf/util/symbol-elf.c