* failed to add c++ probe @ 2016-09-19 9:54 Jiri Olsa 2016-09-19 23:05 ` Masami Hiramatsu 0 siblings, 1 reply; 7+ messages in thread From: Jiri Olsa @ 2016-09-19 9:54 UTC (permalink / raw) To: Masami Hiramatsu Cc: Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra, Ingo Molnar, Thomas Gleixner, Namhyung Kim, David Ahern hi, Thomas reported failure to add an uprobe on libstdc++.so.6 like: [jolsa@krava perf]$ sudo ./perf probe -x /usr/lib64/libstdc++.so.6 'std::ostream::flush' Semantic error :There is non-digit char in line number. Error: Command Parse Error. it does not work also if I use the mangled name like: [jolsa@krava perf]$ sudo ./perf probe -x /usr/lib64/libstdc++.so.6 '_ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_' Probe point '_ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_' not found. Error: Failed to add events. thanks, jirka ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: failed to add c++ probe 2016-09-19 9:54 failed to add c++ probe Jiri Olsa @ 2016-09-19 23:05 ` Masami Hiramatsu 2016-09-19 23:32 ` Thomas Gleixner 0 siblings, 1 reply; 7+ messages in thread From: Masami Hiramatsu @ 2016-09-19 23:05 UTC (permalink / raw) To: Jiri Olsa Cc: Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra, Ingo Molnar, Thomas Gleixner, Namhyung Kim, David Ahern On Mon, 19 Sep 2016 11:54:02 +0200 Jiri Olsa <jolsa@redhat.com> wrote: > hi, > Thomas reported failure to add an uprobe on libstdc++.so.6 like: > > [jolsa@krava perf]$ sudo ./perf probe -x /usr/lib64/libstdc++.so.6 'std::ostream::flush' > Semantic error :There is non-digit char in line number. > Error: Command Parse Error. Ah, I should start adding mangling support on perf probe... > it does not work also if I use the mangled name like: > > [jolsa@krava perf]$ sudo ./perf probe -x /usr/lib64/libstdc++.so.6 '_ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_' > Probe point '_ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_' not found. > Error: Failed to add events. Hmm, could you try to find mangled symbol from the library as below? ./perf probe -x /usr/lib64/libstdc++.so.6 -F \* And also try to do adding probe with -v option again? In my case, I could find the mangled symbol, but failed to setup the probe... $ sudo ./perf probe -x /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -v _ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_ probe-definition(0): _ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_ symbol:_ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_ file:(null) line:0 offset:0 return:0 lazy:(null) 0 arguments symbol:catch file:(null) line:0 offset:0 return:0 lazy:(null) symbol:throw file:(null) line:0 offset:0 return:0 lazy:(null) symbol:rethrow file:(null) line:0 offset:0 return:0 lazy:(null) Could not open debuginfo. Try to use symbols. Opening /sys/kernel/debug/tracing//uprobe_events write=1 Writing event: p:probe_libstdc++/_ZSt5flushIwSt11char_traitsIwEERSt13basic_ostreamIT_T0_ES6_ /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21:0x1114c0 Failed to write event: Invalid argument Error: Failed to add events. Reason: Invalid argument (Code: -22) dmsg -k said; [143725.339609] Failed to allocate trace_uprobe.(-22) [143725.339612] Failed to parse address or file. It seems we need to fix trace_uprobe.c at least. Thank you! -- Masami Hiramatsu <mhiramat@kernel.org> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: failed to add c++ probe 2016-09-19 23:05 ` Masami Hiramatsu @ 2016-09-19 23:32 ` Thomas Gleixner 2016-09-21 3:37 ` Masami Hiramatsu 0 siblings, 1 reply; 7+ messages in thread From: Thomas Gleixner @ 2016-09-19 23:32 UTC (permalink / raw) To: Masami Hiramatsu Cc: Jiri Olsa, Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra, Ingo Molnar, Namhyung Kim, David Ahern Masami, On Tue, 20 Sep 2016, Masami Hiramatsu wrote: > Hmm, could you try to find mangled symbol from the library as below? > > ./perf probe -x /usr/lib64/libstdc++.so.6 -F \* > > And also try to do adding probe with -v option again? > > In my case, I could find the mangled symbol, but failed to setup the probe... ./perf probe -x /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -v _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv probe-definition(0): _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv symbol:_X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv file:(null) line:0 offset:0 return:0 lazy:(null) 0 arguments symbol:catch file:(null) line:0 offset:0 return:0 lazy:(null) symbol:throw file:(null) line:0 offset:0 return:0 lazy:(null) symbol:rethrow file:(null) line:0 offset:0 return:0 lazy:(null) Open Debuginfo file: /usr/lib/debug/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 Try to find probe point from debuginfo. Symbol _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv address found : 8c620 Matched function: is_open found inline addr: 0x8cad0 Probe point found: is_open+0 found inline addr: 0x8cac0 Probe point found: is_open+0 found inline addr: 0x8cab0 Probe point found: is_open+0 Matched function: is_open An error occurred in debuginfo analysis (-2). Trying to use symbols. Opening /sys/kernel/tracing//uprobe_events write=1 Writing event: p:probe_libstdc++/_X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22:0x8c620 Failed to write event: Invalid argument Error: Failed to add events. Reason: Invalid argument (Code: -22) [16568.176464] Failed to allocate trace_uprobe.(-22) [16568.176468] Failed to parse address or file. Aside of that mangled symbols with a @plt suffix do not work at all. Thanks, tglx ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: failed to add c++ probe 2016-09-19 23:32 ` Thomas Gleixner @ 2016-09-21 3:37 ` Masami Hiramatsu 2016-09-21 4:43 ` Masami Hiramatsu 0 siblings, 1 reply; 7+ messages in thread From: Masami Hiramatsu @ 2016-09-21 3:37 UTC (permalink / raw) To: Thomas Gleixner Cc: Jiri Olsa, Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra, Ingo Molnar, Namhyung Kim, David Ahern On Tue, 20 Sep 2016 01:32:04 +0200 (CEST) Thomas Gleixner <tglx@linutronix.de> wrote: > Masami, > > On Tue, 20 Sep 2016, Masami Hiramatsu wrote: > > Hmm, could you try to find mangled symbol from the library as below? > > > > ./perf probe -x /usr/lib64/libstdc++.so.6 -F \* > > > > And also try to do adding probe with -v option again? > > > > In my case, I could find the mangled symbol, but failed to setup the probe... > > ./perf probe -x /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -v _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv > probe-definition(0): _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv > symbol:_X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv file:(null) line:0 offset:0 return:0 lazy:(null) > 0 arguments > symbol:catch file:(null) line:0 offset:0 return:0 lazy:(null) > symbol:throw file:(null) line:0 offset:0 return:0 lazy:(null) > symbol:rethrow file:(null) line:0 offset:0 return:0 lazy:(null) > Open Debuginfo file: /usr/lib/debug/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 > Try to find probe point from debuginfo. > Symbol _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv address found : 8c620 > Matched function: is_open > found inline addr: 0x8cad0 > Probe point found: is_open+0 > found inline addr: 0x8cac0 > Probe point found: is_open+0 > found inline addr: 0x8cab0 > Probe point found: is_open+0 > Matched function: is_open > An error occurred in debuginfo analysis (-2). > Trying to use symbols. > Opening /sys/kernel/tracing//uprobe_events write=1 > Writing event: p:probe_libstdc++/_X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22:0x8c620 > Failed to write event: Invalid argument > Error: Failed to add events. Reason: Invalid argument (Code: -22) > > [16568.176464] Failed to allocate trace_uprobe.(-22) > [16568.176468] Failed to parse address or file. > > Aside of that mangled symbols with a @plt suffix do not work at all. Oh, OK. I could reproduce it. I'll investigate it. :) Thank you, -- Masami Hiramatsu <mhiramat@kernel.org> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: failed to add c++ probe 2016-09-21 3:37 ` Masami Hiramatsu @ 2016-09-21 4:43 ` Masami Hiramatsu 2016-09-22 8:54 ` Peter Zijlstra 0 siblings, 1 reply; 7+ messages in thread From: Masami Hiramatsu @ 2016-09-21 4:43 UTC (permalink / raw) To: Masami Hiramatsu Cc: Thomas Gleixner, Jiri Olsa, Arnaldo Carvalho de Melo, linux-kernel, Peter Zijlstra, Ingo Molnar, Namhyung Kim, David Ahern On Wed, 21 Sep 2016 12:37:59 +0900 Masami Hiramatsu <mhiramat@kernel.org> wrote: > On Tue, 20 Sep 2016 01:32:04 +0200 (CEST) > Thomas Gleixner <tglx@linutronix.de> wrote: > > > Masami, > > > > On Tue, 20 Sep 2016, Masami Hiramatsu wrote: > > > Hmm, could you try to find mangled symbol from the library as below? > > > > > > ./perf probe -x /usr/lib64/libstdc++.so.6 -F \* > > > > > > And also try to do adding probe with -v option again? > > > > > > In my case, I could find the mangled symbol, but failed to setup the probe... > > > > ./perf probe -x /usr/lib/x86_64-linux-gnu/libstdc++.so.6 -v _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv > > probe-definition(0): _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv > > symbol:_X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv file:(null) line:0 offset:0 return:0 lazy:(null) > > 0 arguments > > symbol:catch file:(null) line:0 offset:0 return:0 lazy:(null) > > symbol:throw file:(null) line:0 offset:0 return:0 lazy:(null) > > symbol:rethrow file:(null) line:0 offset:0 return:0 lazy:(null) > > Open Debuginfo file: /usr/lib/debug/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 > > Try to find probe point from debuginfo. > > Symbol _X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv address found : 8c620 > > Matched function: is_open > > found inline addr: 0x8cad0 > > Probe point found: is_open+0 > > found inline addr: 0x8cac0 > > Probe point found: is_open+0 > > found inline addr: 0x8cab0 > > Probe point found: is_open+0 > > Matched function: is_open > > An error occurred in debuginfo analysis (-2). > > Trying to use symbols. > > Opening /sys/kernel/tracing//uprobe_events write=1 > > Writing event: p:probe_libstdc++/_X_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22:0x8c620 > > Failed to write event: Invalid argument > > Error: Failed to add events. Reason: Invalid argument (Code: -22) > > > > [16568.176464] Failed to allocate trace_uprobe.(-22) > > [16568.176468] Failed to parse address or file. > > > > Aside of that mangled symbols with a @plt suffix do not work at all. > > Oh, OK. I could reproduce it. I'll investigate it. :) > Hmm, I found there are 3 issues in perf-probe to define event on C++ libs. 1) No mangle/demangle symbol support. This needs a) fix option parser to accept C++ method name correctly, b) mangle that method, and c) demangle it when we show the probe point. 2) @plt symbol should be skipped since the real function will be called(jumped) from plt, when searching probe point. 3) Event group name is including some characters which can not be used (e.g. "++"). Thus we have to remove it or replace it with '_' or other alphabet.("PP"?) Thank you, -- Masami Hiramatsu <mhiramat@kernel.org> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: failed to add c++ probe 2016-09-21 4:43 ` Masami Hiramatsu @ 2016-09-22 8:54 ` Peter Zijlstra 2016-09-23 13:32 ` Masami Hiramatsu 0 siblings, 1 reply; 7+ messages in thread From: Peter Zijlstra @ 2016-09-22 8:54 UTC (permalink / raw) To: Masami Hiramatsu Cc: Thomas Gleixner, Jiri Olsa, Arnaldo Carvalho de Melo, linux-kernel, Ingo Molnar, Namhyung Kim, David Ahern On Wed, Sep 21, 2016 at 01:43:24PM +0900, Masami Hiramatsu wrote: > On Wed, 21 Sep 2016 12:37:59 +0900 > Masami Hiramatsu <mhiramat@kernel.org> wrote: > Hmm, I found there are 3 issues in perf-probe to define event on C++ libs. > > 1) No mangle/demangle symbol support. This needs a) fix option parser to > accept C++ method name correctly, b) mangle that method, and c) demangle > it when we show the probe point. I think we should also allow using the mangled name, supporting (de)mangling is of course nice, but not required per-se. Esp. since there's more than just C++ mangling. Having the mangling stuff as optional makes it a convenience but still allows using this on other languages for which we do not support the mangling. > 2) @plt symbol should be skipped since the real function will be called(jumped) > from plt, when searching probe point. > > 3) Event group name is including some characters which can not be used (e.g. "++"). > Thus we have to remove it or replace it with '_' or other alphabet.("PP"?) What is the problem with the '+' character? Why cannot this be used? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: failed to add c++ probe 2016-09-22 8:54 ` Peter Zijlstra @ 2016-09-23 13:32 ` Masami Hiramatsu 0 siblings, 0 replies; 7+ messages in thread From: Masami Hiramatsu @ 2016-09-23 13:32 UTC (permalink / raw) To: Peter Zijlstra Cc: Thomas Gleixner, Jiri Olsa, Arnaldo Carvalho de Melo, linux-kernel, Ingo Molnar, Namhyung Kim, David Ahern On Thu, 22 Sep 2016 10:54:06 +0200 Peter Zijlstra <peterz@infradead.org> wrote: > On Wed, Sep 21, 2016 at 01:43:24PM +0900, Masami Hiramatsu wrote: > > On Wed, 21 Sep 2016 12:37:59 +0900 > > Masami Hiramatsu <mhiramat@kernel.org> wrote: > > > Hmm, I found there are 3 issues in perf-probe to define event on C++ libs. > > > > 1) No mangle/demangle symbol support. This needs a) fix option parser to > > accept C++ method name correctly, b) mangle that method, and c) demangle > > it when we show the probe point. > > I think we should also allow using the mangled name, supporting (de)mangling > is of course nice, but not required per-se. Esp. since there's more than > just C++ mangling. Having the mangling stuff as optional makes it a > convenience but still allows using this on other languages for which we > do not support the mangling. Agreed. I also learned that mangling depends on the compiler and no good way to get demangled name to mangled name. Moreover, the demangled name will include arguments, templates etc. because of supporting polymorphism. At this phase, I would like to support only "method name" or "mangled name". > > 2) @plt symbol should be skipped since the real function will be called(jumped) > > from plt, when searching probe point. > > > > 3) Event group name is including some characters which can not be used (e.g. "++"). > > Thus we have to remove it or replace it with '_' or other alphabet.("PP"?) > > What is the problem with the '+' character? Why cannot this be used? In the ftrace, it is not considered to use such characters for event/group name, because the name is used for generating symbols for tracepoints. IOW, other tracepoint events have the name same as C naming conventions. (Maybe that is also good for out-of-tree tools and scripts to parse it.) Thank you, -- Masami Hiramatsu <mhiramat@kernel.org> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-09-23 13:32 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-09-19 9:54 failed to add c++ probe Jiri Olsa 2016-09-19 23:05 ` Masami Hiramatsu 2016-09-19 23:32 ` Thomas Gleixner 2016-09-21 3:37 ` Masami Hiramatsu 2016-09-21 4:43 ` Masami Hiramatsu 2016-09-22 8:54 ` Peter Zijlstra 2016-09-23 13:32 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).