From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Namhyung Kim <namhyung@kernel.org>
Subject: [PATCH 3/8] tools lib traceevent: If %s is a pointer, check printk formats
Date: Fri, 01 Nov 2013 17:53:55 -0400 [thread overview]
Message-ID: <20131101215500.698924777@goodmis.org> (raw)
In-Reply-To: 20131101215352.875376844@goodmis.org
[-- Attachment #1: 0003-tools-lib-traceevent-If-s-is-a-pointer-check-printk-.patch --]
[-- Type: text/plain, Size: 1387 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
If the format string of TP_printk() contains a %s, and the argument
is not a string, check if the argument is a pointer that might match
the printk_formats that were stored.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
tools/lib/traceevent/event-parse.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 856b791..013c8d3 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -3505,6 +3505,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
struct pevent *pevent = event->pevent;
struct print_flag_sym *flag;
struct format_field *field;
+ struct printk_map *printk;
unsigned long long val, fval;
unsigned long addr;
char *str;
@@ -3540,7 +3541,12 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
if (!(field->flags & FIELD_IS_ARRAY) &&
field->size == pevent->long_size) {
addr = *(unsigned long *)(data + field->offset);
- trace_seq_printf(s, "%lx", addr);
+ /* Check if it matches a print format */
+ printk = find_printk(pevent, addr);
+ if (printk)
+ trace_seq_puts(s, printk->printk);
+ else
+ trace_seq_printf(s, "%lx", addr);
break;
}
str = malloc(len + 1);
--
1.8.4.rc3
next prev parent reply other threads:[~2013-11-01 21:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 21:53 [PATCH 0/8] tools lib traceevent: Add changes from trace-cmd repo Steven Rostedt
2013-11-01 21:53 ` [PATCH 1/8] tools lib traceevent: Add support for extracting trace_clock in report Steven Rostedt
2013-11-01 21:53 ` [PATCH 2/8] tools lib traceevent: Update printk formats when entered Steven Rostedt
2013-11-04 20:22 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2013-11-01 21:53 ` Steven Rostedt [this message]
2013-11-04 20:22 ` [tip:perf/core] tools lib traceevent: If %s is a pointer, check printk formats tip-bot for Steven Rostedt (Red Hat)
2013-11-01 21:53 ` [PATCH 4/8] tools lib traceevent: Handle __print_hex(__get_dynamic_array(fieldname), len) Steven Rostedt
2013-11-01 21:53 ` [PATCH 5/8] tools lib traceevent: Have bprintk output the same as the kernel does Steven Rostedt
2013-11-04 20:23 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2013-11-01 21:53 ` [PATCH 6/8] tools lib traceevent: Check for spaces in character array Steven Rostedt
2013-11-04 20:23 ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2013-11-01 21:53 ` [PATCH 7/8] tools lib traceevent: Add flags NOHANDLE and PRINTRAW to individual events Steven Rostedt
2013-11-04 20:23 ` [tip:perf/core] " tip-bot for Steven Rostedt
2013-11-01 21:54 ` [PATCH 8/8] tools lib traceevent: Add pevent_print_func_field() helper function Steven Rostedt
2013-11-04 20:23 ` [tip:perf/core] tools lib traceevent: Add pevent_print_func_field () " tip-bot for Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131101215500.698924777@goodmis.org \
--to=rostedt@goodmis.org \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox