tracing/events: record the size of dynamic arrays
When a dynamic array is defined, we add __data_loc_foo in trace_entry to record the offset of the array, but the size of the array is not recorded, which causes 2 problems: - the event filter just compares the first 2 chars of the strings. - parsers can't parse dynamic arrays. So we encode the size of each dynamic array in the higher 16 bits of __data_loc_foo, while the offset is in lower 16 bits. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <4A5E964A.9000403@cn.fujitsu.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
@@ -176,11 +176,13 @@ static int filter_pred_string(struct filter_pred *pred, void *event,
|
||||
static int filter_pred_strloc(struct filter_pred *pred, void *event,
|
||||
int val1, int val2)
|
||||
{
|
||||
unsigned short str_loc = *(unsigned short *)(event + pred->offset);
|
||||
u32 str_item = *(u32 *)(event + pred->offset);
|
||||
int str_loc = str_item & 0xffff;
|
||||
int str_len = str_item >> 16;
|
||||
char *addr = (char *)(event + str_loc);
|
||||
int cmp, match;
|
||||
|
||||
cmp = strncmp(addr, pred->str_val, pred->str_len);
|
||||
cmp = strncmp(addr, pred->str_val, str_len);
|
||||
|
||||
match = (!cmp) ^ pred->not;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user