how probe array assign for runtime data

43 views
Skip to first unread message

winter

unread,
Oct 19, 2020, 3:30:11 AM10/19/20
to JaCoCo and EclEmma Users
I debug the CoreTutorial.java step by step

final Runnable targetInstance = (Runnable) targetClass.newInstance();
targetInstance.run();

when these lines were executed, it means our test target was executed, then I noticed the value of probe arrays in variable store in class RuntimeData changed, like [true,true,true,false,true,true], how it works? I didn't find how the RuntimeData value been changed

Marc Hoffmann

unread,
Oct 19, 2020, 3:42:39 AM10/19/20
to jac...@googlegroups.com
Hi,

the target class gets “instrumented”. I.e. additional bytecode instructions are inserted which set the respective boolean flags in the runtime data.

Regards,
-marc

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/1bda1eb6-e73b-4d2f-9b2e-a61063b1f168n%40googlegroups.com.

winter

unread,
Oct 19, 2020, 4:05:49 AM10/19/20
to JaCoCo and EclEmma Users
thank u for reply, which instructions do this? I found jacocoinit method use Logger.log(Level level, String msg, Object params[]) and custom Handler to report the boolean array, but jacocoinit was called at first line in a method, the target class was not executed, so it report the fully false boolean array

Marc Hoffmann

unread,
Oct 19, 2020, 4:13:04 AM10/19/20
to jac...@googlegroups.com
Hi, 

probe insertion is documented here:


Regards,
-marc


winter

unread,
Oct 19, 2020, 4:43:19 AM10/19/20
to JaCoCo and EclEmma Users
thank u, is the document introduced how the boolean flags set in  runtime data ?

Marc Hoffmann

unread,
Oct 19, 2020, 7:30:49 AM10/19/20
to JaCoCo and EclEmma Users
Yes, the inserted probes are described in the same link (section “Probe Implementation”).

Reply all
Reply to author
Forward
0 new messages