kernel-hacking-2024-linux-s.../tools/perf/util
Masami Hiramatsu 906451b98b perf probe: Fix to fall back to find probe point in symbols
Fix to fall back to find a probe point in symbols if perf fails to find
it in debuginfo.

This can happen when the target function is an alias of another
function. Such alias doesn't have an entry in debuginfo but in symbols.

David Ahern reported this problem in https://lkml.org/lkml/2014/12/29/355

I ensured the problem and deeper investigation discovers it.
 -----
 eu-readelf --debug-dump=info /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so | grep \"malloc\" -A6
             name                 (strp) "malloc"
             decl_file            (data1) 25
             decl_line            (data2) 466
             prototyped           (flag_present)
             type                 (ref4) [  81b5]
             declaration          (flag_present)
 [  8f58]      formal_parameter
 --
             name                 (strp) "malloc"
             decl_file            (data1) 23
             decl_line            (data2) 466
             prototyped           (flag_present)
             type                 (ref4) [  9f4a]
             declaration          (flag_present)
             sibling              (ref4) [  bb29]
 ...
 -----
All these entires have no instances (all of them are declarations)
This is why the perf probe failed to find it in debuginfo.

However, there are some malloc instances in symbols.
 -----
 eu-readelf --symbols /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so | grep malloc$
  1181: 0000000000080700   5332 FUNC    LOCAL  DEFAULT       12 _int_malloc
  4537: 00000000000831d0    339 FUNC    LOCAL  DEFAULT       12 __GI___libc_malloc
  5545: 00000000000831d0    339 FUNC    LOCAL  DEFAULT       12 __malloc
  6063: 00000000000831d0    339 FUNC    GLOBAL DEFAULT       12 malloc
  7302: 00000000000831d0    339 FUNC    GLOBAL DEFAULT       12 __libc_malloc
 -----
As you an see, malloc and __libc_malloc have same address, and actually
__libc_malloc has an entry in debuginfo. So you can set up a probe on
__libc_malloc.

