janestreet/magic-trace

Any support planned for managed languages?

Closed this issue · 3 comments

From what I can tell magic-trace right now only works with native binaries as you need to select a symbol address up front.

Do guys have any plans for managed languages? Maybe via the perf symbol map files?

I don't believe we've got immediate plans for this.

However might I suggest the following:
As mentioned in the tutorial magic-trace will capture a 10ms snapshot after encountering a call to Magic_trace.make_snapshot. Under the hood make_snapshot is inserting a call to a symbol named magic_trace_stop_indicator and setting up magic-trace to take a snapshot when a call to magic_trace_stop_indicator is encountered.

You should be able reproduce this behavior on non-OCaml program by inserting a call to a function named magic_trace_stop_indicator (we don't really care about its signature) somewhere in your program. Calling magic-trace attach or magic-trace trace without passing -symbol will capture a trace once this call is met.

We're committing to automatically detecting and reading perf map files for 1.0. It's relatively straightforward, and documented here.

Brilliant, sounds good. I guess that will only work in attach mode but can't really see how it would work otherwise.