Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1210138
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Wang Nan <wangnan0@huawei.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] perf probe: Try to use symbol table if searching debug info failed |
| Date | Thu, 20 Aug 2015 06:30:01 +0200 |
| Message-ID | <pZpEd-2d1-1@gated-at.bofh.it> (permalink) |
| X-Original-To | <acme@kernel.org>, <a.p.zijlstra@chello.nl>, <masami.hiramatsu.pt@hitachi.com>, <namhyung@kernel.org> |
| X-Mailer | git-send-email 1.8.3.4 |
| MIME-Version | 1.0 |
| Content-Type | text/plain |
| X-Originating-IP | [10.107.193.248] |
| X-Cfilter-Loop | Reflected |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 83 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | <lizefan@huawei.com>, <linux-kernel@vger.kernel.org>, <pi3orama@huawei.com> |
| X-Original-Date | Thu, 20 Aug 2015 04:25:04 +0000 |
| X-Original-Message-ID | <1440044704-122048-1-git-send-email-wangnan0@huawei.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1210138 |
Show key headers only | View raw
A problem can occure in statically linked perf when vmlinux can be found:
# perf probe --add sys_epoll_pwait
probe-definition(0): sys_epoll_pwait
symbol:sys_epoll_pwait file:(null) line:0 offset:0 return:0 lazy:(null)
0 arguments
Looking at the vmlinux_path (7 entries long)
Using /lib/modules/4.2.0-rc1+/build/vmlinux for symbols
Open Debuginfo file: /lib/modules/4.2.0-rc1+/build/vmlinux
Try to find probe point from debuginfo.
Symbol sys_epoll_pwait address found : ffffffff8122bd40
Matched function: SyS_epoll_pwait
Failed to get call frame on 0xffffffff8122bd40
An error occurred in debuginfo analysis (-2).
Error: Failed to add events. Reason: No such file or directory (Code: -2)
The reason is caused by libdw that, if libdw is statically linked, it can't
load libebl_{arch}.so reliable.
In this case it is still possible to get the address from /proc/kalksyms.
However, perf tries that only when libdw returns -EBADF.
This patch gives it another chance to utilize symbol table, even if libdw
return error code other than -EBADF.
After applying this patch:
# perf probe -nv --add sys_epoll_pwait
probe-definition(0): sys_epoll_pwait
symbol:sys_epoll_pwait file:(null) line:0 offset:0 return:0 lazy:(null)
0 arguments
Looking at the vmlinux_path (7 entries long)
Using /lib/modules/4.2.0-rc1+/build/vmlinux for symbols
Open Debuginfo file: /lib/modules/4.2.0-rc1+/build/vmlinux
Try to find probe point from debuginfo.
Symbol sys_epoll_pwait address found : ffffffff8122bd40
Matched function: SyS_epoll_pwait
Failed to get call frame on 0xffffffff8122bd40
An error occurred in debuginfo analysis (-2).
Trying to use symbols.
Opening /sys/kernel/debug/tracing/kprobe_events write=1
Added new event:
Writing event: p:probe/sys_epoll_pwait _text+2276672
probe:sys_epoll_pwait (on sys_epoll_pwait)
You can now use it in all perf tools, such as:
perf record -e probe:sys_epoll_pwait -aR sleep 1
Although libdw returns an error (Failed to get call frame),
perf tries symbol table and finally gets correct address.
Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
tools/perf/util/probe-event.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index fe4941a..f07374b 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -705,9 +705,10 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
}
/* Error path : ntevs < 0 */
pr_debug("An error occurred in debuginfo analysis (%d).\n", ntevs);
- if (ntevs == -EBADF) {
- pr_warning("Warning: No dwarf info found in the vmlinux - "
- "please rebuild kernel with CONFIG_DEBUG_INFO=y.\n");
+ if (ntevs < 0) {
+ if (ntevs == -EBADF)
+ pr_warning("Warning: No dwarf info found in the vmlinux - "
+ "please rebuild kernel with CONFIG_DEBUG_INFO=y.\n");
if (!need_dwarf) {
pr_debug("Trying to use symbols.\n");
return 0;
--
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/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] perf probe: Try to use symbol table if searching debug info failed Wang Nan <wangnan0@huawei.com> - 2015-08-20 06:30 +0200
csiph-web