Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753495AbbDAOJN (ORCPT ); Wed, 1 Apr 2015 10:09:13 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:18918 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbbDAOJK (ORCPT ); Wed, 1 Apr 2015 10:09:10 -0400 From: Wang Nan To: , , CC: , , , Subject: [PATCH] perf: unwind: fix segbase for libunwind. Date: Wed, 1 Apr 2015 14:08:52 +0000 Message-ID: <1427897332-145581-1-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.210] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.551BFC02.0399,ss=1,re=0.001,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: 796b38a0abb4477dcc838b07358ee763 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1551 Lines: 36 Perf passes incorrect segbase and table_data to libunwind when map->pgoff != 0, causes unwind failure. This patch fixes this problem. segbase is an absolute offset from the head of object file, directly read from ELF file. Original code computes corresponding virtual address using map->start + segbase, doesn't consider map->pgoff. Which causes libunwind read from incorrect offset. Signed-off-by: Wang Nan --- tools/perf/util/unwind-libunwind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index a78c280..c2a44fe 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c @@ -342,8 +342,8 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, di.format = UNW_INFO_FORMAT_REMOTE_TABLE; di.start_ip = map->start; di.end_ip = map->end; - di.u.rti.segbase = map->start + segbase; - di.u.rti.table_data = map->start + table_data; + di.u.rti.segbase = map->start - map->pgoff + segbase; + di.u.rti.table_data = map->start - map->pgoff + table_data; di.u.rti.table_len = fde_count * sizeof(struct table_entry) / sizeof(unw_word_t); return dwarf_search_unwind_table(as, ip, &di, pi, -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/