From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757924AbcFAJ7l (ORCPT ); Wed, 1 Jun 2016 05:59:41 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:40329 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757826AbcFAJ7j (ORCPT ); Wed, 1 Jun 2016 05:59:39 -0400 Subject: Re: [PATCH v7 13/14] perf callchain: Support x86 target platform To: Jiri Olsa References: <1464693552-104294-1-git-send-email-hekuang@huawei.com> <1464693552-104294-14-git-send-email-hekuang@huawei.com> <20160601084027.GG13738@krava> CC: , , , , , , , , , , , , , , , , From: Hekuang Message-ID: <574EB092.9060904@huawei.com> Date: Wed, 1 Jun 2016 17:53:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160601084027.GG13738@krava> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.110.55.166] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.574EB0EF.0003,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 593175cedc79a8f27ade426324979ab2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2016/6/1 16:40, Jiri Olsa 写道: > On Tue, May 31, 2016 at 11:19:11AM +0000, He Kuang wrote: > > SNIP > >> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c >> index e183390..5774317 100644 >> --- a/tools/perf/util/unwind-libunwind.c >> +++ b/tools/perf/util/unwind-libunwind.c >> @@ -5,6 +5,7 @@ >> #include "arch/common.h" >> >> struct unwind_libunwind_ops __weak *local_unwind_libunwind_ops; >> +struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops; >> >> void unwind__register_ops(struct thread *thread, >> struct unwind_libunwind_ops *ops) >> @@ -30,7 +31,13 @@ int unwind__prepare_access(struct thread *thread, struct map *map) >> dso_type == DSO__TYPE_64BIT, map->dso->name); >> >> arch = normalize_arch(thread->mg->machine->env->arch); >> - pr_debug("unwind: target platform=%s\n", arch); >> + >> + if (!strcmp(arch, "x86")) >> + if (dso_type != DSO__TYPE_64BIT) >> + ops = x86_32_unwind_libunwind_ops; >> + >> + if (!ops) >> + pr_err("unwind: target platform=%s is not supported\n", arch); > how could ops become NULL in here? it starts with local_unwind_libunwind_ops > I dont think this check is needed in here x86_32_unwind_libunwind_ops is a null pointer when x86_32 libunwind is not supported. There's a weak defination if CONFIG_LIBUNWIND_X86 is not set. struct unwind_libunwind_ops __weak *x86_32_unwind_libunwind_ops; In this case, ops is null and "x86_32 is not supported" error message is showed up. > jirka >