From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Dima Kogan <dima@secretsauce.net>, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 0/2] Better error messages for 'perf probe --add'
Date: Thu, 18 Apr 2024 05:35:37 +0900 [thread overview]
Message-ID: <20240418053537.7ba9c7a8d256987521ea1593@kernel.org> (raw)
In-Reply-To: <Zh6dT13FfgdHuMql@x1>
On Tue, 16 Apr 2024 12:46:23 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> On Mon, Apr 15, 2024 at 09:55:09PM -0700, Dima Kogan wrote:
> > Hi.
> >
> > I tried to add some userspace probes to some C++ code, and got this:
> >
> > $ sudo perf probe -x tst --add _ZN.....
> > Error: Failed to add events.
>
> Both patches look great, Masami, can I have your Acked-by?
>
> If you find other cases where the error messages can be improved, feel
> free to send us, please CC Masami, as I'm doing now.
Yeah, looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thank you,
>
> Thanks!
>
> - Rrnaldo
>
> > Note the completely non-useful error message. The issue is that the C++ symbol
> > mangling can create very loooong symbol names, causing perf to try to use very
> > long probe names by default, causing this problem. It took a little while to
> > figure this out, and a better error message would have helped, hence these
> > patches.
> >
> > To reproduce, here's a tst.cc:
> >
> > #include <stdio.h>
> >
> > namespace n1111111111111111111111111111111111111111111111111111111111111111 {
> > namespace n2222222222222222222222222222222222222222222222222222222222222222 {
> >
> > void f(void)
> > {
> > printf("f()\n");
> > }
> > }
> > }
> >
> > int main(void)
> > {
> > n1111111111111111111111111111111111111111111111111111111111111111::n2222222222222222222222222222222222222222222222222222222222222222::f();
> > n1111111111111111111111111111111111111111111111111111111111111111::n2222222222222222222222222222222222222222222222222222222222222222::f();
> > return 0;
> > }
> >
> > I then
> >
> > g++ -g -o tst tst.cc
> >
> > and
> >
> > sudo perf probe -x ~/tmp/tst --add _ZN65n111111111111111111111111111111111111111111111111111111111111111165n22222222222222222222222222222222222222222222222222222222222222221fEv
> >
> > After the patch a better error message results, and the workaround is clear:
> >
> > sudo perf probe -x ~/tmp/tst --add probe=_ZN65n111111111111111111111111111111111111111111111111111111111111111165n22222222222222222222222222222222222222222222222222222222222222221fEv
> >
> > Dima Kogan (2):
> > perf probe-event: un-hardcoded sizeof(buf)
> > perf probe-event: better error message for a too-long probe name
> >
> > tools/perf/util/probe-event.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > --
> > 2.42.0
> >
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2024-04-17 20:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 4:55 [PATCH 0/2] Better error messages for 'perf probe --add' Dima Kogan
2024-04-16 4:55 ` [PATCH 1/2] perf probe-event: un-hardcoded sizeof(buf) Dima Kogan
2024-04-16 4:55 ` [PATCH 2/2] perf probe-event: better error message for a too-long probe name Dima Kogan
2024-04-16 15:46 ` [PATCH 0/2] Better error messages for 'perf probe --add' Arnaldo Carvalho de Melo
2024-04-17 20:35 ` Masami Hiramatsu [this message]
2024-04-18 14:24 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240418053537.7ba9c7a8d256987521ea1593@kernel.org \
--to=mhiramat@kernel.org \
--cc=acme@kernel.org \
--cc=dima@secretsauce.net \
--cc=linux-perf-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).