All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jin, Yao" <yao.jin@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
	mingo@redhat.com, alexander.shishkin@linux.intel.com,
	Linux-kernel@vger.kernel.org, ak@linux.intel.com,
	kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH v2 2/2] perf script: Support filtering by hex address
Date: Sun, 7 Feb 2021 08:19:04 +0800	[thread overview]
Message-ID: <90457e89-c9b0-269d-ab92-22790221018b@linux.intel.com> (raw)
In-Reply-To: <YB0UvM6t+BSqQkkk@krava>

Hi Jiri,

On 2/5/2021 5:49 PM, Jiri Olsa wrote:
> On Fri, Jan 29, 2021 at 03:08:54PM +0800, Jin Yao wrote:
> 
> SNIP
> 
>> +			}
>> +		}
>> +
>>   		if (!ret)
>>   			al->filtered |= (1 << HIST_FILTER__SYMBOL);
>>   	}
>> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
>> index 64a039cbba1b..2c13f6acda7f 100644
>> --- a/tools/perf/util/symbol.c
>> +++ b/tools/perf/util/symbol.c
>> @@ -2406,6 +2406,39 @@ int setup_intlist(struct intlist **list, const char *list_str,
>>   	return 0;
>>   }
>>   
>> +static int setup_addrlist(struct intlist **addr_list, struct strlist *sym_list)
>> +{
>> +	struct str_node *pos, *tmp;
>> +	unsigned long val;
>> +	char *sep;
>> +	int err = 0, i = 0;
>> +
>> +	*addr_list = intlist__new(NULL);
>> +	if (!*addr_list)
>> +		return -1;
>> +
>> +	strlist__for_each_entry_safe(pos, tmp, sym_list) {
>> +		val = strtoul(pos->s, &sep, 16);
>> +		if (*sep != ',' && *sep != '\0')
>> +			continue;
> 
> I think you also need to check that val is valid and errno
> (check other strtoul we call in perf)
> because above could pass for:
> 
> 	$ ./perf script -S ",7fd0f1b69a13"
> 	ls 651468 410180.795577:      90098 cycles:u:      7fd0f1b69a13 __GI___tunables_init+0x73 (/usr/lib64/ld-2.32.so)
> 
> 
> plus check for " " so we could do:
> 
> 	$ ./perf script -S "7fd0f1b69a13 ,7fd0f1b5e189"
> 	ls 651468 410180.796055:     190731 cycles:u:      7fd0f1b5e189 _dl_relocate_object+0x4b9 (/usr/lib64/ld-2.32.so)
> 
> 	$ ./perf script -S "7fd0f1b69a13,7fd0f1b5e189"
> 	ls 651468 410180.795577:      90098 cycles:u:      7fd0f1b69a13 __GI___tunables_init+0x73 (/usr/lib64/ld-2.32.so)
> 	ls 651468 410180.796055:     190731 cycles:u:      7fd0f1b5e189 _dl_relocate_object+0x4b9 (/usr/lib64/ld-2.32.so)
> 
> 
> thanks,
> jirka
> 

Thanks for reminding. Yes, these cases I need to cover. I will prepare the v3.

Thanks
Jin Yao

  reply	other threads:[~2021-02-07  0:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29  7:08 [PATCH v2 1/2] perf util: Change intlist int to unsigned long Jin Yao
2021-01-29  7:08 ` [PATCH v2 2/2] perf script: Support filtering by hex address Jin Yao
2021-02-05  9:49   ` Jiri Olsa
2021-02-07  0:19     ` Jin, Yao [this message]
2021-02-07  7:28     ` Jin, Yao

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=90457e89-c9b0-269d-ab92-22790221018b@linux.intel.com \
    --to=yao.jin@linux.intel.com \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.