Re: Re: instrumenting try block
Yudi Zheng <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <CAA=eNoOz7F7bcSL7WecdnBktcPi_hm2N0kOWFCr8Gp_drS5rug@mail.gmail.com> |
Hi, Thank you so much, ASM is so powerful that it automatically corrects error from user :) Yudi On Sat, Jul 30, 2011 at 12:49 PM, Eric Bruneton <[email protected]> wrote: > Hi, > > > 18/07/2011 18:56, Yudi Zheng wrote: > >> Hi, >> >> We are trying to insert new code section into existing exception handler. >> In an example below is just simplified scenario, but we are using similar >> code to insert try-finally into methods. >> >> We have encountered buggy behavior when using COMPUTE_FRAMES >> in conjunction with COMPUTE_MAXS within ClassWriter. >> >> The following code (for full runnable code see attachments) produces >> Java VerifyError. If we use the Class writer twice in a row at the end, >> the produced result is as expected. >> >> Do you have any idea, what can cause the error? >> > > ilst.insert(handler, new IntInsnNode(Opcodes.ALOAD, >> method.maxLocals)); >> ilst.insert(handler, new IntInsnNode(Opcodes.ASTORE, >> method.maxLocals)); >> > > the error is that you used IntInsnNode instead of VarInsnNode. This type of > error can easily be detected with a CheckClassAdapter: > > // Transform into bytecode > ClassWriter cw = new ClassWriter(ClassWriter.**COMPUTE_FRAMES); > ClassVisitor cv = new CheckClassAdapter(cw); > cn.accept(cv); > > Eric > > > -- > 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