Bytecode in Ruby 1.9

Hi,

I’ve looked all over and I can’t seem to find any complete documentation
about the YARV bytecode. Is there a reference or spec somewhere?

On instruction I find nothing about is the trace instruction. Does
anyone know how it works?

Kind regards,

Wim

Wim Vander schelden wrote:

Hi,

I’ve looked all over and I can’t seem to find any complete documentation
about the YARV bytecode. Is there a reference or spec somewhere?
Not that I know of. What I’ve learned came from debugging vm_exec().

On instruction I find nothing about is the trace instruction. Does
anyone know how it works?
Sure. Whether trace instructions are included or not into the bytecode
is a compile-time switch. It’s on by default in all 1.9.x releases so
you don’t need to worry about that.

To use them, you need to install a hook function via
rb_add_event_hook(). Then the hook will get the trace events when they
occur.

The ruby-debug-base19 gem uses this extensively; you might want to take
a look at it.

Mark

Kind regards,

Wim