Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11800852pjo; Thu, 2 Jan 2020 14:30:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxjFIR/hssaHvx10StTYHQvJhUwvtOodjqYhsNhDfkFpsYFXQ7JrsLCAKH6Vh5gpn80LXbG X-Received: by 2002:aca:f555:: with SMTP id t82mr3229190oih.103.1578004246509; Thu, 02 Jan 2020 14:30:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578004246; cv=none; d=google.com; s=arc-20160816; b=TbZ2Dj/qbUfnWjkLzmK2twk61u5PqEfogwEOvccT5MBtQSP9cCNo+iTo2QkTj9170K tR4cdebD3lDVZ3CI7AKG51Ys18tKJI2OSLdI5ipp8DeoXZfKZjV7+cYHhm6JNxel+B3B 586AB7HnFCK6MQLjcDvv+z3UGH9sw5vr0hpQDAoODcL7gM9hcZQ1moLxLu9q60jcx5jD /W+mBpkFXzkoZEc2N6q16FjLje9Z+azByjopKQH4arcOia8RLzXZ4gjOoT1uQwq7rtcF o0jIInTB4K95trZxghOufE6CFY/EDnaDISQFCU5E+enk/ZgnsY2fjTELaa40evIqvfbJ f6cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0/gMOtizvSBynuW0IHCj9oU/rSv24OoNYbl+7tyzfRE=; b=bn0R6d/rCwFyr5Inn1KFdXe1W5d+b/BY5+aHqpdVaABAoWTMg4/5yD1pQaSBk/uC65 qUZO7y0WSKipKSgYoSw2Ai+eA/KkM9+ptOd/dYAHyRZYYbebaB0wro8BW/o7e/J83IBC 8nJ5gK/Xlb71renx0akAyekxKIvkqfz6TfI7H2GdIrlCVqCt2ZCV9GWKeup2Je2Imj9Z CuNYCRDCgRNwW3zU5pf7GvDBIY3EXci29Few/0j1hvHSSKV5OXRsShZygl0Zb4qNFIP8 UJvViGtY0MEd6aH/saYlwIn8ovoQXhx0/eWvGS2V5qq8vb7en7JKsVPnAGys4sD2mg+l GmRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZUPmFxmn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y24si25452508oih.24.2020.01.02.14.30.34; Thu, 02 Jan 2020 14:30:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZUPmFxmn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729931AbgABW3x (ORCPT + 99 others); Thu, 2 Jan 2020 17:29:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:32838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729295AbgABW3t (ORCPT ); Thu, 2 Jan 2020 17:29:49 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 371C921835; Thu, 2 Jan 2020 22:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004188; bh=ESTFKnxqnJayKRPbkf5MnKNbClCkmYSzC5nq9DVBah0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZUPmFxmn83clSt3yL3luLBZcnqbqCdc2I1rEWMjDp8gukpS51gbIMuoxMbJl+bKT/ XH2IOtHGZG5+SFMlplz5FhXwUfI6sTifItfGjz9gZoTuWjsIrxcTOc4cSbsEUe68G2 uuw/xgwn+J7C6M/Phvzy0ZhCg9o3C3o1cHYaAJLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , Jiri Olsa , Namhyung Kim , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 4.9 050/171] perf probe: Fix to find range-only function instance Date: Thu, 2 Jan 2020 23:06:21 +0100 Message-Id: <20200102220553.918514376@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu [ Upstream commit b77afa1f810f37bd8a36cb1318178dfe2d7af6b6 ] Fix die_is_func_instance() to find range-only function instance. In some case, a function instance can be made without any low PC or entry PC, but only with address ranges by optimization. (e.g. cold text partially in "text.unlikely" section) To find such function instance, we have to check the range attribute too. Fixes: e1ecbbc3fa83 ("perf probe: Fix to handle optimized not-inlined functions") Signed-off-by: Masami Hiramatsu Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lore.kernel.org/lkml/157190835669.1859.8368628035930950596.stgit@devnote2 Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/util/dwarf-aux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c index 41e068e94349..3d0a9e09d00a 100644 --- a/tools/perf/util/dwarf-aux.c +++ b/tools/perf/util/dwarf-aux.c @@ -328,10 +328,14 @@ bool die_is_func_def(Dwarf_Die *dw_die) bool die_is_func_instance(Dwarf_Die *dw_die) { Dwarf_Addr tmp; + Dwarf_Attribute attr_mem; /* Actually gcc optimizes non-inline as like as inlined */ - return !dwarf_func_inline(dw_die) && dwarf_entrypc(dw_die, &tmp) == 0; + return !dwarf_func_inline(dw_die) && + (dwarf_entrypc(dw_die, &tmp) == 0 || + dwarf_attr(dw_die, DW_AT_ranges, &attr_mem) != NULL); } + /** * die_get_data_member_location - Get the data-member offset * @mb_die: a DIE of a member of a data structure -- 2.20.1