Enhance viztracer's process attachment capability
Proposal and Motivation
Currently, viztracer relies on GDB or LLDB to attach to processes and hack their address space via loading a dynamic library. However, this approach has limitations as it's unavailable on Win32 platforms and Apple Silicon macOS systems. With Python 3.14 introducing a new remote_exec function in the sys module, we now have a standardized solution that offers equivalent functionality to viztracer's current implementation. This official API not only provides better compatibility across Windows and Unix systems but also offers a more lightweight solution. By adopting remote_exec, we can enhance viztracer's process attachment capabilities.
Co-existing Solutions
Since sys.remote_exec is only available in Python 3.14+, viztracer will maintain both implementations for backward compatibility:
- Python ≥ 3.14: Use the native
sys.remote_execAPI. - Python < 3.14: Fall back to the existing GDB/LLDB-based approach.
If you're open to this idea, we can discuss the implementation in detail.
Source: gaogaotiantian/viztracer