To fix this problem shortly, perf probe simply falls back to find probe
point(malloc) in symbols if it is not found in debuginfo.

Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20141231062747.2087.80961.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-01-02 12:42:17 -03:00
..
include Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-19 13:15:24 -08:00
scripting-engines perf script python: Removing event cache as it's no longer needed 2014-11-06 17:44:06 -03:00
abspath.c
alias.c
annotate.c perf callchain: Make get_srcline fall back to sym+offset 2014-11-24 18:03:47 -03:00
annotate.h perf annotate: Support source line numbers in annotate 2014-11-19 12:33:48 -03:00
bitmap.c
build-id.c perf buildid-cache: Remove extra debugdir variables 2014-12-09 09:14:34 -03:00
build-id.h perf build-id: Move disable_buildid_cache() to util/build-id.c 2014-11-19 12:33:46 -03:00
cache.h perf tools: Add perf_config_u64 function 2014-08-12 12:03:00 -03:00
callchain.c perf callchain: Fixup parameter handling error message 2014-12-09 10:06:11 -03:00
callchain.h perf callchain: Support handling complete branch stacks as histograms 2014-12-01 20:00:31 -03:00
cgroup.c
cgroup.h
cloexec.c perf util: Replace strerror with strerror_r for thread-safety 2014-08-15 10:58:35 -03:00
cloexec.h perf tools: Enable close-on-exec flag on perf file descriptor 2014-07-18 09:09:34 +02:00
color.c perf tools: Make __hpp__fmt() receive an additional len argument 2014-08-12 12:03:05 -03:00
color.h perf tools: Make __hpp__fmt() receive an additional len argument 2014-08-12 12:03:05 -03:00
comm.c perf tools: Identify which comms are from exec 2014-08-13 19:23:08 -03:00
comm.h perf tools: Add facility to export data in database-friendly way 2014-10-29 10:32:49 -02:00
config.c perf tools: Add --buildid-dir option to set cache directory 2014-12-09 09:14:35 -03:00
cpumap.c
cpumap.h
ctype.c
data.c perf util: Replace strerror with strerror_r for thread-safety 2014-08-15 10:58:35 -03:00
data.h
db-export.c perf tools: Defer export of comms that were not 'set' 2014-11-03 18:11:59 -03:00
db-export.h perf tools: Defer export of comms that were not 'set' 2014-11-03 18:11:59 -03:00
debug.c perf tools: Allow to force redirect pr_debug to stderr. 2014-11-24 18:03:48 -03:00
debug.h perf: Use strerror_r instead of strerror 2014-08-15 10:54:29 -03:00
dso.c perf tools: Add gzip decompression support for kernel module 2014-11-05 10:11:26 -03:00
dso.h perf symbols: Preparation for compressed kernel module support 2014-11-04 10:15:53 -03:00
dwarf-aux.c
dwarf-aux.h
environment.c
event.c perf tools: Add id index 2014-10-29 11:24:47 -02:00
event.h Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-09 21:18:06 -08:00
evlist.c perf evlist: Use roundup_pow_of_two 2014-12-17 11:58:16 -03:00
evlist.h perf evlist: Introduce strerror_mmap method 2014-12-11 18:03:01 -03:00
evsel.c perf tools: Remove perf_evsel__read interface 2014-12-01 20:00:30 -03:00
evsel.h perf stat: Add support for per-pkg counters 2014-12-01 20:00:30 -03:00
exec_cmd.c
exec_cmd.h
find-vdso-map.c perf tools: Build programs to copy 32-bit compatibility 2014-10-29 10:32:48 -02:00
generate-cmdlist.sh
header.c perf build-id: Move disable_buildid_cache() to util/build-id.c 2014-11-19 12:33:46 -03:00
header.h perf build-id: Move build-id related functions to util/build-id.c 2014-11-05 10:14:07 -03:00
help.c
help.h
hist.c perf callchain: Append callchains only when requested 2014-12-23 12:06:39 -03:00
hist.h perf report: Show progress bar for output resorting 2014-12-23 12:01:37 -03:00
hweight.c
intlist.c
intlist.h
kvm-stat.h perf kvm stat report: Save pid string in opts.target.pid 2014-09-17 17:08:07 -03:00
levenshtein.c
levenshtein.h
machine.c perf callchain: Move cpumode resolve code to add_callchain_ip 2014-12-09 10:06:29 -03:00
machine.h perf tools: Add facility to export data in database-friendly way 2014-10-29 10:32:49 -02:00
map.c perf callchain: Make get_srcline fall back to sym+offset 2014-11-24 18:03:47 -03:00
map.h perf tools: Set thread->mg.machine in all places 2014-10-29 10:32:46 -02:00
ordered-events.c perf session: Add option to copy events when queueing 2014-10-15 17:39:03 -03:00
ordered-events.h perf session: Add option to copy events when queueing 2014-10-15 17:39:03 -03:00
pager.c
parse-events.c perf tools: Add snapshot format file parsing 2014-11-24 18:03:51 -03:00
parse-events.h perf tools: Parse the pmu event prefix and suffix 2014-10-15 16:05:01 -03:00
parse-events.l perf tools: Add support to new style format of kernel PMU event 2014-10-15 16:05:45 -03:00
parse-events.y perf tools: Add support to new style format of kernel PMU event 2014-10-15 16:05:45 -03:00
parse-options.c perf tools: Add support for exclusive option 2014-10-29 10:32:47 -02:00
parse-options.h perf tools: Add support for exclusive option 2014-10-29 10:32:47 -02:00
path.c
PERF-VERSION-GEN
perf_regs.c
perf_regs.h
pmu.c perf tools: Add snapshot format file parsing 2014-11-24 18:03:51 -03:00
pmu.h perf tools: Add snapshot format file parsing 2014-11-24 18:03:51 -03:00
pmu.l
pmu.y
probe-event.c perf probe: Fix to fall back to find probe point in symbols 2015-01-02 12:42:17 -03:00
probe-event.h perf probe: Do not access kallsyms when analyzing user binaries 2014-09-17 18:01:14 -03:00
probe-finder.c perf probe: Do not use dwfl_module_addrsym if dwarf_diename finds symbol name 2014-09-17 18:01:43 -03:00
probe-finder.h
pstack.c
pstack.h
python-ext-sources
python.c tools lib api: Adopt fdarray class from perf's evlist 2014-09-25 16:46:55 -03:00
quote.c
quote.h
rblist.c
rblist.h
record.c perf tools: Use sysctl__read_int instead of ad-hoc copies 2014-12-11 17:53:04 -03:00
run-command.c perf util: Replace strerror with strerror_r for thread-safety 2014-08-15 10:58:35 -03:00
run-command.h
session.c Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-09 21:18:06 -08:00
session.h perf session: Add perf_session__deliver_synth_event() 2014-10-29 11:36:15 -02:00
setup.py
sigchain.c
sigchain.h
sort.c perf callchain: Make get_srcline fall back to sym+offset 2014-11-24 18:03:47 -03:00
sort.h perf tools: Add +field argument support for --field option 2014-08-24 08:11:19 -03:00
srcline.c perf: Fix building warning on ARM 32 2014-12-19 13:09:43 +01:00
stat.c
stat.h
strbuf.c
strbuf.h
strfilter.c
strfilter.h
string.c Revert "perf tools: Default to cpu// for events v5" 2014-10-15 16:04:33 -03:00
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol-elf.c perf symbols: Move bfd_demangle stubbing to its only user 2014-11-24 18:03:47 -03:00
symbol-minimal.c perf symbols: Fix use after free in filename__read_build_id 2014-12-17 11:58:17 -03:00
symbol.c perf record: Do not save pathname in ./debug/.build-id directory for vmlinux 2014-11-05 10:14:08 -03:00
symbol.h perf callchain: Support handling complete branch stacks as histograms 2014-12-01 20:00:31 -03:00
target.c
target.h
thread-stack.c perf tools: Enhance the thread stack to output call/return data 2014-11-03 17:43:56 -03:00
thread-stack.h perf tools: Enhance the thread stack to output call/return data 2014-11-03 17:43:56 -03:00
thread.c perf tools: Only override the default :tid comm entry 2014-11-19 12:37:26 -03:00
thread.h perf tools: Add a thread stack for synthesizing call chains 2014-11-03 17:10:59 -03:00
thread_map.c perf thread_map: Create dummy constructor out of open coded equivalent 2014-10-14 17:32:52 -03:00
thread_map.h perf thread_map: Create dummy constructor out of open coded equivalent 2014-10-14 17:32:52 -03:00
tool.h perf tools: Add id index 2014-10-29 11:24:47 -02:00
top.c
top.h
trace-event-info.c
trace-event-parse.c
trace-event-read.c perf tools: Remove needless getopt.h includes 2014-07-17 12:59:00 -03:00
trace-event-scripting.c perf scripting: Add 'flush' callback to scripting API 2014-08-22 13:12:11 -03:00
trace-event.c
trace-event.h perf scripting: Add 'flush' callback to scripting API 2014-08-22 13:12:11 -03:00
tsc.c perf tools: Move rdtsc() function 2014-07-23 11:48:11 -03:00
tsc.h perf tools: Move rdtsc() function 2014-07-23 11:48:11 -03:00
unwind-libdw.c perf callchains: Use thread->mg->machine 2014-10-29 10:32:46 -02:00
unwind-libdw.h
unwind-libunwind.c perf callchains: Use thread->mg->machine 2014-10-29 10:32:46 -02:00
unwind.h perf callchains: Use thread->mg->machine 2014-10-29 10:32:46 -02:00
usage.c
util.c perf tools: Use sysctl__read_int instead of ad-hoc copies 2014-12-11 17:53:04 -03:00
util.h perf: Fix building warning on ARM 32 2014-12-19 13:09:43 +01:00
values.c
values.h
vdso.c perf tools: Do not attempt to run perf-read-vdso32 if it wasn't built 2014-10-29 10:32:48 -02:00
vdso.h perf tools: Add support for 32-bit compatibility VDSOs 2014-10-29 10:32:48 -02:00
wrapper.c
xyarray.c
xyarray.h
zlib.c perf tools: Add gzip decompression support for kernel module 2014-11-05 10:11:26 -03:00