Hello Atam,

Wednesday, November 30, 2005, 10:43:00 PM, you wrote:

> Hi all,

> i am also newbie here, but i read alot first about BCEL. My goal is to
> extra from within a method, which other methods are called, and to
> which objects these messages are send.

> eg

> public voud m1()
> {
>   c2 c2obj = new c2();
>   c2obj.m2();
> }

> Here, wihin m1() there are 2 messages: <init> and  m2().
> This information i can extract with the code below.  What i cannot do
> yet, is to know that these messages are sent to the c2obj object. So,
> i need the name of the OBJECT to which the messages are sent. If it is
> a static call, name of object is not needed.

> If anyone can please help me with this, i would appreciate it very much.

> With kind regards,

Basiclly, you'll need two things:
1. the LocalVariables attribute of that Code section
2. the object (variable slot) that invoke instructions are operated on

The first is easily obtainable. The later is more tricky.

Normally, we would have patterns like:

load xx
invokevirtual yy

XX is then the local variable slot. Looking it up in the
LocalVariables table would then give you its name.

However, this doesn't always hold true. In rare cases, the load and
invoke instructions are very far apart.

Nam


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to