List functions
To list all functions exported
$ perf probe -x libQt5CoreKso.so --funcs --filter '*'
If you don’t add
--filter '*'
, then all functions that start with_
will be filtered by default
To list all functions in original form:
$ perf probe -x libQt5CoreKso.so --funcs --no-demangle --filter '*'
Combine with grep
, you can find the desired function
$ perf probe -x libQt5CoreKso.so --funcs --no-demangle --filter '*' | grep setValue
_ZN6kso_qt11QJsonObject10setValueAtEiRKNS_10QJsonValueE
_ZN6kso_qt18QCommandLineOption12setValueNameERKNS_7QStringE
_ZN6kso_qt24QVariantAnimationPrivate10setValueAtEdRKNS_8QVariantE
_ZN6kso_qt9QSettings8setValueERKNS_7QStringERKNS_8QVariantE
Add tracing point
To add a function as tracing point:
$ perf probe -x libQt5CoreKso.so --add _ZN6kso_qt9QSettings8setValueERKNS_7QStringERKNS_8QVariantE --no-demangle
Do not forget the --no-demangel
argument or perf won’t find the function.
To give the probe point an alias,
$ perf probe -x libQt5CoreKso.so --add setValue=_ZN6kso_qt9QSettings8setValueERKNS_7QStringERKNS_8QVariantE --no-demangle
Added new event:
probe_libQt5CoreKso:setValue (on _ZN6kso_qt9QSettings8setValueERKNS_7QStringERKNS_8QVariantE in /home/tanqiao/workspace/wps_q2/debug/WPSOffice/office6/libQt5CoreKso.so.5.12.10)
You can now use it in all perf tools, such as:
perf record -e probe_libQt5CoreKso:setValue -aR sleep 1
To list probe points
$ perf probe --list
To remove probe point
$ perf probe -d probe_libQt5CoreKso:setValue