Re: [PATCH] perf probe: Improve C++ support in arguments

From: Namhyung Kim

Date: Wed Apr 01 2026 - 19:23:31 EST


On Wed, Apr 01, 2026 at 06:11:16PM -0300, Arnaldo Carvalho de Melo wrote:
> On Wed, Apr 01, 2026 at 02:03:42PM -0700, Ian Rogers wrote:
> > On Fri, Dec 5, 2025 at 4:36 AM Steinar H. Gunderson <sesse@xxxxxxxxxx> wrote:
> > >
> > > For purposes of specifying arguments in tracepoints, C++ classes
> > > work exactly like structs, and C++ references work almost exactly
> > > like pointers (they are dereferenced with . instead of ->).
> > > However, they use different tags in DWARF, which means you cannot
> > > use them in arguments.
> > >
> > > Implement support for both, based on the existing struct and pointer
> > > support. This allows us to to something like this in Chromium:
> > >
> > > perf probe --exec content_shell --add 'PerformanceMark=\
> > > _ZN5blink15PerformanceMark6CreateEPNS_11ScriptStateERKNS_12\
> > > AtomicStringEPNS_22PerformanceMarkOptionsERNS_14ExceptionStateE \
> > > mark_name.string_.impl_.ptr_'
> > >
> > > even though mark_name is an class AtomicString&.
> > >
> > > We don't support advanced C++ features, such as operator overloading.
> > > Unfortunately, we also don't support C++-style strings where there
> > > is a separate length field instead of null-termination. We also cannot
> > > go past ptr_ in the example above (e.g. add ->length_), due to
> > > unrelated DWARF issues.
> > >
> > > Signed-off-by: Steinar H. Gunderson <sesse@xxxxxxxxxx>
> > > Cc: Ian Rogers <irogers@xxxxxxxxxx>
> >
> > This change makes sense to me, Namhyung?
>
> Agreed, and there are some other C++ specific (Go as well), like
> DW_TAG_rvalue_reference_type, that we may want to support, also it would
> be great to have some extra workload in 'perf test -w' to have a shell
> testing this feature, no?

Yep, that would be great. I'm ok with the change but it needs to be
updated. Also I think we need a helper to check the compound types.

Thanks,
Namhyung