From: Wang Nan <wangnan0@huawei.com>
To: <acme@kernel.org>, <jolsa@kernel.org>, <namhyung@kernel.org>
Cc: <mingo@redhat.com>, <lizefan@huawei.com>, <pi3orama@163.com>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] perf: unwind: fix segbase for libunwind.
Date: Wed, 1 Apr 2015 14:08:52 +0000 [thread overview]
Message-ID: <1427897332-145581-1-git-send-email-wangnan0@huawei.com> (raw)
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
next reply other threads:[~2015-04-01 14:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 14:08 Wang Nan [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1427897332-145581-1-git-send-email-wangnan0@huawei.com \
--to=wangnan0@huawei.com \
--cc=acme@kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=pi3orama@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®