Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1411056

Re: [PATCH v7 10/14] perf tools: Check the target platform before assigning unwind methods

From Hekuang <hekuang@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH v7 10/14] perf tools: Check the target platform before assigning unwind methods
Date 2016-06-01 12:10 +0200
Message-ID <rFbg6-74G-39@gated-at.bofh.it> (permalink)
References <rEPSh-20r-5@gated-at.bofh.it> <rEQ1Y-24b-13@gated-at.bofh.it> <rFa0G-67A-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



在 2016/6/1 16:40, Jiri Olsa 写道:
> On Tue, May 31, 2016 at 11:19:08AM +0000, He Kuang wrote:
>
> SNIP
>
>> -int unwind__prepare_access(struct thread *thread)
>> +int unwind__prepare_access(struct thread *thread, struct map *map)
>>   {
>> -	unwind__register_ops(thread, local_unwind_libunwind_ops);
>> +	const char *arch;
>> +	enum dso_type dso_type;
>> +	struct unwind_libunwind_ops *ops = local_unwind_libunwind_ops;
>>   
>> -	return thread->unwind_libunwind_ops->prepare_access(thread);
>> +	if (!thread->mg->machine->env)
>> +		return 0;
>> +
>> +	dso_type = dso__type(map->dso, thread->mg->machine);
>> +	if (dso_type == DSO__TYPE_UNKNOWN)
>> +		return 0;
>> +
>> +	if (thread->addr_space)
>> +		pr_debug("unwind: thread map already set, 64bit is %d, dso=%s\n",
>> +			 dso_type == DSO__TYPE_64BIT, map->dso->name);
> should we leave once the address space is set? resseting it over
> again seems like memory leak unless I'm missing something...
>
> also this check should be probably the first thing we do in here

Sure, I must miss the return statement here.
> thanks,
> jirka
>
>> +
>> +	arch = normalize_arch(thread->mg->machine->env->arch);
>> +	pr_debug("unwind: target platform=%s\n", arch);
>> +
>> +	unwind__register_ops(thread, ops);
>> +
>> +	if (thread->unwind_libunwind_ops)
>> +		return thread->unwind_libunwind_ops->prepare_access(thread);
>> +	else
>> +		return 0;
>>   }
> SNIP
>

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v7 10/14] perf tools: Check the target platform before assigning unwind methods He Kuang <hekuang@huawei.com> - 2016-05-31 13:30 +0200
  Re: [PATCH v7 10/14] perf tools: Check the target platform before  assigning unwind methods Jiri Olsa <jolsa@redhat.com> - 2016-06-01 10:50 +0200
    Re: [PATCH v7 10/14] perf tools: Check the target platform before  assigning unwind methods Hekuang <hekuang@huawei.com> - 2016-06-01 12:10 +0200
  Re: [PATCH v7 10/14] perf tools: Check the target platform before  assigning unwind methods Jiri Olsa <jolsa@redhat.com> - 2016-06-01 10:50 +0200

csiph-web