Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf list: Escape '\r' in JSON output

Events like for sapphirerapids have '\r' in the uncore descriptions. The
non-escaped versions of this fail JSON validation the the 'perf list'
test.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240410222353.1722840-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
20b0027c 0ffc8fca

+3
+3
tools/perf/builtin-list.c
··· 326 326 case '\n': 327 327 strbuf_addstr(buf, "\\n"); 328 328 break; 329 + case '\r': 330 + strbuf_addstr(buf, "\\r"); 331 + break; 329 332 case '\\': 330 333 fallthrough; 331 334 case '\"':