[PATCH v2 0/6] Use rustc-demangle for Rust demangling

Ian Rogers posted 6 patches 4 months, 1 week ago
tools/perf/tests/Build                   |    1 +
tools/perf/tests/builtin-test.c          |    1 +
tools/perf/tests/demangle-java-test.c    |   17 +-
tools/perf/tests/demangle-ocaml-test.c   |    7 +-
tools/perf/tests/demangle-rust-v0-test.c |   74 +
tools/perf/tests/tests.h                 |    1 +
tools/perf/util/Build                    |    5 +-
tools/perf/util/demangle-rust-v0.c       | 2042 ++++++++++++++++++++++
tools/perf/util/demangle-rust-v0.h       |   88 +
tools/perf/util/demangle-rust.c          |  269 ---
tools/perf/util/demangle-rust.h          |    8 -
tools/perf/util/symbol-elf.c             |   49 +-
12 files changed, 2257 insertions(+), 305 deletions(-)
create mode 100644 tools/perf/tests/demangle-rust-v0-test.c
create mode 100644 tools/perf/util/demangle-rust-v0.c
create mode 100644 tools/perf/util/demangle-rust-v0.h
delete mode 100644 tools/perf/util/demangle-rust.c
delete mode 100644 tools/perf/util/demangle-rust.h
[PATCH v2 0/6] Use rustc-demangle for Rust demangling
Posted by Ian Rogers 4 months, 1 week ago
Discussion of improved Rust demangling started with:
https://lore.kernel.org/lkml/jgxfnphfo3nzlfipnuuzdlfc4ehbr2tnh2evz3mdhynd6wvrsu@fcz6vrvepybb/
that led to implementing a Rust v0 demangler:
https://lore.kernel.org/lkml/20250129193037.573431-1-irogers@google.com/
Discussion on that patch series led to the rust-lang issue:
https://github.com/rust-lang/rust/issues/60705
where the pre-existing Rust C demangler, authored by Ariel Ben-Yehuda
 <ariel.byd@gmail.com>, was mentioned. There wasn't progress on that
issue and so I've pulled that work into perf as discussed on the
issue.

v2: Changes to references from arielb1 to "Ariel Ben Yehuda
    <ariel.byd@gmail.com>", license tidying as suggested by Miguel
    Ojeda" <ojeda@kernel.org>. Don't change from alternate demangling
    flag from false to true in the test change, make it true from the
    beginning (patch 2).

Ian Rogers (6):
  perf demangle-rust: Add rustc-demangle C demangler
  perf symbol-elf: Integrate rust-v0 demangling
  perf demangle-rust: Remove previous legacy rust decoder
  perf test demangle-rust: Add Rust demangling test
  perf test demangle-java: Switch to using dso__demangle_sym
  perf test demangle-ocaml: Switch to using dso__demangle_sym

 tools/perf/tests/Build                   |    1 +
 tools/perf/tests/builtin-test.c          |    1 +
 tools/perf/tests/demangle-java-test.c    |   17 +-
 tools/perf/tests/demangle-ocaml-test.c   |    7 +-
 tools/perf/tests/demangle-rust-v0-test.c |   74 +
 tools/perf/tests/tests.h                 |    1 +
 tools/perf/util/Build                    |    5 +-
 tools/perf/util/demangle-rust-v0.c       | 2042 ++++++++++++++++++++++
 tools/perf/util/demangle-rust-v0.h       |   88 +
 tools/perf/util/demangle-rust.c          |  269 ---
 tools/perf/util/demangle-rust.h          |    8 -
 tools/perf/util/symbol-elf.c             |   49 +-
 12 files changed, 2257 insertions(+), 305 deletions(-)
 create mode 100644 tools/perf/tests/demangle-rust-v0-test.c
 create mode 100644 tools/perf/util/demangle-rust-v0.c
 create mode 100644 tools/perf/util/demangle-rust-v0.h
 delete mode 100644 tools/perf/util/demangle-rust.c
 delete mode 100644 tools/perf/util/demangle-rust.h

-- 
2.49.0.901.g37484f566f-goog
Re: [PATCH v2 0/6] Use rustc-demangle for Rust demangling
Posted by Arnaldo Carvalho de Melo 3 months, 4 weeks ago
On Tue, Apr 29, 2025 at 05:41:22PM -0700, Ian Rogers wrote:
> Discussion of improved Rust demangling started with:
> https://lore.kernel.org/lkml/jgxfnphfo3nzlfipnuuzdlfc4ehbr2tnh2evz3mdhynd6wvrsu@fcz6vrvepybb/
> that led to implementing a Rust v0 demangler:
> https://lore.kernel.org/lkml/20250129193037.573431-1-irogers@google.com/
> Discussion on that patch series led to the rust-lang issue:
> https://github.com/rust-lang/rust/issues/60705
> where the pre-existing Rust C demangler, authored by Ariel Ben-Yehuda
>  <ariel.byd@gmail.com>, was mentioned. There wasn't progress on that
> issue and so I've pulled that work into perf as discussed on the
> issue.
> 
> v2: Changes to references from arielb1 to "Ariel Ben Yehuda
>     <ariel.byd@gmail.com>", license tidying as suggested by Miguel
>     Ojeda" <ojeda@kernel.org>. Don't change from alternate demangling
>     flag from false to true in the test change, make it true from the
>     beginning (patch 2).
> 
> Ian Rogers (6):
>   perf demangle-rust: Add rustc-demangle C demangler
>   perf symbol-elf: Integrate rust-v0 demangling
>   perf demangle-rust: Remove previous legacy rust decoder
>   perf test demangle-rust: Add Rust demangling test
>   perf test demangle-java: Switch to using dso__demangle_sym
>   perf test demangle-ocaml: Switch to using dso__demangle_sym

I'm fixing these up, ok?

  ✗ BADSIG: DKIM/google.com
---
Total patches: 6
---
Cover: ./v2_20250429_irogers_use_rustc_demangle_for_rust_demangling.cover
 Link: https://lore.kernel.org/r/20250430004128.474388-1-irogers@google.com
 Base: applies clean to current tree
       git checkout -b v2_20250429_irogers_google_com HEAD
       git am ./v2_20250429_irogers_use_rustc_demangle_for_rust_demangling.mbx
⬢ [acme@toolbx perf-tools-next]$        git am ./v2_20250429_irogers_use_rustc_demangle_for_rust_demangling.mbx
Applying: perf demangle-rust: Add rustc-demangle C demangler
.git/rebase-apply/patch:1098: trailing whitespace.
    
.git/rebase-apply/patch:1363: trailing whitespace.
    
.git/rebase-apply/patch:1474: trailing whitespace.
    default: 
.git/rebase-apply/patch:1791: trailing whitespace.
        { NULL }, 
.git/rebase-apply/patch:1814: trailing whitespace.
        // From here on, inner contains a pointer to the next element, rest[:len] to the current one        
warning: squelched 4 whitespace errors
warning: 9 lines add whitespace errors.
Applying: perf symbol-elf: Integrate rust-v0 demangling
Applying: perf demangle-rust: Remove previous legacy rust decoder
Applying: perf test demangle-rust: Add Rust demangling test
Applying: perf test demangle-java: Switch to using dso__demangle_sym
Applying: perf test demangle-ocaml: Switch to using dso__demangle_sym
⬢ [acme@toolbx perf-tools-next]$

Applied.

- Arnaldo