Re: How to insert instrcutions at the beginning and/or at the end of each basic block?

Buu Vinh <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
You can insert your logic at method's entry and exit using onMethodEntry and onMethodExit.

Hope this helps.

Buu Vinh

--- On Wed, 7/6/11, Leo Romanoff <[email protected]> wrote:

From: Leo Romanoff <[email protected]>
Subject: [asm]  How to insert instrcutions at the beginning and/or at the end of each basic block?
To: [email protected]
Date: Wednesday, July 6, 2011, 10:32 AM


Hi,

I'd like to instrument my java classes and insert certain sequences of
instructions at the beginning and/or at the end of each basic block
(specifically, these instructions are supposed to call a static method of
predefined class).

How this can be done? 

Do I need to use classes from the org.objectweb.asm.tree.analysis for it? I
undrestand how I can obtain frames using something like:
Analyzer a = new Analyzer(new BasicInterpreter());
...
a.analyze(owner, mn);    
Frame[] frames = a.getFrames();

But how do I get from frames to instructuions contained in this basic block,
so that I can insert new ones?

May be there are some existing examples for this kind of instrumentation
already?

Thanks for any help,
 Leo
-- 
View this message in context: http://old.nabble.com/How-to-insert-instrcutions-at-the-beginning-and-or-at-the-end-of-each-basic-block--tp32005881p32005881.html
Sent from the ASM mailing list archive at Nabble.com.


-----Inline Attachment Follows-----


-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.