uftrace v0.14
Release note
This release comes with new cool features and bug fixes.
Python tracing support
The first thing is Python language support! Now uftrace can trace python functions and methods like C/C++ functions. Internally, it uses python's sys.setprofile()
and pass the entry/exit info to the libmcount.
For example, it can trace the following python script (it needs to be a standalone executable - it should have #!
line and executable permission).
$ cat abc.py
#! /usr/bin/python3
def a(): b()
def b(): c()
def c(): print("Hello")
if __name__ == '__main__':
a()
$ chmod +x abc.py
Then uftrace can trace the functions like below:
$ uftrace abc.py
Hello
# DURATION TID FUNCTION
[235209] | __main__.<module>() {
[235209] | a() {
[235209] | b() {
[235209] | c() {
10.810 us [235209] | builtins.print();
14.926 us [235209] | } /* c */
16.628 us [235209] | } /* b */
18.867 us [235209] | } /* a */
22.000 us [235209] | } /* __main__.<module> */
Not all features work well with python scripts, but filters by name (-F
and -N
), depth (-D
), time (-t
), location (-L
) would work. However you can use full features for analysis after recording the data.
Runtime control with agent
The next is the improved agent control. The agent listens to a client connection in background when started with -g
option. Then users can connect to it with uftrace live using -p <PID>
option. The should be a process ID of the target, not the uftrace itself.
Say we want to trace my program with a filter at first. Please don't forget to start an agent.
$ uftrace record -g -F ^mycode -- myprog
Later we don't want to use the function filter anymore, and decided to use a time filter instead. Let's change the option for the uftrace record like below:
$ uftrace -p $(pidof myprog) -F ^mycode@clear -t 100us
Note that the above command would not produce any data and just pass the new options to the existing uftrace record session (for myprog).
Android (AOSP) build support
One more big thing is Android build support. While it's not officially supported, you can build uftrace as an external tool. This needed various improvements in terms of portability like abstracting shmem access and better handling of the tmp directory and dynamic linker behaviors.
It has been tested with Android 9+ on AArch64 and x86_64. You probably want to use dynamic tracing due to issues with the Android runtime. Please see INSTALL.md for the details.
Other important changes
The size filter at replay now works as same as record, since the symbol file format was changed to save the symbol size as well.
Symbol demangling on Rust programs was improved to handle trait names in a more compact way. The new demangling scheme (v0) is not supported yet.
There are also more fixes and improvements. Thank you all for making uftrace more useful, efficient and portable!
Full change list
- Enable testing of -fpatchable-function-entry instrumentation. by @yugr in #1614
- build: Add DEBUG=2 build option for macro debugging by @honggyukim in #1621
- Read patchable entries from memory instead of disk by @yugr in #1623
- demangle: More elaborated demangling for Rust by @ChoKyuWon in #1625
- uftrace: Port to Android x86_64/AArch64. by @yugr in #1605
- libmcount: Turn off unexpected vectorization in libmcount by @honggyukim in #1632
- uftrace: Modify install location for uftrace libraries by @kangtegong in #1633
- tests: Fix multiple issues in runtest.py by @honggyukim in #1628
- pre-commit: Fix RuntimeError in isort hook by @honggyukim in #1634
- tests: Fix t191_posix_spawn.py by @honggyukim in #1636
- x86_64: Fix an error in s-nested.c with -fpatchable-function-entry by @honggyukim in #1637
- tests: Fix t135_trigger_time2.py test by @honggyukim in #1638
- unittest: Fix c99 compiler error by @clementguidi in #1642
- Catch IndexError from self.sort in test/runtest.py by @bernhardkaindl in #1655
- misc: Add more prototypes enums for socket by @honggyukim in #1656
- README.md: Add links to command-specific documentation by @bernhardkaindl in #1657
- aarch64/runtest.py: Fix tests where gcc/clang emits memcpy() by @bernhardkaindl in #1659
- doc/uftrace.md: Add a common list of all options (generated from -h) by @bernhardkaindl in #1658
- cmd/recv.c: Migrate from deprecated gethostbyname() to getaddrinfo() by @bernhardkaindl in #1661
- tui: Change the loading message for report mode by @qpakzk in #1666
- README.md: Update the introduction to uftrace by @bernhardkaindl in #1653
- README.md: Improve paragraph on features regarding recorded trace data by @bernhardkaindl in #1670
- Allow customizing the bash completions dir for system-RPM installs by @bernhardkaindl in #1654
- doc/uftrace-info.md: Improve the description of info --symbols by @bernhardkaindl in #1663
- Implement client/agent protocol by @clementguidi in #1665
- kernel: Add "exit_to_user_mode_prepare" in kernel skip list by @honggyukim in #1677
- mcount: Add RCU-like capabilities to the rbtree by @clementguidi in #1678
- dynamic: Print dynamic patch stats for skipped by @honggyukim in #1675
- python: Fix source location missing problem by @honggyukim in #1686
- mcount: Toggle tracing at runtime by @clementguidi in #1643
- dynamic: x86_64: Do not allow ret insn for patch target by @honggyukim in #1701
- fix: #1690 unable to identify shebang when it has initial spaces by @yihong0618 in #1697
- Fix #1707 x86 build by @yihong0618 in #1708
- mcount: Update time and depth filters at runtime by @clementguidi in #1644
- compile: Fix compile error due to low libcapstone-dev package version by @MichelleJin12 in #1713
- Control name filters at runtime by @clementguidi in #1645
- mcount: remove variable declaration-after-statement by @paranlee in #1718
- uftrace: Add 'void' to functions without arguments by @paranlee in #1720
- python: Handle os._exit() properly by @honggyukim in #1725
- doc: Describe agent usage by @clementguidi in #1715
- Control triggers at runtime by @clementguidi in #1646
- filter: Cleanup debug code by @clementguidi in #1731
- doc: Add a python function tracing section in slide by @honggyukim in #1732
- doc: Add discord badge at the top of README.md by @honggyukim in #1733
- New release: v0.14 by @namhyung in #1714
New Contributors
- @ChoKyuWon made their first contribution in #1625
- @yihong0618 made their first contribution in #1697
Full Changelog: v0.13.1...v0.14