Method Sender

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Method Sender

Jared Linde
Hello,

I need to determine what class and method called the particular method
I am
in. For example if I have a class called 'A' with a method called 'a',
and
method 'a' calls a method 'b' in a class called 'B'. How can I tell
which
class and method called 'b' from within 'b' without explicitly sending
that
information through as a method parameter?

Jared Linde
American Nuclear Insurers


Reply | Threaded
Open this post in threaded view
|

Re: Method Sender

Ian Bartholomew-19
Jared,

> I need to determine what class and method called the particular method

sender := Processor activeProcess topFrame sender method

should set #sender to the CompiledMethod that sent the message.

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Method Sender

Schwab,Wilhelm K
Jared,

>>I need to determine what class and method called the particular method
>
> sender := Processor activeProcess topFrame sender method
>
> should set #sender to the CompiledMethod that sent the message.

To Ian's reply I will add that, if you want this to work in a deployed
executable, you should probably make a quick test to see if it works
post-stripping.  If there are problems, it might be as simple as
adjusting the stripping op/tions.  I suspect you will be ok, but it's
better to check before doing a lot of work.

Have a good one,

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Method Sender

Schwab,Wilhelm K
Jared,

> To Ian's reply I will add that, if you want this to work in a deployed
> executable, you should probably make a quick test to see if it works
> post-stripping.  If there are problems, it might be as simple as
> adjusting the stripping op/tions.  I suspect you will be ok, but it's
> better to check before doing a lot of work.

I forgot to mention that my concern is over things that you might do
once you know the sender.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Method Sender

Jared Linde
I don't actually plan on doing anything with it other than logging it.
I don't plan on messing with the compiled methods, as you know that
could end up being quite dangerous...


Reply | Threaded
Open this post in threaded view
|

Re: Method Sender

Jared Linde
In reply to this post by Ian Bartholomew-19
Thanks for the hasty reply. Everything works quite well.

Jared Linde


Ian Bartholomew wrote:
> Jared,
>
> > I need to determine what class and method called the particular
method

>
> sender := Processor activeProcess topFrame sender method
>
> should set #sender to the CompiledMethod that sent the message.
>
> --
> Ian
>
> Use the Reply-To address to contact me.
> Mail sent to the From address is ignored.