Lines Matching full:filt

2107 static void addr_filter__free_str(struct addr_filter *filt)  in addr_filter__free_str()  argument
2109 zfree(&filt->str); in addr_filter__free_str()
2110 filt->action = NULL; in addr_filter__free_str()
2111 filt->sym_from = NULL; in addr_filter__free_str()
2112 filt->sym_to = NULL; in addr_filter__free_str()
2113 filt->filename = NULL; in addr_filter__free_str()
2118 struct addr_filter *filt = zalloc(sizeof(*filt)); in addr_filter__new() local
2120 if (filt) in addr_filter__new()
2121 INIT_LIST_HEAD(&filt->list); in addr_filter__new()
2123 return filt; in addr_filter__new()
2126 static void addr_filter__free(struct addr_filter *filt) in addr_filter__free() argument
2128 if (filt) in addr_filter__free()
2129 addr_filter__free_str(filt); in addr_filter__free()
2130 free(filt); in addr_filter__free()
2134 struct addr_filter *filt) in addr_filters__add() argument
2136 list_add_tail(&filt->list, &filts->head); in addr_filters__add()
2141 struct addr_filter *filt) in addr_filters__del() argument
2143 list_del_init(&filt->list); in addr_filters__del()
2155 struct addr_filter *filt, *n; in addr_filters__exit() local
2157 list_for_each_entry_safe(filt, n, &filts->head, list) { in addr_filters__exit()
2158 addr_filters__del(filts, filt); in addr_filters__exit()
2159 addr_filter__free(filt); in addr_filters__exit()
2199 static int parse_action(struct addr_filter *filt) in parse_action() argument
2201 if (!strcmp(filt->action, "filter")) { in parse_action()
2202 filt->start = true; in parse_action()
2203 filt->range = true; in parse_action()
2204 } else if (!strcmp(filt->action, "start")) { in parse_action()
2205 filt->start = true; in parse_action()
2206 } else if (!strcmp(filt->action, "stop")) { in parse_action()
2207 filt->start = false; in parse_action()
2208 } else if (!strcmp(filt->action, "tracestop")) { in parse_action()
2209 filt->start = false; in parse_action()
2210 filt->range = true; in parse_action()
2211 filt->action += 5; /* Change 'tracestop' to 'stop' */ in parse_action()
2259 static int parse_one_filter(struct addr_filter *filt, const char **filter_inp) in parse_one_filter() argument
2264 filt->str = fstr = strdup(*filter_inp); in parse_one_filter()
2268 err = parse_num_or_str(&fstr, NULL, &filt->action, " "); in parse_one_filter()
2272 err = parse_action(filt); in parse_one_filter()
2276 err = parse_addr_size(&fstr, &filt->addr, &filt->sym_from, in parse_one_filter()
2277 &filt->sym_from_idx); in parse_one_filter()
2285 err = parse_addr_size(&fstr, &filt->size, &filt->sym_to, in parse_one_filter()
2286 &filt->sym_to_idx); in parse_one_filter()
2289 filt->range = true; in parse_one_filter()
2296 err = parse_num_or_str(&fstr, NULL, &filt->filename, " ,"); in parse_one_filter()
2303 *filter_inp += fstr - filt->str; in parse_one_filter()
2308 addr_filter__free_str(filt); in parse_one_filter()
2316 struct addr_filter *filt; in addr_filters__parse_bare_filter() local
2321 filt = addr_filter__new(); in addr_filters__parse_bare_filter()
2322 err = parse_one_filter(filt, &fstr); in addr_filters__parse_bare_filter()
2324 addr_filter__free(filt); in addr_filters__parse_bare_filter()
2328 addr_filters__add(filts, filt); in addr_filters__parse_bare_filter()
2479 static int addr_filter__entire_kernel(struct addr_filter *filt) in addr_filter__entire_kernel() argument
2490 filt->addr = args.start; in addr_filter__entire_kernel()
2491 filt->size = args.size; in addr_filter__entire_kernel()
2496 static int check_end_after_start(struct addr_filter *filt, u64 start, u64 size) in check_end_after_start() argument
2498 if (start + size >= filt->addr) in check_end_after_start()
2501 if (filt->sym_from) { in check_end_after_start()
2503 filt->sym_to, start, filt->sym_from, filt->addr); in check_end_after_start()
2506 filt->sym_to, start, filt->addr); in check_end_after_start()
2512 static int addr_filter__resolve_kernel_syms(struct addr_filter *filt) in addr_filter__resolve_kernel_syms() argument
2523 if (filt->sym_from && !strcmp(filt->sym_from, "*")) in addr_filter__resolve_kernel_syms()
2524 return addr_filter__entire_kernel(filt); in addr_filter__resolve_kernel_syms()
2526 if (filt->sym_from) { in addr_filter__resolve_kernel_syms()
2527 err = find_kern_sym(filt->sym_from, &start, &size, in addr_filter__resolve_kernel_syms()
2528 filt->sym_from_idx); in addr_filter__resolve_kernel_syms()
2531 filt->addr = start; in addr_filter__resolve_kernel_syms()
2532 if (filt->range && !filt->size && !filt->sym_to) { in addr_filter__resolve_kernel_syms()
2533 filt->size = size; in addr_filter__resolve_kernel_syms()
2538 if (filt->sym_to) { in addr_filter__resolve_kernel_syms()
2539 err = find_kern_sym(filt->sym_to, &start, &size, in addr_filter__resolve_kernel_syms()
2540 filt->sym_to_idx); in addr_filter__resolve_kernel_syms()
2544 err = check_end_after_start(filt, start, size); in addr_filter__resolve_kernel_syms()
2547 filt->size = start + size - filt->addr; in addr_filter__resolve_kernel_syms()
2554 filt->sym_to ? filt->sym_to : filt->sym_from); in addr_filter__resolve_kernel_syms()
2653 static int addr_filter__entire_dso(struct addr_filter *filt, struct dso *dso) in addr_filter__entire_dso() argument
2657 filt->filename); in addr_filter__entire_dso()
2661 filt->addr = 0; in addr_filter__entire_dso()
2662 filt->size = dso__data(dso)->file_size; in addr_filter__entire_dso()
2667 static int addr_filter__resolve_syms(struct addr_filter *filt) in addr_filter__resolve_syms() argument
2673 if (!filt->sym_from && !filt->sym_to) in addr_filter__resolve_syms()
2676 if (!filt->filename) in addr_filter__resolve_syms()
2677 return addr_filter__resolve_kernel_syms(filt); in addr_filter__resolve_syms()
2679 dso = load_dso(filt->filename); in addr_filter__resolve_syms()
2681 pr_err("Failed to load symbols from: %s\n", filt->filename); in addr_filter__resolve_syms()
2685 if (filt->sym_from && !strcmp(filt->sym_from, "*")) { in addr_filter__resolve_syms()
2686 err = addr_filter__entire_dso(filt, dso); in addr_filter__resolve_syms()
2690 if (filt->sym_from) { in addr_filter__resolve_syms()
2691 err = find_dso_sym(dso, filt->sym_from, &start, &size, in addr_filter__resolve_syms()
2692 filt->sym_from_idx); in addr_filter__resolve_syms()
2695 filt->addr = start; in addr_filter__resolve_syms()
2696 if (filt->range && !filt->size && !filt->sym_to) in addr_filter__resolve_syms()
2697 filt->size = size; in addr_filter__resolve_syms()
2700 if (filt->sym_to) { in addr_filter__resolve_syms()
2701 err = find_dso_sym(dso, filt->sym_to, &start, &size, in addr_filter__resolve_syms()
2702 filt->sym_to_idx); in addr_filter__resolve_syms()
2706 err = check_end_after_start(filt, start, size); in addr_filter__resolve_syms()
2710 filt->size = start + size - filt->addr; in addr_filter__resolve_syms()
2719 static char *addr_filter__to_str(struct addr_filter *filt) in addr_filter__to_str() argument
2727 if (filt->filename) { in addr_filter__to_str()
2729 fn = realpath(filt->filename, filename_buf); in addr_filter__to_str()
2734 if (filt->range) { in addr_filter__to_str()
2736 filt->action, filt->addr, filt->size, at, fn); in addr_filter__to_str()
2739 filt->action, filt->addr, at, fn); in addr_filter__to_str()
2749 struct addr_filter *filt; in parse_addr_filter() local
2765 list_for_each_entry(filt, &filts.head, list) { in parse_addr_filter()
2768 err = addr_filter__resolve_syms(filt); in parse_addr_filter()
2772 new_filter = addr_filter__to_str(filt); in parse_addr_filter()