> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
> List-Subscribe: <mailto:[EMAIL PROTECTED]>
> List-Help: <mailto:[EMAIL PROTECTED]>
> List-Post: <mailto:[EMAIL PROTECTED]>
> List-Id: "BCEL Users List" <bcel-user.jakarta.apache.org>
> X-Antivirus: nagoya (v4218 created Aug 14 2002)
> From: "Peter Schneider" <[EMAIL PROTECTED]>
> Date: Mon, 23 Sep 2002 21:12:59 +0200
> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
>
> Hi
>
> [...]
> Some code i don't like to read
> [...]
> > and I try to execute Target, I get a message
> >
> > Exception in thread "main" java.lang.VerifyError: (class:
> > com/cisco/nm/tools/transposer/Target, method: m1 signature:
> > ()V) Illegal use of nonvirtual function call
>
> [...]
> > 11 astore_0
> > 12 aload_0
> > 13 invokespecial #49 <Method void printStackTrace()>
> > 16 getstatic #2 <Field java.io.PrintStream out>
> > 19 ldc #6 <String "def">
> > 21 invokevirtual #4 <Method void println(java.lang.String)>
> > 24 getstatic #2 <Field java.io.PrintStream out>
> > 27 ldc #7 <String "abc">
> > 29 invokevirtual #4 <Method void println(java.lang.String)>
> > 32 return
> > Exception table:
> > from to target type
> > 0 8 11 <Class java.lang.Exception>
> >
> > Method void main(java.lang.String[])
> > 0 invokestatic #8 <Method void m1()>
> > 3 return
> >
> > I'm clearly missing something -- but what is it?
> You can't use invokespecial for printStackTrace,
> it's only legit for static final or private methods.
> btw it's no good idea to use local 0 to store the exception better use
> dup
I didn't "generate" the usage of local 0. That was the Java compiler.
>
> insert before the first instruction of any exception handler
> DUP
Initially, I tried that. But then I was unable to make the handlerPC of the
corresponding exception point to this new pre-prended instruction.
So, I went with the pattern
astore X
INS> aload X
INS> invokevirtual printStackTrace
...
observing that any catch statement seems to start with an astore.
> INVOKEVIRTUAL Throwable.printStackTrace
> and everything should be fine
> if you need to avoid double stack traces you are in trouble.
Double stacktrace wouldn't be a problem. I'm just doing a throw-away tool.
-Max
> I'm not sure if it's even possible.
>
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>