> I am using these intruction to instrument
> code.append(InstructionConstants.DUP);
> code.append(InstructionConstants.DUP);
> code.append(new PUSH(cp,mesg));
> code.append(new INVOKESTATIC(prb));
I don't know BCEL, but this looks as if it's emitting code to do two "dups",
followed by a "push" of something that doesn't look much like an integer to me,
followed by an "invokestatic". If the error message is correct then the static
method expects to find two ints on the stack.
If that doesn't give you any ideas, then you could try using the verifier in
BCEL. I'm told that it gives more helpful error messages than the "real" one.
> Decomiling the code using JAD and then recompiling the instrumented code
> works.
So compare the bytecode you generate with that produced by JAD+recompile, and
see what the differences are. That should point you directly at the problem if
you can narrow down your test case enough.
-- chris
rags - 08 Sep 2004 10:27 GMT
thanx chris
BCEL really gives more information than java.lang.verifier
Here is the code i wrote to verify
JavaClass java_class1 = new ClassParser(argv[i]).parse();
Verifier v;
v=VerifierFactory.getVerifier(java_class1.getClassName());
System.out.println(v.doPass1());
System.out.println(v.doPass2());
System.out.println(v.doPass3a(2));
System.out.println(v.doPass3b(2));