Lines Matching refs:filt

2053 static void addr_filter__free_str(struct addr_filter *filt)  in addr_filter__free_str()  argument
2055 zfree(&filt->str); in addr_filter__free_str()
2056 filt->action = NULL; in addr_filter__free_str()
2057 filt->sym_from = NULL; in addr_filter__free_str()
2058 filt->sym_to = NULL; in addr_filter__free_str()
2059 filt->filename = NULL; in addr_filter__free_str()
2064 struct addr_filter *filt = zalloc(sizeof(*filt)); in addr_filter__new() local
2066 if (filt) in addr_filter__new()
2067 INIT_LIST_HEAD(&filt->list); in addr_filter__new()
2069 return filt; in addr_filter__new()
2072 static void addr_filter__free(struct addr_filter *filt) in addr_filter__free() argument
2074 if (filt) in addr_filter__free()
2075 addr_filter__free_str(filt); in addr_filter__free()
2076 free(filt); in addr_filter__free()
2080 struct addr_filter *filt) in addr_filters__add() argument
2082 list_add_tail(&filt->list, &filts->head); in addr_filters__add()
2087 struct addr_filter *filt) in addr_filters__del() argument
2089 list_del_init(&filt->list); in addr_filters__del()
2101 struct addr_filter *filt, *n; in addr_filters__exit() local
2103 list_for_each_entry_safe(filt, n, &filts->head, list) { in addr_filters__exit()
2104 addr_filters__del(filts, filt); in addr_filters__exit()
2105 addr_filter__free(filt); in addr_filters__exit()
2145 static int parse_action(struct addr_filter *filt) in parse_action() argument
2147 if (!strcmp(filt->action, "filter")) { in parse_action()
2148 filt->start = true; in parse_action()
2149 filt->range = true; in parse_action()
2150 } else if (!strcmp(filt->action, "start")) { in parse_action()
2151 filt->start = true; in parse_action()
2152 } else if (!strcmp(filt->action, "stop")) { in parse_action()
2153 filt->start = false; in parse_action()
2154 } else if (!strcmp(filt->action, "tracestop")) { in parse_action()
2155 filt->start = false; in parse_action()
2156 filt->range = true; in parse_action()
2157 filt->action += 5; /* Change 'tracestop' to 'stop' */ in parse_action()
2205 static int parse_one_filter(struct addr_filter *filt, const char **filter_inp) in parse_one_filter() argument
2210 filt->str = fstr = strdup(*filter_inp); in parse_one_filter()
2214 err = parse_num_or_str(&fstr, NULL, &filt->action, " "); in parse_one_filter()
2218 err = parse_action(filt); in parse_one_filter()
2222 err = parse_addr_size(&fstr, &filt->addr, &filt->sym_from, in parse_one_filter()
2223 &filt->sym_from_idx); in parse_one_filter()
2231 err = parse_addr_size(&fstr, &filt->size, &filt->sym_to, in parse_one_filter()
2232 &filt->sym_to_idx); in parse_one_filter()
2235 filt->range = true; in parse_one_filter()
2242 err = parse_num_or_str(&fstr, NULL, &filt->filename, " ,"); in parse_one_filter()
2249 *filter_inp += fstr - filt->str; in parse_one_filter()
2254 addr_filter__free_str(filt); in parse_one_filter()
2262 struct addr_filter *filt; in addr_filters__parse_bare_filter() local
2267 filt = addr_filter__new(); in addr_filters__parse_bare_filter()
2268 err = parse_one_filter(filt, &fstr); in addr_filters__parse_bare_filter()
2270 addr_filter__free(filt); in addr_filters__parse_bare_filter()
2274 addr_filters__add(filts, filt); in addr_filters__parse_bare_filter()
2414 static int addr_filter__entire_kernel(struct addr_filter *filt) in addr_filter__entire_kernel() argument
2425 filt->addr = args.start; in addr_filter__entire_kernel()
2426 filt->size = args.size; in addr_filter__entire_kernel()
2431 static int check_end_after_start(struct addr_filter *filt, u64 start, u64 size) in check_end_after_start() argument
2433 if (start + size >= filt->addr) in check_end_after_start()
2436 if (filt->sym_from) { in check_end_after_start()
2438 filt->sym_to, start, filt->sym_from, filt->addr); in check_end_after_start()
2441 filt->sym_to, start, filt->addr); in check_end_after_start()
2447 static int addr_filter__resolve_kernel_syms(struct addr_filter *filt) in addr_filter__resolve_kernel_syms() argument
2458 if (filt->sym_from && !strcmp(filt->sym_from, "*")) in addr_filter__resolve_kernel_syms()
2459 return addr_filter__entire_kernel(filt); in addr_filter__resolve_kernel_syms()
2461 if (filt->sym_from) { in addr_filter__resolve_kernel_syms()
2462 err = find_kern_sym(filt->sym_from, &start, &size, in addr_filter__resolve_kernel_syms()
2463 filt->sym_from_idx); in addr_filter__resolve_kernel_syms()
2466 filt->addr = start; in addr_filter__resolve_kernel_syms()
2467 if (filt->range && !filt->size && !filt->sym_to) { in addr_filter__resolve_kernel_syms()
2468 filt->size = size; in addr_filter__resolve_kernel_syms()
2473 if (filt->sym_to) { in addr_filter__resolve_kernel_syms()
2474 err = find_kern_sym(filt->sym_to, &start, &size, in addr_filter__resolve_kernel_syms()
2475 filt->sym_to_idx); in addr_filter__resolve_kernel_syms()
2479 err = check_end_after_start(filt, start, size); in addr_filter__resolve_kernel_syms()
2482 filt->size = start + size - filt->addr; in addr_filter__resolve_kernel_syms()
2489 filt->sym_to ? filt->sym_to : filt->sym_from); in addr_filter__resolve_kernel_syms()
2588 static int addr_filter__entire_dso(struct addr_filter *filt, struct dso *dso) in addr_filter__entire_dso() argument
2592 filt->filename); in addr_filter__entire_dso()
2596 filt->addr = 0; in addr_filter__entire_dso()
2597 filt->size = dso->data.file_size; in addr_filter__entire_dso()
2602 static int addr_filter__resolve_syms(struct addr_filter *filt) in addr_filter__resolve_syms() argument
2608 if (!filt->sym_from && !filt->sym_to) in addr_filter__resolve_syms()
2611 if (!filt->filename) in addr_filter__resolve_syms()
2612 return addr_filter__resolve_kernel_syms(filt); in addr_filter__resolve_syms()
2614 dso = load_dso(filt->filename); in addr_filter__resolve_syms()
2616 pr_err("Failed to load symbols from: %s\n", filt->filename); in addr_filter__resolve_syms()
2620 if (filt->sym_from && !strcmp(filt->sym_from, "*")) { in addr_filter__resolve_syms()
2621 err = addr_filter__entire_dso(filt, dso); in addr_filter__resolve_syms()
2625 if (filt->sym_from) { in addr_filter__resolve_syms()
2626 err = find_dso_sym(dso, filt->sym_from, &start, &size, in addr_filter__resolve_syms()
2627 filt->sym_from_idx); in addr_filter__resolve_syms()
2630 filt->addr = start; in addr_filter__resolve_syms()
2631 if (filt->range && !filt->size && !filt->sym_to) in addr_filter__resolve_syms()
2632 filt->size = size; in addr_filter__resolve_syms()
2635 if (filt->sym_to) { in addr_filter__resolve_syms()
2636 err = find_dso_sym(dso, filt->sym_to, &start, &size, in addr_filter__resolve_syms()
2637 filt->sym_to_idx); in addr_filter__resolve_syms()
2641 err = check_end_after_start(filt, start, size); in addr_filter__resolve_syms()
2645 filt->size = start + size - filt->addr; in addr_filter__resolve_syms()
2654 static char *addr_filter__to_str(struct addr_filter *filt) in addr_filter__to_str() argument
2662 if (filt->filename) { in addr_filter__to_str()
2664 fn = realpath(filt->filename, filename_buf); in addr_filter__to_str()
2669 if (filt->range) { in addr_filter__to_str()
2671 filt->action, filt->addr, filt->size, at, fn); in addr_filter__to_str()
2674 filt->action, filt->addr, at, fn); in addr_filter__to_str()
2684 struct addr_filter *filt; in parse_addr_filter() local
2700 list_for_each_entry(filt, &filts.head, list) { in parse_addr_filter()
2703 err = addr_filter__resolve_syms(filt); in parse_addr_filter()
2707 new_filter = addr_filter__to_str(filt); in parse_addr_filter()