Skip to content

Enhance viztracer's process attachment capability #594

@Chang-LeHung

Description

@Chang-LeHung

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_exec API.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions