diff options
author | Petr Machata <pmachata@redhat.com> | 2012-04-01 19:36:41 +0200 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-04-19 01:35:44 +0200 |
commit | e0973cbbd208c84d9646481c33a2ebb511d68381 (patch) | |
tree | 44bede2f60bb8e98f140acb7568c654704b235f4 /options.c | |
parent | 1e4fed2719443c9de3831b359ff516888114783f (diff) | |
download | ltrace-e0973cbbd208c84d9646481c33a2ebb511d68381.tar.gz |
Fix bugs in filter code, enable filtering according to -e setting
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -208,7 +208,7 @@ add_filter_rule(struct filter *filt, const char *expr, } regex_t lib_re; - status = (lib_re_p ? regcomp : globcomp)(&lib_re, sym, 0); + status = (lib_re_p ? regcomp : globcomp)(&lib_re, lib, 0); if (status != 0) { char buf[100]; regerror(status, &lib_re, buf, sizeof buf); @@ -220,6 +220,7 @@ add_filter_rule(struct filter *filt, const char *expr, filter_lib_matcher_name_init(matcher, lib_re); filter_rule_init(rule, type, matcher, symbol_re); + filter_add_rule(filt, rule); } static int @@ -382,7 +383,7 @@ recursive_parse_chain(char *expr) } static void -parse_chain(struct options_t *options, const char *expr) +parse_filter_chain(struct options_t *options, const char *expr) { char *str = strdup(expr); if (str == NULL) { @@ -471,7 +472,7 @@ process_options(int argc, char **argv) { break; case 'e': - parse_chain(&options, optarg); + parse_filter_chain(&options, optarg); break; case 'f': @@ -627,6 +628,9 @@ process_options(int argc, char **argv) { opt_F = egg; } + if (options.filter == NULL) + parse_filter_chain(&options, "*"); + if (!opt_p && argc < 1) { fprintf(stderr, "%s: too few arguments\n", progname); err_usage(); |