|
@@ -163,6 +163,20 @@ static int filter_pred_string(struct filter_pred *pred, void *event,
|
|
|
return match;
|
|
|
}
|
|
|
|
|
|
+/* Filter predicate for char * pointers */
|
|
|
+static int filter_pred_pchar(struct filter_pred *pred, void *event,
|
|
|
+ int val1, int val2)
|
|
|
+{
|
|
|
+ char **addr = (char **)(event + pred->offset);
|
|
|
+ int cmp, match;
|
|
|
+
|
|
|
+ cmp = strncmp(*addr, pred->str_val, pred->str_len);
|
|
|
+
|
|
|
+ match = (!cmp) ^ pred->not;
|
|
|
+
|
|
|
+ return match;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* Filter predicate for dynamic sized arrays of characters.
|
|
|
* These are implemented through a list of strings at the end
|
|
@@ -489,7 +503,8 @@ int filter_assign_type(const char *type)
|
|
|
static bool is_string_field(struct ftrace_event_field *field)
|
|
|
{
|
|
|
return field->filter_type == FILTER_DYN_STRING ||
|
|
|
- field->filter_type == FILTER_STATIC_STRING;
|
|
|
+ field->filter_type == FILTER_STATIC_STRING ||
|
|
|
+ field->filter_type == FILTER_PTR_STRING;
|
|
|
}
|
|
|
|
|
|
static int is_legal_op(struct ftrace_event_field *field, int op)
|
|
@@ -579,11 +594,16 @@ static int filter_add_pred(struct filter_parse_state *ps,
|
|
|
}
|
|
|
|
|
|
if (is_string_field(field)) {
|
|
|
+ pred->str_len = field->size;
|
|
|
+
|
|
|
if (field->filter_type == FILTER_STATIC_STRING)
|
|
|
fn = filter_pred_string;
|
|
|
- else
|
|
|
+ else if (field->filter_type == FILTER_DYN_STRING)
|
|
|
fn = filter_pred_strloc;
|
|
|
- pred->str_len = field->size;
|
|
|
+ else {
|
|
|
+ fn = filter_pred_pchar;
|
|
|
+ pred->str_len = strlen(pred->str_val);
|
|
|
+ }
|
|
|
} else {
|
|
|
if (field->is_signed)
|
|
|
ret = strict_strtoll(pred->str_val, 0, &val);
|