summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-list.c
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2024-04-11 01:23:53 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2024-04-12 23:54:02 +0300
commit20b0027ca1a7ee3b6811f4d67c6015483c6bb456 (patch)
tree8b8a3f3ed690cf2803900a469b8505b1a592431f /tools/perf/builtin-list.c
parent0ffc8fca5c15a70f32c8aff12c566bbd3991bd0a (diff)
downloadlinux-20b0027ca1a7ee3b6811f4d67c6015483c6bb456.tar.xz
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>
Diffstat (limited to 'tools/perf/builtin-list.c')
-rw-r--r--tools/perf/builtin-list.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index e0fe3d178d63..5cab31231551 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -326,6 +326,9 @@ static void fix_escape_fprintf(FILE *fp, struct strbuf *buf, const char *fmt, ..
case '\n':
strbuf_addstr(buf, "\\n");
break;
+ case '\r':
+ strbuf_addstr(buf, "\\r");
+ break;
case '\\':
fallthrough;
case '\"':