Em Thu, May 29, 2014 at 09:19:30PM +0900, Masami Hiramatsu escreveu: > Fix perf probe to find correct variable DIE which has location or > external instance by tracking down the lexical blocks. > > Current die_find_variable() expects that the all variable DIEs > which has DW_TAG_variable have a location. However, since recent > dwarf information may have declaration variable DIEs at the > entry of function (subprogram), die_find_variable() returns it. > > To solve this problem, it must track down the DIE tree to find > a DIE which has an actual location or a reference for external > instance.
Acked-by: Arnaldo Carvalho de Melo <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Before: [root@zoo ~]# perf probe --del probe:vfs_getname Removed event: probe:vfs_getname [root@zoo ~]# perf probe 'vfs_getname=getname_flags:65 pathname=result->name:string' Added new event: Segmentation fault (core dumped) After: [root@zoo ~]# perf probe 'vfs_getname=getname_flags:65 pathname=result->name:string' Added new event: probe:vfs_getname (on getname_flags:65 with pathname=result->name:string) You can now use it in all perf tools, such as: perf record -e probe:vfs_getname -aR sleep 1 [root@zoo ~]# perf record -e probe:vfs_getname -a sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.550 MB perf.data (~24022 samples) ] [root@zoo ~]# perf script | head -5 perf 27758 [001] 12022.551584: probe:vfs_getname: (ffffffff811c2e43) pathname="/home/acme/libexec/perf-core/sleep" perf 27758 [001] 12022.551616: probe:vfs_getname: (ffffffff811c2e43) pathname="/usr/lib64/ccache/sleep" perf 27758 [001] 12022.551628: probe:vfs_getname: (ffffffff811c2e43) pathname="/usr/local/sbin/sleep" perf 27758 [001] 12022.551636: probe:vfs_getname: (ffffffff811c2e43) pathname="/usr/local/bin/sleep" perf 27758 [001] 12022.551644: probe:vfs_getname: (ffffffff811c2e43) pathname="/sbin/sleep" [root@zoo ~]# - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

