From 662f68999733dc173ae9827e3df82ba6a6368d2b Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 13 Nov 2022 22:16:34 -0500 Subject: [PATCH] Make dlfilter backend less aggressive about filtering out errors Ref https://github.com/janestreet/magic-trace/issues/260 --- src/perf_dlfilter.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/perf_dlfilter.c b/src/perf_dlfilter.c index ab8e89627..c3d462bd4 100644 --- a/src/perf_dlfilter.c +++ b/src/perf_dlfilter.c @@ -13,10 +13,14 @@ int filter_event_early(void *data, const struct perf_dlfilter_sample *sample, perf_dlfilter_fns.resolve_ip(ctx); const struct perf_dlfilter_al *resolved_addr = perf_dlfilter_fns.resolve_addr(ctx); - if (!resolved_ip || !resolved_ip->sym || !resolved_addr || - !resolved_addr->sym || + + // Only filter out events we for sure don't want. It's better to be less aggressive than + // too aggressive, as being too aggressive will lead to broken traces, while being not + // aggressive enough just makes things slower. + if (resolved_ip && resolved_ip->sym && resolved_addr && resolved_addr->sym && strcmp(resolved_ip->sym, resolved_addr->sym) == 0) { return 1; } + return 0; }