From: Jin Yao <yao.jin@linux.intel.com>
To: acme@kernel.org, jolsa@kernel.org
Cc: Linux-kernel@vger.kernel.org, yao.jin@linux.intel.com
Subject: [PATCH] perf symbols: Not using the ubuntu debuginfo when dso load
Date: Thu, 1 Sep 2016 15:40:54 +0800 [thread overview]
Message-ID: <1472715654-18632-1-git-send-email-yao.jin@linux.intel.com> (raw)
In dso__load, it iterates over *interesting" debug images which
have symtab/dynsym/opd section. For example, for loading the
libc-2.23.so on ubuntu 16.04, it will try 2 images in turn.
Try image 1: /lib/x86_64-linux-gnu/libc-2.23.so. Since it doesn't
have ".symtab" section, after symsrc__init return, runtime_ss = ss
(ss is associated with /lib/x86_64-linux-gnu/libc-2.23.so), and
syms_ss = NULL.
Try image 2: /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so.
Since it has ".symtab" section, after symsrc__init return,
syms_ss = ss (ss is associated with /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so),
and runtime_ss is not changed.
Now at the dso__load_sym(dso, map, syms_ss, runtime_ss, filter, kmod),
syms_ss is associated with /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so,
But the dso->name is /lib/x86_64-linux-gnu/libc-2.23.so.
In dso__load_sym, it needs to compute the dso->text_offset.
if (elf_section_by_name(elf, &ehdr, &tshdr, ".text", NULL))
dso->text_offset = tshdr.sh_addr - tshdr.sh_offset;
The issue is that tshdr is the ELF section header for
/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so not the header for
/lib/x86_64-linux-gnu/libc-2.23.so. So the result of dso->text_offset
is not correct.
In symbol__disassemble, it calls map__rip_2objdump to convert symbol start
address to objdump address. The converted address is
rip + map->dso->text_offset
Since this text_offset is not correct, so finally objdump uses wrong
start address to disassemble /lib/x86_64-linux-gnu/libc-2.23.so.
This patch lets dso__load not try ubuntu debuginfo
(/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.23.so in this example), because
1: the image doesn't have valid assembly code (check output of objdump)
2: it can avoid above issue.
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
tools/perf/util/symbol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 37e8d20..25a10a3 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1324,7 +1324,6 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
case DSO_BINARY_TYPE__DEBUGLINK:
case DSO_BINARY_TYPE__SYSTEM_PATH_DSO:
case DSO_BINARY_TYPE__FEDORA_DEBUGINFO:
- case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO:
case DSO_BINARY_TYPE__BUILDID_DEBUGINFO:
case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
return !kmod && dso->kernel == DSO_TYPE_USER;
@@ -1353,6 +1352,7 @@ static bool dso__is_compatible_symtab_type(struct dso *dso, bool kmod,
return true;
case DSO_BINARY_TYPE__NOT_FOUND:
+ case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO:
default:
return false;
}
--
2.7.4
reply other threads:[~2016-09-01 7:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1472715654-18632-1-git-send-email-yao.jin@linux.intel.com \
--to=yao.jin@linux.intel.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=acme@kernel.org \
--cc=jolsa@kernel.org \
/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
Powered by JetHome