Better error messages for 'perf probe --add'
Status from this message: Thanks, applied to perf-tools-next,
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | perf probe-event: un-hardcoded sizeof(buf)tools/ | +2 | 0 replies | |
| 2/2 | perf probe-event: better error message for a too-long probe nametools/ | +1 | 0 replies |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Masami Hiramatsu (Google) |
|---|---|
| Series | A-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/2] Better error messages for 'perf probe --add'
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.
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(-)
Signature · 1 line
2.42.0