tools lib traceevent: Add support for "%.*s" in bprintk events
The arg notation of '*' in bprintks is not handled by the parser. Implement it so that they show up properly in the output and do not kill the tracer from reporting events. Reported-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/n/tip-t0ctq7t1xz3ud6wv4v886jou@git.kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
e84c282b40
commit
c2e6dc2b26
|
@ -3370,7 +3370,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PRINT_BSTRING:
|
case PRINT_BSTRING:
|
||||||
trace_seq_printf(s, format, arg->string.string);
|
print_str_to_seq(s, format, len_arg, arg->string.string);
|
||||||
break;
|
break;
|
||||||
case PRINT_OP:
|
case PRINT_OP:
|
||||||
/*
|
/*
|
||||||
|
@ -3471,6 +3471,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
|
||||||
unsigned long long ip, val;
|
unsigned long long ip, val;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
void *bptr;
|
void *bptr;
|
||||||
|
int vsize;
|
||||||
|
|
||||||
field = pevent->bprint_buf_field;
|
field = pevent->bprint_buf_field;
|
||||||
ip_field = pevent->bprint_ip_field;
|
ip_field = pevent->bprint_ip_field;
|
||||||
|
@ -3519,6 +3520,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
|
||||||
goto process_again;
|
goto process_again;
|
||||||
case '0' ... '9':
|
case '0' ... '9':
|
||||||
goto process_again;
|
goto process_again;
|
||||||
|
case '.':
|
||||||
|
goto process_again;
|
||||||
case 'p':
|
case 'p':
|
||||||
ls = 1;
|
ls = 1;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
@ -3526,23 +3529,29 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
|
||||||
case 'u':
|
case 'u':
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'i':
|
case 'i':
|
||||||
|
switch (ls) {
|
||||||
|
case 0:
|
||||||
|
vsize = 4;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
vsize = pevent->long_size;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
vsize = 8;
|
||||||
|
default:
|
||||||
|
vsize = ls; /* ? */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
|
case '*':
|
||||||
|
if (*ptr == '*')
|
||||||
|
vsize = 4;
|
||||||
|
|
||||||
/* the pointers are always 4 bytes aligned */
|
/* the pointers are always 4 bytes aligned */
|
||||||
bptr = (void *)(((unsigned long)bptr + 3) &
|
bptr = (void *)(((unsigned long)bptr + 3) &
|
||||||
~3);
|
~3);
|
||||||
switch (ls) {
|
val = pevent_read_number(pevent, bptr, vsize);
|
||||||
case 0:
|
bptr += vsize;
|
||||||
ls = 4;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
ls = pevent->long_size;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ls = 8;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
val = pevent_read_number(pevent, bptr, ls);
|
|
||||||
bptr += ls;
|
|
||||||
arg = alloc_arg();
|
arg = alloc_arg();
|
||||||
arg->next = NULL;
|
arg->next = NULL;
|
||||||
arg->type = PRINT_ATOM;
|
arg->type = PRINT_ATOM;
|
||||||
|
@ -3550,6 +3559,13 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
|
||||||
sprintf(arg->atom.atom, "%lld", val);
|
sprintf(arg->atom.atom, "%lld", val);
|
||||||
*next = arg;
|
*next = arg;
|
||||||
next = &arg->next;
|
next = &arg->next;
|
||||||
|
/*
|
||||||
|
* The '*' case means that an arg is used as the length.
|
||||||
|
* We need to continue to figure out for what.
|
||||||
|
*/
|
||||||
|
if (*ptr == '*')
|
||||||
|
goto process_again;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
arg = alloc_arg();
|
arg = alloc_arg();
|
||||||
|
|
Reference in New Issue