From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Dima Kogan <dima@secretsauce.net>,
Masami Hiramatsu <mhiramat@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 0/2] Better error messages for 'perf probe --add'
Date: Tue, 16 Apr 2024 12:46:23 -0300 [thread overview]
Message-ID: <Zh6dT13FfgdHuMql@x1> (raw)
In-Reply-To: <20240416045533.162692-1-dima@secretsauce.net>
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.
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
>
next prev parent reply other threads:[~2024-04-16 15:46 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 ` Arnaldo Carvalho de Melo [this message]
2024-04-17 20:35 ` [PATCH 0/2] Better error messages for 'perf probe --add' Masami Hiramatsu
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=Zh6dT13FfgdHuMql@x1 \
--to=acme@kernel.org \
--cc=dima@secretsauce.net \
--cc=linux-perf-users@vger.kernel.org \
--cc=mhiramat@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.