jcarder doesn't like emma

18 views
Skip to first unread message

DrScott

unread,
Sep 29, 2009, 11:06:20 AM9/29/09
to JCarder
Hello,

i try to combine jcarder and emma ( http://emma.sourceforge.net/index.html
). Emma is a code coverage tool. With the output generated by emma i
would be able to ensure that all relevant code has been run under the
control of jcarder...

Emma manipulates the class files for its purpose. Unfortunately,
jcarder doesn't like this changes. All manipulated classes generate an
error:

Failed to transform the class com.abc.XYZ: Invalid end label (must be
visited first)

The error is reported at [jcarder.]ClassTransformer:79

Here's the stackTrace (which is not shown normally...):

java.lang.IllegalArgumentException: Invalid end label (must be visited
first)
at
com.enea.jcarder.org.objectweb.asm.util.CheckMethodAdapter.checkLabel
(Unknown Source)
at
com.enea.jcarder.org.objectweb.asm.util.CheckMethodAdapter.visitLocalVariable
(Unknown Source)
at com.enea.jcarder.org.objectweb.asm.MethodAdapter.visitLocalVariable
(Unknown Source)
at
com.enea.jcarder.agent.instrument.StackAnalyzeMethodVisitor.visitLocalVariable
(StackAnalyzeMethodVisitor.java:190)
at com.enea.jcarder.org.objectweb.asm.ClassReader.accept(Unknown
Source)
at com.enea.jcarder.org.objectweb.asm.ClassReader.accept(Unknown
Source)
at com.enea.jcarder.agent.instrument.ClassTransformer.instrument
(ClassTransformer.java:116)
at com.enea.jcarder.agent.instrument.ClassTransformer.transform
(ClassTransformer.java:79)
at sun.instrument.TransformerManager.transform
(TransformerManager.java:169)
at sun.instrument.InstrumentationImpl.transform
(InstrumentationImpl.java:365)
at java.lang.ClassLoader.defineClass1(Native Method)
...

Is this jcarders or emmas 'fault'?
In case of an error in emma: Could you be so kind to inform the author
of emma directly as i am not really into that bytecode topic.

Kind regards
Henning

Ulrik Svensson

unread,
Sep 29, 2009, 1:04:54 PM9/29/09
to JCarder
Hello Henning,

are you using Emma's "on-the-fly instrumentation mode" or "static
instrumentation mode"? I have no experience of Emma myself but the
documentation and some posts in the forums suggest that the static
instrumentation mode is more reliable.

Do you have a small example of code (with build instructions) that can
be used to reproduce the problem?

Which JVM are you using?

/Ulrik


On Sep 29, 5:06 pm, DrScott <newssc...@gmx.de> wrote:
> Hello,
>
> i try to combine jcarder and emma (http://emma.sourceforge.net/index.html

DrScott

unread,
Sep 30, 2009, 9:04:49 AM9/30/09
to JCarder
Hello Ulrik,

On Sep 29, 7:04 pm, Ulrik Svensson <ulri...@gmail.com> wrote:
> are you using Emma's "on-the-fly instrumentation mode" or "static
> instrumentation mode"?
The static way ;-)
> Do you have a small example of code (with build instructions) that can
> be used to reproduce the problem?
I try to attach an example. I found out, that the problem only occours
if the class file were compiled with flag -g:vars, which is the
default e.g. in eclipse. Without that option: no problem.
Some facts:
jcarder has no problem with the "original" class file, even with -
g:vars set
emma also has no problem in instrumenting _and_ running the
instrumented class file.
But jcarder doesn't like the instrumented class file, if -g:vars has
been used.

Maybe the version of asm is too old?

> Which JVM are you using?
I use build 1.6.0_02-b05

Ulrik Svensson

unread,
Sep 30, 2009, 4:35:08 PM9/30/09
to JCarder
Thank you very much Henning for reporting this issue, the finding
about -g:vars and for the small example!

I made a quick try with ASM 3.2 but got even more errors during the
instrumentation. The ASM API has changed since version 2.2.2 and the
small adaptation I did to JCarder, in order to make it still compile,
were probably not enough and might have caused the new errors.

I don't know yet if Emma generates invalid classes or if the classes
are correct but can't be handled by JCarder/ASM.

I will be busy for a few days but will continue investigating this
issue later if no body else has figured out a solution until then.

/Ulrik
Reply all
Reply to author
Forward
0 new messages