diff --git a/arch/x86_64/mcount-dynamic.c b/arch/x86_64/mcount-dynamic.c index bf93b0238..4da8e5436 100644 --- a/arch/x86_64/mcount-dynamic.c +++ b/arch/x86_64/mcount-dynamic.c @@ -625,6 +625,7 @@ int mcount_unpatch_func(struct mcount_dynamic_info *mdi, struct uftrace_symbol * switch (mdi->type) { case DYNAMIC_FENTRY: + case DYNAMIC_PATCHABLE: result = unpatch_fentry_func(mdi, sym); break; diff --git a/libmcount/dynamic.c b/libmcount/dynamic.c index 6e7b56dd9..507162060 100644 --- a/libmcount/dynamic.c +++ b/libmcount/dynamic.c @@ -508,6 +508,8 @@ static void patch_patchable_func_matched(struct mcount_dynamic_info *mdi, struct .size = UINT_MAX, .name = namebuf, }; + bool found = false; + int match; char *soname = get_soname(map->libname); symtab = &map->mod->symtab; @@ -531,9 +533,19 @@ static void patch_patchable_func_matched(struct mcount_dynamic_info *mdi, struct continue; } - mcount_patch_func_with_stats(mdi, sym); + found = true; + match = match_pattern_list(map, soname, sym->name); + if (!match) + continue; + else if (match == 1) + mcount_patch_func_with_stats(mdi, sym); + else + mcount_unpatch_func(mdi, sym, NULL); } + if (!found) + stats.nomatch++; + free(soname); }