linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Preserve identifier id in OCaml demangler
@ 2021-02-26  7:52 Fabian Hemmer
  2021-03-30 15:46 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Hemmer @ 2021-02-26  7:52 UTC (permalink / raw)
  To: linux-perf-users, linux-kernel; +Cc: Arnaldo Carvalho de Melo

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: Fabian Hemmer <copy@copy.sh>
---
 tools/perf/tests/demangle-ocaml-test.c |  6 +++---
 tools/perf/util/demangle-ocaml.c       | 12 ------------
 2 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/tools/perf/tests/demangle-ocaml-test.c b/tools/perf/tests/demangle-ocaml-test.c
index a273ed5163d7..1d232c2e2190 100644
--- a/tools/perf/tests/demangle-ocaml-test.c
+++ b/tools/perf/tests/demangle-ocaml-test.c
@@ -19,11 +19,11 @@ int test__demangle_ocaml(struct test *test __maybe_unused, int subtest __maybe_u
 		{ "main",
 		  NULL },
 		{ "camlStdlib__array__map_154",
-		  "Stdlib.array.map" },
+		  "Stdlib.array.map_154" },
 		{ "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",
-		  "Stdlib.bytes.++" },
+		  "Stdlib.bytes.++_2205" },
 	};
 
 	for (i = 0; i < sizeof(test_cases) / sizeof(test_cases[0]); i++) {
diff --git a/tools/perf/util/demangle-ocaml.c b/tools/perf/util/demangle-ocaml.c
index 3df14e67c622..9d707bb60b4b 100644
--- a/tools/perf/util/demangle-ocaml.c
+++ b/tools/perf/util/demangle-ocaml.c
@@ -64,17 +64,5 @@ ocaml_demangle_sym(const char *sym)
 	}
 	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;
 }
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf tools: Preserve identifier id in OCaml demangler
  2021-02-26  7:52 [PATCH] perf tools: Preserve identifier id in OCaml demangler Fabian Hemmer
@ 2021-03-30 15:46 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-03-30 15:46 UTC (permalink / raw)
  To: Fabian Hemmer; +Cc: linux-perf-users, linux-kernel

Em Fri, Feb 26, 2021 at 02:52:23AM -0500, Fabian Hemmer escreveu:
> 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.

Sorry for the delay in processing, applied.

- Arnaldo
 
> Signed-off-by: Fabian Hemmer <copy@copy.sh>
> ---
>  tools/perf/tests/demangle-ocaml-test.c |  6 +++---
>  tools/perf/util/demangle-ocaml.c       | 12 ------------
>  2 files changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/tools/perf/tests/demangle-ocaml-test.c b/tools/perf/tests/demangle-ocaml-test.c
> index a273ed5163d7..1d232c2e2190 100644
> --- a/tools/perf/tests/demangle-ocaml-test.c
> +++ b/tools/perf/tests/demangle-ocaml-test.c
> @@ -19,11 +19,11 @@ int test__demangle_ocaml(struct test *test __maybe_unused, int subtest __maybe_u
>  		{ "main",
>  		  NULL },
>  		{ "camlStdlib__array__map_154",
> -		  "Stdlib.array.map" },
> +		  "Stdlib.array.map_154" },
>  		{ "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",
> -		  "Stdlib.bytes.++" },
> +		  "Stdlib.bytes.++_2205" },
>  	};
>  
>  	for (i = 0; i < sizeof(test_cases) / sizeof(test_cases[0]); i++) {
> diff --git a/tools/perf/util/demangle-ocaml.c b/tools/perf/util/demangle-ocaml.c
> index 3df14e67c622..9d707bb60b4b 100644
> --- a/tools/perf/util/demangle-ocaml.c
> +++ b/tools/perf/util/demangle-ocaml.c
> @@ -64,17 +64,5 @@ ocaml_demangle_sym(const char *sym)
>  	}
>  	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;
>  }
> -- 
> 2.30.1
> 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-30 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26  7:52 [PATCH] perf tools: Preserve identifier id in OCaml demangler Fabian Hemmer
2021-03-30 15:46 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).