elpddev
elpddev

Reputation: 4484

How does Erlang trace technology work?

I'm going through the Erlang module. How is the trace functionality of Erlang's virtual machine implemented?

Does it 'recompile' the bytecodes on the fly to add the trace calls? Or does it 'interpret' all bytecodes per scheduler and do the trace logic in real time each time? Or something else altogether?

Upvotes: 3

Views: 125

Answers (1)

Lukas
Lukas

Reputation: 5327

It modifies the code at runtime very similarly to how GDB inserts breakpoints into native code.

That is, the first instruction in the function is overwritten by a special trace instruction which does the tracing and then calls the original code before jumping back to the function.

Upvotes: 5

Related Questions