Project

General

Profile

Actions

Feature #21539

open

Export symbols for external profiling of stripped shared Ruby builds

Feature #21539: Export symbols for external profiling of stripped shared Ruby builds
3

Added by dalehamel (Dale Hamel) about 1 year ago. Updated 3 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:122947]

Description

Motivation

External profilers such as OpenTelemetry's eBPF profiler collect Ruby stacks from outside the Ruby process.

Distribution packages commonly ship shared libruby but strip the full symbol table (.symtab) and debug information. Some of the symbols needed to discover Ruby's execution state are currently local symbols, so they
disappear when stripped. Public dynamic symbols in .dynsym survive normal stripping.

I'd like to narrow this proposal to making the necessary discovery symbols available in these stripped shared builds.

Proposed exports

Please export these three existing symbols from shared libruby:

Symbol Purpose
ruby_current_ec Locate the sampled native thread's execution context through TLS, providing access to its Ruby stack.
rb_vm_exec Identify the function's address range, where native stack unwinding should hand off to Ruby stack unwinding. The profiler does not call this function.
ruby_global_symbols Resolve Ruby method IDs to names for methods implemented in C. Stack walking can work without this, but those method names become <unknown cfunc>.

The profiler also needs ruby_version, which is already exported and requires no change.

The requested outcome is that these symbols are available through .dynsym in installed shared builds, without requiring distributions to retain the full symbol table or users to install debug information just to locate them.

Scope

This is a symbol-visibility request, not a request for a general out-of-process profiling API:

  • No requirement to stabilize internal struct layouts or make these internals a supported C-extension API.
  • No additional profiling stack, per-frame bookkeeping, or in-process profiling machinery.
  • The profiler remains responsible for supporting version-specific layouts and interpreter/JIT behavior.

This would address the symbol-discovery obstacle for stripped distribution builds without taking on the broader API design discussed in #19119.

Related profiler discussion: https://github.com/open-telemetry/opentelemetry-ebpf-profiler/issues/202


Files

protected.patch (1.55 KB) protected.patch protected - recommended dalehamel (Dale Hamel), 10/15/2026 12:25 PM
exported.patch (1.21 KB) exported.patch base - simple export results in material machine code changes dalehamel (Dale Hamel), 10/15/2026 12:25 PM

Related issues 2 (1 open — 1 closed)

Related to Ruby - Feature #19119: Add an interface for out-of-process profiling tools to access Ruby informationOpenActions
Related to Ruby - Bug #22396: Using rb_postponed_job_trigger causes YJIT/ZJIT compiled methods side exitsClosedjitActions
Actions

Also available in: PDF Atom