diff options
author | Howard Cochran <hcochran@lexmark.com> | 2013-11-01 17:53:56 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-04 12:34:43 -0500 |
commit | b30f75eba27a9ab0704cbc501e9be3b025ce56fe (patch) | |
tree | 37b19d95f7a22110ea8efe836b47cbedc6485730 /tools/lib/traceevent/event-parse.c | |
parent | 0970b5f438261216afcd0ccaa2fcfffc83df7ca2 (diff) |
tools lib traceevent: Handle __print_hex(__get_dynamic_array(fieldname), len)
The kernel has a few events with a format similar to this excerpt:
field:unsigned int len; offset:12; size:4; signed:0;
field:__data_loc unsigned char[] data_array; offset:16; size:4; signed:0;
print fmt: "%s", __print_hex(__get_dynamic_array(data_array), REC->len)
trace-cmd could already parse that arg correctly, but print_str_arg()
was unable to handle the first parameter being a dynamic array. (It
just printed a "field not found" warning).
Teach print_str_arg's PRINT_HEX case to handle the nested
PRINT_DYNAMIC_ARRAY correctly. The output now matches the kernel's own
formatting for this case.
Signed-off-by: Howard Cochran <hcochran@lexmark.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1381503349-12271-1-git-send-email-hcochran@lexmark.com
[ Removed "polish compare", we don't do that here ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/traceevent/event-parse.c')
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index 013c8d3db806..0a1ffe07de3f 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c | |||
@@ -3588,15 +3588,23 @@ static void print_str_arg(struct trace_seq *s, void *data, int size, | |||
3588 | } | 3588 | } |
3589 | break; | 3589 | break; |
3590 | case PRINT_HEX: | 3590 | case PRINT_HEX: |
3591 | field = arg->hex.field->field.field; | 3591 | if (arg->hex.field->type == PRINT_DYNAMIC_ARRAY) { |
3592 | if (!field) { | 3592 | unsigned long offset; |
3593 | str = arg->hex.field->field.name; | 3593 | offset = pevent_read_number(pevent, |
3594 | field = pevent_find_any_field(event, str); | 3594 | data + arg->hex.field->dynarray.field->offset, |
3595 | if (!field) | 3595 | arg->hex.field->dynarray.field->size); |
3596 | goto out_warning_field; | 3596 | hex = data + (offset & 0xffff); |
3597 | arg->hex.field->field.field = field; | 3597 | } else { |
3598 | field = arg->hex.field->field.field; | ||
3599 | if (!field) { | ||
3600 | str = arg->hex.field->field.name; | ||
3601 | field = pevent_find_any_field(event, str); | ||
3602 | if (!field) | ||
3603 | goto out_warning_field; | ||
3604 | arg->hex.field->field.field = field; | ||
3605 | } | ||
3606 | hex = data + field->offset; | ||
3598 | } | 3607 | } |
3599 | hex = data + field->offset; | ||
3600 | len = eval_num_arg(data, size, event, arg->hex.size); | 3608 | len = eval_num_arg(data, size, event, arg->hex.size); |
3601 | for (i = 0; i < len; i++) { | 3609 | for (i = 0; i < len; i++) { |
3602 | if (i) | 3610 | if (i) |