Embedded ruby event hooks

Hi
We have been running ruby for about 7 years as an embedded interpreter
and we are trying to upgrade from 1.8.7 to 1.9.3. One of the things we
do is to add an event hook using rb_add_event_hook for event type
RUBY_EVENT_CALL
This allows us to ‘know’ what ruby method is being called.
In our function for the hook proc we use the passed in ID value to tell
us the name of the ruby method that is about to run. This works well in
1.8.7.

In 1.9.3 the id passed in is always 0. Looking thru the code I can see
that this is marked in insns.def as ‘TODO’ (insns.def line 875 -
EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */);
I’m not sure yet what insns.def is or how it works - but without the
method id our code dies.

Is there any other way of finding the method name that is about to be
called?
Any help gratefully received.
Cheers
Steve

On Dec 1, 2011, at 18:55 , Steve H. wrote:

that this is marked in insns.def as ‘TODO’ (insns.def line 875 -
EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */);
I’m not sure yet what insns.def is or how it works - but without the
method id our code dies.

Chase the code down to the handler and you’ll see that they look up the
class and id whenever it is 0.

Ryan D. wrote in post #1034666:

Chase the code down to the handler and you’ll see that they look up the
class and id whenever it is 0.

Thanks Ryan
Bit of hunting revealed
rb_frame_method_id_and_class

Now - to fix the rb_gc crash…
Cheers
Steve

-----Messaggio originale-----
Da: Ryan D. [mailto:[email protected]]
Inviato: venerd 2 dicembre 2011 04:29
A: ruby-talk ML
Oggetto: Re: embedded ruby event hooks

On Dec 1, 2011, at 18:55 , Steve H. wrote:

that this is marked in insns.def as ‘TODO’ (insns.def line 875 -
EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */); I’m
not sure yet what insns.def is or how it works - but without the
method id our code dies.

Chase the code down to the handler and you’ll see that they look up the
class and id whenever it is 0.


Caselle da 1GB, trasmetti allegati fino a 3GB e in piu’ IMAP, POP3 e
SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f

Sponsor:
Capodanno al parco Oltremare Riccione: Pacchetto hotel 3 stelle in
centro + ingresso al parco.

-----Messaggio originale-----
Da: Steve H. [mailto:[email protected]]
Inviato: venerd 2 dicembre 2011 03:55
A: ruby-talk ML
Oggetto: embedded ruby event hooks

Hi
We have been running ruby for about 7 years as an embedded interpreter
and
we are trying to upgrade from 1.8.7 to 1.9.3. One of the things we do is
to
add an event hook using rb_add_event_hook for event type RUBY_EVENT_CALL
This allows us to ‘know’ what ruby method is being called.
In our function for the hook proc we use the passed in ID value to tell
us
the name of the ruby method that is about to run. This works well in
1.8.7.

In 1.9.3 the id passed in is always 0. Looking thru the code I can see
that
this is marked in insns.def as ‘TODO’ (insns.def line 875 -
EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */); I’m
not
sure yet what insns.def is or how it works - but without the method id
our
code dies.

Is there any other way of finding the method name that is about to be
called?
Any help gratefully received.
Cheers
Steve


Posted via http://www.ruby-forum.com/.


Caselle da 1GB, trasmetti allegati fino a 3GB e in piu’ IMAP, POP3 e
SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f

Sponsor:
Conto Arancio al 4,20%. Soldi sempre disponibili, zero spese, aprilo in
due minuti!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid923&d)-12