runtime_events_tools icon indicating copy to clipboard operation
runtime_events_tools copied to clipboard

Attach olly to external process

Open tmcgilchrist opened this issue 1 year ago • 1 comments

It should be possible to attach Olly to an existing OCaml program that is already running.

When enabled (either via setting the OCAML_RUNTIME_EVENTS_START environment variable or calling Runtime_events.start) a file with the pid of the process and extension .events will be created. By default this is in the current directory but can be over-ridden by the OCAML_RUNTIME_EVENTS_DIR environment variable. Each domain maintains its own ring buffer in a section of the larger file into which it emits events.

From https://v2.ocaml.org/api/Runtime_events.html

Conceptually it could look like:

┌─────────────────────┐     ┌────────────┐
│                     │     │  olly      │
│  OCaml application  │     │            │
│  with runtime events│     │            │
│               │     │     └────────────┘
│               │     │        ▲    export to file,
│        events ▼     │        │    online agent (http,grpc), or
│               ┌─────┼────────┼─┐  other API
│               └─────┼──────────┘
│                 ring│buffer
└─────────────────────┘

tmcgilchrist avatar Feb 28 '24 15:02 tmcgilchrist

"rather than" or "in addition to"? I would like it to be the latter so that the current interface where you can do olly <command> <executable> continues to work.

kayceesrk avatar Feb 28 '24 16:02 kayceesrk