public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: unwind: fix segbase for libunwind.
@ 2015-04-01 14:08 Wang Nan
  2015-04-01 14:48 ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Wang Nan @ 2015-04-01 14:08 UTC (permalink / raw)
  To: acme, jolsa, namhyung; +Cc: mingo, lizefan, pi3orama, linux-kernel

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 <wangnan0@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-02  8:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-01 14:08 [PATCH] perf: unwind: fix segbase for libunwind Wang Nan
2015-04-01 14:48 ` Ingo Molnar
2015-04-02  5:07   ` Wang Nan
2015-04-02  5:19     ` Wang Nan
2015-04-02  8:11       ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox