Commit 292c5ed1 authored by Fabian Hemmer's avatar Fabian Hemmer Committed by Arnaldo Carvalho de Melo

perf tools: Preserve identifier id in OCaml demangler

Some OCaml developers reported that this bit of information is sometimes
useful for disambiguating functions for which the OCaml compiler assigns
the same name, e.g. nested or inlined functions.
Signed-off-by: default avatarFabian Hemmer <copy@copy.sh>
Link: http://lore.kernel.org/lkml/20210226075223.p3s5oz4jbxwnqjtv@nyuSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b0a752d4
...@@ -19,11 +19,11 @@ int test__demangle_ocaml(struct test *test __maybe_unused, int subtest __maybe_u ...@@ -19,11 +19,11 @@ int test__demangle_ocaml(struct test *test __maybe_unused, int subtest __maybe_u
{ "main", { "main",
NULL }, NULL },
{ "camlStdlib__array__map_154", { "camlStdlib__array__map_154",
"Stdlib.array.map" }, "Stdlib.array.map_154" },
{ "camlStdlib__anon_fn$5bstdlib$2eml$3a334$2c0$2d$2d54$5d_1453", { "camlStdlib__anon_fn$5bstdlib$2eml$3a334$2c0$2d$2d54$5d_1453",
"Stdlib.anon_fn[stdlib.ml:334,0--54]" }, "Stdlib.anon_fn[stdlib.ml:334,0--54]_1453" },
{ "camlStdlib__bytes__$2b$2b_2205", { "camlStdlib__bytes__$2b$2b_2205",
"Stdlib.bytes.++" }, "Stdlib.bytes.++_2205" },
}; };
for (i = 0; i < ARRAY_SIZE(test_cases); i++) { for (i = 0; i < ARRAY_SIZE(test_cases); i++) {
......
...@@ -64,17 +64,5 @@ ocaml_demangle_sym(const char *sym) ...@@ -64,17 +64,5 @@ ocaml_demangle_sym(const char *sym)
} }
result[j] = '\0'; result[j] = '\0';
/* scan backwards to remove an "_" followed by decimal digits */
if (j != 0 && isdigit(result[j - 1])) {
while (--j) {
if (!isdigit(result[j])) {
break;
}
}
if (result[j] == '_') {
result[j] = '\0';
}
}
return result; return result;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment