* perf probe: adding probe on C++ member/namespace function or versioned symbols @ 2021-12-08 20:08 Milian Wolff 2021-12-09 10:47 ` James Clark 0 siblings, 1 reply; 4+ messages in thread From: Milian Wolff @ 2021-12-08 20:08 UTC (permalink / raw) To: linux-perf-users; +Cc: Arnaldo Carvalho de Melo [-- Attachment #1: Type: text/plain, Size: 1017 bytes --] Hey there, how can one escape function names for `perf probe`? It seems like the current parser is confused by the `:` which is common in C++ symbol names. ``` $ perf probe -F --exec /usr/lib/libQt5Widgets.so | grep syncBacking QWidgetPrivate::syncBackingStore QWidgetPrivate::syncBackingStore $ perf probe --exec /usr/lib/libQt5Widgets.so --add QWidgetPrivate::syncBackingStore Semantic error :There is non-digit char in line number. ... ``` Additionally, it is also not possible to pass a versioned symbol either: ``` $ nm -aD /usr/lib/libQt5Widgets.so | grep syncBacking 0000000000197480 T _ZN14QWidgetPrivate16syncBackingStoreERK7QRegion@@Qt_5_PRIVATE_API 00000000001973b0 T _ZN14QWidgetPrivate16syncBackingStoreEv@@Qt_5_PRIVATE_API Semantic error :SRC@SRC is not allowed. ... ``` Is there a workaround available for this? Thanks -- Milian Wolff | milian.wolff@kdab.com | Senior Software Engineer KDAB (Deutschland) GmbH, a KDAB Group company Tel: +49-30-521325470 KDAB - The Qt, C++ and OpenGL Experts [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5272 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: perf probe: adding probe on C++ member/namespace function or versioned symbols 2021-12-08 20:08 perf probe: adding probe on C++ member/namespace function or versioned symbols Milian Wolff @ 2021-12-09 10:47 ` James Clark 2021-12-15 13:10 ` Milian Wolff 0 siblings, 1 reply; 4+ messages in thread From: James Clark @ 2021-12-09 10:47 UTC (permalink / raw) To: Milian Wolff, linux-perf-users; +Cc: Arnaldo Carvalho de Melo On 08/12/2021 20:08, Milian Wolff wrote: > Hey there, > > how can one escape function names for `perf probe`? It seems like the current > parser is confused by the `:` which is common in C++ symbol names. > > ``` > $ perf probe -F --exec /usr/lib/libQt5Widgets.so | grep syncBacking > QWidgetPrivate::syncBackingStore > QWidgetPrivate::syncBackingStore It might not be obvious, but you have to get the mangled name with 'nm -D', and then pass the mangled name with --no-demangle to perf and then it works: sudo ./perf probe --no-demangle --exec libQt5Widgets.so.5 --add '_ZN14QWidgetPrivate16syncBackingStoreEv' Maybe the docs could be updated to make it clearer, or print a warning message, or get perf to output mangled symbols in addition to demangled with -F. > > $ perf probe --exec /usr/lib/libQt5Widgets.so --add > QWidgetPrivate::syncBackingStore > Semantic error :There is non-digit char in line number. > ... > ``` > > Additionally, it is also not possible to pass a versioned symbol either: > ``` > $ nm -aD /usr/lib/libQt5Widgets.so | grep syncBacking > 0000000000197480 T > _ZN14QWidgetPrivate16syncBackingStoreERK7QRegion@@Qt_5_PRIVATE_API > 00000000001973b0 T _ZN14QWidgetPrivate16syncBackingStoreEv@@Qt_5_PRIVATE_API > Semantic error :SRC@SRC is not allowed. If adding mangling fix doesn't work for this one, you could try removing some of the name processing in probe-event.c like: /* Cut off the dot suffixes (e.g. .const, .isra) and version suffixes */ p = strpbrk(nbase, ".@"); if (p && p != nbase) *p = '\0'; > ... > ``` > > Is there a workaround available for this? > > Thanks > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: perf probe: adding probe on C++ member/namespace function or versioned symbols 2021-12-09 10:47 ` James Clark @ 2021-12-15 13:10 ` Milian Wolff 2021-12-15 14:59 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 4+ messages in thread From: Milian Wolff @ 2021-12-15 13:10 UTC (permalink / raw) To: linux-perf-users, James Clark; +Cc: Arnaldo Carvalho de Melo [-- Attachment #1: Type: text/plain, Size: 2403 bytes --] On Donnerstag, 9. Dezember 2021 11:47:52 CET James Clark wrote: > On 08/12/2021 20:08, Milian Wolff wrote: > > Hey there, > > > > how can one escape function names for `perf probe`? It seems like the > > current parser is confused by the `:` which is common in C++ symbol > > names. > > > > ``` > > $ perf probe -F --exec /usr/lib/libQt5Widgets.so | grep syncBacking > > QWidgetPrivate::syncBackingStore > > QWidgetPrivate::syncBackingStore > > It might not be obvious, but you have to get the mangled name with 'nm -D', > and then pass the mangled name with --no-demangle to perf and then it works: > > sudo ./perf probe --no-demangle --exec libQt5Widgets.so.5 --add > '_ZN14QWidgetPrivate16syncBackingStoreEv' > > Maybe the docs could be updated to make it clearer, or print a warning > message, or get perf to output mangled symbols in addition to demangled > with -F. Thank you, that indeed works. But it's _very_ unintuitive. Generally, I think there are many languages out there which produce demangled names containing colons - could we come up with a way to allow specifying a demangled symbol including colons (and maybe even @@), that does not conflict with the existing `:` for the line suffix? For C++ (and Rust?) at least, we could handle two colons differently from just one. What do you think? > > $ perf probe --exec /usr/lib/libQt5Widgets.so --add > > QWidgetPrivate::syncBackingStore > > Semantic error :There is non-digit char in line number. > > ... > > ``` > > > > Additionally, it is also not possible to pass a versioned symbol either: > > ``` > > $ nm -aD /usr/lib/libQt5Widgets.so | grep syncBacking > > 0000000000197480 T > > _ZN14QWidgetPrivate16syncBackingStoreERK7QRegion@@Qt_5_PRIVATE_API > > 00000000001973b0 T > > _ZN14QWidgetPrivate16syncBackingStoreEv@@Qt_5_PRIVATE_API Semantic error > > :SRC@SRC is not allowed. > > If adding mangling fix doesn't work for this one, you could try removing > some of the name processing in probe-event.c like: > > /* Cut off the dot suffixes (e.g. .const, .isra) and version suffixes */ > p = strpbrk(nbase, ".@"); > if (p && p != nbase) > *p = '\0'; > > > ... > > ``` > > > > Is there a workaround available for this? > > > > Thanks -- Milian Wolff | milian.wolff@kdab.com | Senior Software Engineer KDAB (Deutschland) GmbH, a KDAB Group company Tel: +49-30-521325470 KDAB - The Qt, C++ and OpenGL Experts [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5272 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: perf probe: adding probe on C++ member/namespace function or versioned symbols 2021-12-15 13:10 ` Milian Wolff @ 2021-12-15 14:59 ` Arnaldo Carvalho de Melo 0 siblings, 0 replies; 4+ messages in thread From: Arnaldo Carvalho de Melo @ 2021-12-15 14:59 UTC (permalink / raw) To: Milian Wolff; +Cc: linux-perf-users, James Clark, Arnaldo Carvalho de Melo Em Wed, Dec 15, 2021 at 02:10:33PM +0100, Milian Wolff escreveu: > On Donnerstag, 9. Dezember 2021 11:47:52 CET James Clark wrote: > > On 08/12/2021 20:08, Milian Wolff wrote: > > > Hey there, > > > > > > how can one escape function names for `perf probe`? It seems like the > > > current parser is confused by the `:` which is common in C++ symbol > > > names. > > > > > > ``` > > > $ perf probe -F --exec /usr/lib/libQt5Widgets.so | grep syncBacking > > > QWidgetPrivate::syncBackingStore > > > QWidgetPrivate::syncBackingStore > > > > It might not be obvious, but you have to get the mangled name with 'nm -D', > > and then pass the mangled name with --no-demangle to perf and then it works: > > > > sudo ./perf probe --no-demangle --exec libQt5Widgets.so.5 --add > > '_ZN14QWidgetPrivate16syncBackingStoreEv' > > > > Maybe the docs could be updated to make it clearer, or print a warning > > message, or get perf to output mangled symbols in addition to demangled > > with -F. > > Thank you, that indeed works. But it's _very_ unintuitive. Generally, I think > there are many languages out there which produce demangled names containing > colons - could we come up with a way to allow specifying a demangled symbol > including colons (and maybe even @@), that does not conflict with the existing > `:` for the line suffix? For C++ (and Rust?) at least, we could handle two > colons differently from just one. What do you think? I agree, we need to lift this limitation. - Arnaldo > > > $ perf probe --exec /usr/lib/libQt5Widgets.so --add > > > QWidgetPrivate::syncBackingStore > > > Semantic error :There is non-digit char in line number. > > > ... > > > ``` > > > > > > Additionally, it is also not possible to pass a versioned symbol either: > > > ``` > > > $ nm -aD /usr/lib/libQt5Widgets.so | grep syncBacking > > > 0000000000197480 T > > > _ZN14QWidgetPrivate16syncBackingStoreERK7QRegion@@Qt_5_PRIVATE_API > > > 00000000001973b0 T > > > _ZN14QWidgetPrivate16syncBackingStoreEv@@Qt_5_PRIVATE_API Semantic error > > > :SRC@SRC is not allowed. > > > > If adding mangling fix doesn't work for this one, you could try removing > > some of the name processing in probe-event.c like: > > > > /* Cut off the dot suffixes (e.g. .const, .isra) and version suffixes > */ > > p = strpbrk(nbase, ".@"); > > if (p && p != nbase) > > *p = '\0'; > > > > > ... > > > ``` > > > > > > Is there a workaround available for this? > > > > > > Thanks > > > -- > Milian Wolff | milian.wolff@kdab.com | Senior Software Engineer > KDAB (Deutschland) GmbH, a KDAB Group company > Tel: +49-30-521325470 > KDAB - The Qt, C++ and OpenGL Experts -- - Arnaldo ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-15 14:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-12-08 20:08 perf probe: adding probe on C++ member/namespace function or versioned symbols Milian Wolff 2021-12-09 10:47 ` James Clark 2021-12-15 13:10 ` Milian Wolff 2021-12-15 14:59 ` Arnaldo Carvalho de Melo
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.