linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf auxtrace: Fix address filter symbol name match for modules
Date: Wed, 26 Oct 2022 11:01:15 -0300	[thread overview]
Message-ID: <Y1k9qwNKy/fJVjn1@kernel.org> (raw)
In-Reply-To: <20221026072736.2982-1-adrian.hunter@intel.com>

Em Wed, Oct 26, 2022 at 10:27:36AM +0300, Adrian Hunter escreveu:
> For modules, names from kallsyms__parse() contain the module name which
> meant that module symbols did not match exactly by name.
> 
> Fix by matching the name string up to the separating tab character.

Thanks, applied.

- Arnaldo

 
> Fixes: 1b36c03e3569 ("perf record: Add support for using symbols in address filters")
> Cc: stable@vger.kernel.org
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  tools/perf/util/auxtrace.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
> index b59c278fe9ed..c50eb2bfc518 100644
> --- a/tools/perf/util/auxtrace.c
> +++ b/tools/perf/util/auxtrace.c
> @@ -2321,11 +2321,19 @@ struct sym_args {
>  	bool		near;
>  };
>  
> +static bool kern_sym_name_match(const char *kname, const char *name)
> +{
> +	size_t n = strlen(name);
> +
> +	return !strcmp(kname, name) ||
> +	       (!strncmp(kname, name, n) && kname[n] == '\t');
> +}
> +
>  static bool kern_sym_match(struct sym_args *args, const char *name, char type)
>  {
>  	/* A function with the same name, and global or the n'th found or any */
>  	return kallsyms__is_function(type) &&
> -	       !strcmp(name, args->name) &&
> +	       kern_sym_name_match(name, args->name) &&
>  	       ((args->global && isupper(type)) ||
>  		(args->selected && ++(args->cnt) == args->idx) ||
>  		(!args->global && !args->selected));
> -- 
> 2.34.1

-- 

- Arnaldo

      reply	other threads:[~2022-10-26 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  7:27 [PATCH] perf auxtrace: Fix address filter symbol name match for modules Adrian Hunter
2022-10-26 14:01 ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1k9qwNKy/fJVjn1@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).