tools lib traceevent: Let filtering numbers by string use function names
As a pointer can be converted into a function name, let the filters work with the function name as well as with the pointer number. If the comparison expects a string, then convert numbers into functions, but only when the number is the same size as a long. Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/n/tip-oxsa1qkr2eq7u8d7r0aapedu@git.kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
committed by
Namhyung Kim
parent
17d7a1123f
commit
e84c282b40
@@ -1710,7 +1710,15 @@ static int test_num(struct event_format *event,
|
|||||||
|
|
||||||
static const char *get_field_str(struct filter_arg *arg, struct pevent_record *record)
|
static const char *get_field_str(struct filter_arg *arg, struct pevent_record *record)
|
||||||
{
|
{
|
||||||
const char *val = record->data + arg->str.field->offset;
|
struct event_format *event;
|
||||||
|
struct pevent *pevent;
|
||||||
|
unsigned long long addr;
|
||||||
|
const char *val = NULL;
|
||||||
|
char hex[64];
|
||||||
|
|
||||||
|
/* If the field is not a string convert it */
|
||||||
|
if (arg->str.field->flags & FIELD_IS_STRING) {
|
||||||
|
val = record->data + arg->str.field->offset;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to copy the data since we can't be sure the field
|
* We need to copy the data since we can't be sure the field
|
||||||
@@ -1722,6 +1730,23 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *r
|
|||||||
/* the buffer is already NULL terminated */
|
/* the buffer is already NULL terminated */
|
||||||
val = arg->str.buffer;
|
val = arg->str.buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
event = arg->str.field->event;
|
||||||
|
pevent = event->pevent;
|
||||||
|
addr = get_value(event, arg->str.field, record);
|
||||||
|
|
||||||
|
if (arg->str.field->flags & (FIELD_IS_POINTER | FIELD_IS_LONG))
|
||||||
|
/* convert to a kernel symbol */
|
||||||
|
val = pevent_find_function(pevent, addr);
|
||||||
|
|
||||||
|
if (val == NULL) {
|
||||||
|
/* just use the hex of the string name */
|
||||||
|
snprintf(hex, 64, "0x%llx", addr);
|
||||||
|
val = hex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user