perf probe-event: Better error message for a too-long probe name
authorDima Kogan <dima@secretsauce.net>
Tue, 16 Apr 2024 04:55:11 +0000 (21:55 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 19 Apr 2024 01:22:51 +0000 (22:22 -0300)
This is a common failure mode when probing userspace C++ code (where the
mangling adds significant length to the symbol names).

Prior to this patch, only a very generic error message is produced,
making the user guess at what the issue is.

Signed-off-by: Dima Kogan <dima@secretsauce.net>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20240416045533.162692-3-dima@secretsauce.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/probe-event.c

index c1dbad8a83dcbc597767cfad12a3fa34dd6de62f..8a73c9464b709b981bf5073d0386699380bbab4f 100644 (file)
@@ -2758,7 +2758,7 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
        /* Try no suffix number */
        ret = e_snprintf(buf, len, "%s%s", nbase, ret_event ? "__return" : "");
        if (ret < 0) {
-               pr_debug("snprintf() failed: %d\n", ret);
+               pr_warning("snprintf() failed: %d; the event name nbase='%s' is too long\n", ret, nbase);
                goto out;
        }
        if (!strlist__has_entry(namelist, buf))