]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf probe: Improve log for long event name failure
authorLeo Yan <leo.yan@arm.com>
Sat, 12 Oct 2024 20:47:25 +0000 (21:47 +0100)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 17 Oct 2024 16:55:59 +0000 (09:55 -0700)
commite34f6ac511be5347b270e42a7a23a4569ea74bc2
treeffddef5371aac66f556f9ca7166735600739e86f
parent6768faf9b70eec01c3c6d685b4f39049c561dbda
perf probe: Improve log for long event name failure

If a symbol name is longer than the maximum event length (64 bytes), the
perf tool reports error:

  # perf probe -x test_cpp_mangle --add "this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyz(int)"
    snprintf() failed: -7; the event name nbase='this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyz(int)' is too long
    Error: Failed to add events.

An information is missed in the log that the symbol name and the event
name can be set separately. Especially, this is recommended for adding
probe for a long symbol.

This commit refines the log for reminding event syntax.

After:

  # perf probe -x test_cpp_mangle --add "this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyz(int)"
    snprintf() failed: -7; the event name 'this_is_a_very_very_long_print_data_abcdefghijklmnopqrstuvwxyz(int)' is too long
      Hint: Set a shorter event with syntax "EVENT=PROBEDEF"
            EVENT: Event name (max length: 64 bytes).
      Error: Failed to add events.

Signed-off-by: Leo Yan <leo.yan@arm.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Link: https://lore.kernel.org/r/20241012204725.928794-4-leo.yan@arm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/probe-event.c