[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWcbrzNwD4NYzEUiY2d6f2cUYSMLMxZfh5we_82gVqD=A@mail.gmail.com>
Date: Thu, 30 Jan 2025 08:04:40 -0800
From: Ian Rogers <irogers@...gle.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, James Clark <james.clark@...aro.org>,
Howard Chu <howardchu95@...il.com>, Ravi Bangoria <ravi.bangoria@....com>,
"Masami Hiramatsu (Google)" <mhiramat@...nel.org>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org, rust-for-linux@...r.kernel.org,
Daniel Xu <dxu@...uu.xyz>
Subject: Re: [PATCH v1] perf symbol: Add rust v0 demangling support
On Thu, Jan 30, 2025 at 12:40 AM Alice Ryhl <aliceryhl@...gle.com> wrote:
>
> On Wed, Jan 29, 2025 at 8:30 PM Ian Rogers <irogers@...gle.com> wrote:
> >
> > Implement symbol demangling based on:
> > https://doc.rust-lang.org/rustc/symbol-mangling/index.html
> >
> > Ensure recommended demangling examples match the expectations in the
> > documentation.
> >
> > This was requested by Daniel Xu <dxu@...uu.xyz> in:
> > https://lore.kernel.org/lkml/jgxfnphfo3nzlfipnuuzdlfc4ehbr2tnh2evz3mdhynd6wvrsu@fcz6vrvepybb/
> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > ---
> > This change is on top of the 18 patch v3 series:
> > https://lore.kernel.org/lkml/20250122174308.350350-1-irogers@google.com/
> > ---
[..snip..]
> > +static int test__demangle_rust(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
> > +{
> > + int ret = TEST_OK;
> > + char *buf = NULL;
> > + size_t i;
> > +
> > + struct {
> > + const char *mangled, *demangled;
> > + } test_cases[] = {
> > + { "_RNvMsr_NtCs3ssYzQotkvD_3std4pathNtB5_7PathBuf3newCs15kBYyAo9fc_7mycrate",
> > + "<std::path::PathBuf>::new" },
>
> I think you would normally not have the < and > here? I usually only
> see that when you do <type as trait>.
Thanks Alice! The example comes from here:
https://doc.rust-lang.org/rustc/symbol-mangling/v0.html#symbol-name
so maybe it is just trying to show what the mangling can do rather
than show an actual symbol. Fwiw, I did compare the output with that
from rustfilt and it matches.
On the Rust bug for this change:
https://github.com/rust-lang/rust/issues/60705
it was pointed out that using:
https://github.com/rust-lang/rustc-demangle/blob/main/crates/native-c/src/demangle.c
that supports legacy and v0 symbols would probably be better than this
patch. It would be nice if that code's author could contribute it.
Thanks,
Ian
> Alice
Powered by blists - more mailing lists