Lines Matching full:filt
1927 static void addr_filter__free_str(struct addr_filter *filt) in addr_filter__free_str() argument
1929 zfree(&filt->str); in addr_filter__free_str()
1930 filt->action = NULL; in addr_filter__free_str()
1931 filt->sym_from = NULL; in addr_filter__free_str()
1932 filt->sym_to = NULL; in addr_filter__free_str()
1933 filt->filename = NULL; in addr_filter__free_str()
1938 struct addr_filter *filt = zalloc(sizeof(*filt)); in addr_filter__new() local
1940 if (filt) in addr_filter__new()
1941 INIT_LIST_HEAD(&filt->list); in addr_filter__new()
1943 return filt; in addr_filter__new()
1946 static void addr_filter__free(struct addr_filter *filt) in addr_filter__free() argument
1948 if (filt) in addr_filter__free()
1949 addr_filter__free_str(filt); in addr_filter__free()
1950 free(filt); in addr_filter__free()
1954 struct addr_filter *filt) in addr_filters__add() argument
1956 list_add_tail(&filt->list, &filts->head); in addr_filters__add()
1961 struct addr_filter *filt) in addr_filters__del() argument
1963 list_del_init(&filt->list); in addr_filters__del()
1975 struct addr_filter *filt, *n; in addr_filters__exit() local
1977 list_for_each_entry_safe(filt, n, &filts->head, list) { in addr_filters__exit()
1978 addr_filters__del(filts, filt); in addr_filters__exit()
1979 addr_filter__free(filt); in addr_filters__exit()
2019 static int parse_action(struct addr_filter *filt) in parse_action() argument
2021 if (!strcmp(filt->action, "filter")) { in parse_action()
2022 filt->start = true; in parse_action()
2023 filt->range = true; in parse_action()
2024 } else if (!strcmp(filt->action, "start")) { in parse_action()
2025 filt->start = true; in parse_action()
2026 } else if (!strcmp(filt->action, "stop")) { in parse_action()
2027 filt->start = false; in parse_action()
2028 } else if (!strcmp(filt->action, "tracestop")) { in parse_action()
2029 filt->start = false; in parse_action()
2030 filt->range = true; in parse_action()
2031 filt->action += 5; /* Change 'tracestop' to 'stop' */ in parse_action()
2079 static int parse_one_filter(struct addr_filter *filt, const char **filter_inp) in parse_one_filter() argument
2084 filt->str = fstr = strdup(*filter_inp); in parse_one_filter()
2088 err = parse_num_or_str(&fstr, NULL, &filt->action, " "); in parse_one_filter()
2092 err = parse_action(filt); in parse_one_filter()
2096 err = parse_addr_size(&fstr, &filt->addr, &filt->sym_from, in parse_one_filter()
2097 &filt->sym_from_idx); in parse_one_filter()
2105 err = parse_addr_size(&fstr, &filt->size, &filt->sym_to, in parse_one_filter()
2106 &filt->sym_to_idx); in parse_one_filter()
2109 filt->range = true; in parse_one_filter()
2116 err = parse_num_or_str(&fstr, NULL, &filt->filename, " ,"); in parse_one_filter()
2123 *filter_inp += fstr - filt->str; in parse_one_filter()
2128 addr_filter__free_str(filt); in parse_one_filter()
2136 struct addr_filter *filt; in addr_filters__parse_bare_filter() local
2141 filt = addr_filter__new(); in addr_filters__parse_bare_filter()
2142 err = parse_one_filter(filt, &fstr); in addr_filters__parse_bare_filter()
2144 addr_filter__free(filt); in addr_filters__parse_bare_filter()
2148 addr_filters__add(filts, filt); in addr_filters__parse_bare_filter()
2288 static int addr_filter__entire_kernel(struct addr_filter *filt) in addr_filter__entire_kernel() argument
2299 filt->addr = args.start; in addr_filter__entire_kernel()
2300 filt->size = args.size; in addr_filter__entire_kernel()
2305 static int check_end_after_start(struct addr_filter *filt, u64 start, u64 size) in check_end_after_start() argument
2307 if (start + size >= filt->addr) in check_end_after_start()
2310 if (filt->sym_from) { in check_end_after_start()
2312 filt->sym_to, start, filt->sym_from, filt->addr); in check_end_after_start()
2315 filt->sym_to, start, filt->addr); in check_end_after_start()
2321 static int addr_filter__resolve_kernel_syms(struct addr_filter *filt) in addr_filter__resolve_kernel_syms() argument
2332 if (filt->sym_from && !strcmp(filt->sym_from, "*")) in addr_filter__resolve_kernel_syms()
2333 return addr_filter__entire_kernel(filt); in addr_filter__resolve_kernel_syms()
2335 if (filt->sym_from) { in addr_filter__resolve_kernel_syms()
2336 err = find_kern_sym(filt->sym_from, &start, &size, in addr_filter__resolve_kernel_syms()
2337 filt->sym_from_idx); in addr_filter__resolve_kernel_syms()
2340 filt->addr = start; in addr_filter__resolve_kernel_syms()
2341 if (filt->range && !filt->size && !filt->sym_to) { in addr_filter__resolve_kernel_syms()
2342 filt->size = size; in addr_filter__resolve_kernel_syms()
2347 if (filt->sym_to) { in addr_filter__resolve_kernel_syms()
2348 err = find_kern_sym(filt->sym_to, &start, &size, in addr_filter__resolve_kernel_syms()
2349 filt->sym_to_idx); in addr_filter__resolve_kernel_syms()
2353 err = check_end_after_start(filt, start, size); in addr_filter__resolve_kernel_syms()
2356 filt->size = start + size - filt->addr; in addr_filter__resolve_kernel_syms()
2363 filt->sym_to ? filt->sym_to : filt->sym_from); in addr_filter__resolve_kernel_syms()
2462 static int addr_filter__entire_dso(struct addr_filter *filt, struct dso *dso) in addr_filter__entire_dso() argument
2466 filt->filename); in addr_filter__entire_dso()
2470 filt->addr = 0; in addr_filter__entire_dso()
2471 filt->size = dso->data.file_size; in addr_filter__entire_dso()
2476 static int addr_filter__resolve_syms(struct addr_filter *filt) in addr_filter__resolve_syms() argument
2482 if (!filt->sym_from && !filt->sym_to) in addr_filter__resolve_syms()
2485 if (!filt->filename) in addr_filter__resolve_syms()
2486 return addr_filter__resolve_kernel_syms(filt); in addr_filter__resolve_syms()
2488 dso = load_dso(filt->filename); in addr_filter__resolve_syms()
2490 pr_err("Failed to load symbols from: %s\n", filt->filename); in addr_filter__resolve_syms()
2494 if (filt->sym_from && !strcmp(filt->sym_from, "*")) { in addr_filter__resolve_syms()
2495 err = addr_filter__entire_dso(filt, dso); in addr_filter__resolve_syms()
2499 if (filt->sym_from) { in addr_filter__resolve_syms()
2500 err = find_dso_sym(dso, filt->sym_from, &start, &size, in addr_filter__resolve_syms()
2501 filt->sym_from_idx); in addr_filter__resolve_syms()
2504 filt->addr = start; in addr_filter__resolve_syms()
2505 if (filt->range && !filt->size && !filt->sym_to) in addr_filter__resolve_syms()
2506 filt->size = size; in addr_filter__resolve_syms()
2509 if (filt->sym_to) { in addr_filter__resolve_syms()
2510 err = find_dso_sym(dso, filt->sym_to, &start, &size, in addr_filter__resolve_syms()
2511 filt->sym_to_idx); in addr_filter__resolve_syms()
2515 err = check_end_after_start(filt, start, size); in addr_filter__resolve_syms()
2519 filt->size = start + size - filt->addr; in addr_filter__resolve_syms()
2528 static char *addr_filter__to_str(struct addr_filter *filt) in addr_filter__to_str() argument
2536 if (filt->filename) { in addr_filter__to_str()
2538 fn = realpath(filt->filename, filename_buf); in addr_filter__to_str()
2543 if (filt->range) { in addr_filter__to_str()
2545 filt->action, filt->addr, filt->size, at, fn); in addr_filter__to_str()
2548 filt->action, filt->addr, at, fn); in addr_filter__to_str()
2558 struct addr_filter *filt; in parse_addr_filter() local
2574 list_for_each_entry(filt, &filts.head, list) { in parse_addr_filter()
2577 err = addr_filter__resolve_syms(filt); in parse_addr_filter()
2581 new_filter = addr_filter__to_str(filt); in parse_addr_filter()