Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312316
b: refs/heads/master
c: 600da3c
h: refs/heads/master
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Jun 29, 2012
1 parent ed1475e commit b8bf726
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 860df5833e461beba4bf9f3304a7919da98fd789
refs/heads/master: 600da3cfe19496485c5d8d52ff703590a0bd53f6
14 changes: 13 additions & 1 deletion trunk/tools/lib/traceevent/event-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3589,6 +3589,16 @@ static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size,
trace_seq_printf(s, fmt, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
}

static int is_printable_array(char *p, unsigned int len)
{
unsigned int i;

for (i = 0; i < len && p[i]; i++)
if (!isprint(p[i]))
return 0;
return 1;
}

static void print_event_fields(struct trace_seq *s, void *data, int size,
struct event_format *event)
{
Expand All @@ -3608,7 +3618,8 @@ static void print_event_fields(struct trace_seq *s, void *data, int size,
len = offset >> 16;
offset &= 0xffff;
}
if (field->flags & FIELD_IS_STRING) {
if (field->flags & FIELD_IS_STRING &&
is_printable_array(data + offset, len)) {
trace_seq_printf(s, "%s", (char *)data + offset);
} else {
trace_seq_puts(s, "ARRAY[");
Expand All @@ -3619,6 +3630,7 @@ static void print_event_fields(struct trace_seq *s, void *data, int size,
*((unsigned char *)data + offset + i));
}
trace_seq_putc(s, ']');
field->flags &= ~FIELD_IS_STRING;
}
} else {
val = pevent_read_number(event->pevent, data + field->offset,
Expand Down

0 comments on commit b8bf726

Please sign in to comment.