From c9a8d34ec1f2c36e5e58153d91cfe1f485b902d8 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 14 Oct 2009 15:43:33 -0400 Subject: [PATCH] --- yaml --- r: 169495 b: refs/heads/master c: 91ff2bc191827f0d3f5ad0a433ff7df7d2dd9aee h: refs/heads/master i: 169493: fa8becd7e0dc490ee5edbcd2ad5cbcdd22c10b41 169491: 888d12f029674cbb78d5d71e36dd237b913b8b9c 169487: cf644a8db105b1596be4b0f08d358e150d68c296 v: v3 --- [refs] | 2 +- trunk/tools/perf/util/trace-event-parse.c | 27 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 6ebded3e9a2f..78506490e398 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 924a79af2cdee26a034b9bdce8c9c76995b5c901 +refs/heads/master: 91ff2bc191827f0d3f5ad0a433ff7df7d2dd9aee diff --git a/trunk/tools/perf/util/trace-event-parse.c b/trunk/tools/perf/util/trace-event-parse.c index a05c7144aded..2b75ec2f57e8 100644 --- a/trunk/tools/perf/util/trace-event-parse.c +++ b/trunk/tools/perf/util/trace-event-parse.c @@ -522,7 +522,10 @@ static enum event_type __read_token(char **tok) last_ch = ch; ch = __read_char(); buf[i++] = ch; - } while (ch != quote_ch && last_ch != '\\'); + /* the '\' '\' will cancel itself */ + if (ch == '\\' && last_ch == '\\') + last_ch = 0; + } while (ch != quote_ch || last_ch == '\\'); /* remove the last quote */ i--; goto out; @@ -2325,7 +2328,27 @@ static void pretty_print(void *data, int size, struct event *event) for (; *ptr; ptr++) { ls = 0; - if (*ptr == '%') { + if (*ptr == '\\') { + ptr++; + switch (*ptr) { + case 'n': + printf("\n"); + break; + case 't': + printf("\t"); + break; + case 'r': + printf("\r"); + break; + case '\\': + printf("\\"); + break; + default: + printf("%c", *ptr); + break; + } + + } else if (*ptr == '%') { saveptr = ptr; show_func = 0; cont_process: