[jbossts-issues] [JBoss JIRA] (JBTM-2553) Investigate the test with byteman do not work with the jacoco

Andrew Dinn (JIRA) issues at jboss.org
Tue Dec 1 09:32:00 EST 2015


    [ https://issues.jboss.org/browse/JBTM-2553?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13135668#comment-13135668 ] 

Andrew Dinn commented on JBTM-2553:
-----------------------------------

I looked further into this and found out why the Jacoco code is changing the start offset for 'this' and for the initial parameters in the local variable table. It happens because of the way they insert an entry probe at the start of the method.

The entry probe is inserted immediately before processing the first of what may potentially be several labels which get processed prior to processing bytecode instructions. There is at least one label, the entry label, which is always processed just before the first instruction. If there is a local variable table with N method parameters then the entry label may be preceded by N other labels each of which identifies the start scope of one of the parameters. Injecting the entry probe before processing any of these parameter start labels means that there are 8 bytecodes in the code buffer when they do get processed hence why all the parameters are modified to have start offset 8.

The obvious fix is to process the parameter start labels before injecting the probe e.g. generate the probe when the first real instruction is processed. However, that simple strategy won't work. The injection point needs to  be picked precisely after processing the parameter labels but before processing the entry label. This ordering is critical in the case where the method starts with a while loop. In that case the entry label will be used as the target of the loop's backward branch (goto). Generating the probe after the entry label would mean that it would get re-executed on every loop iteration.

This is not an easy problem to fix. It involves tracking visits to initial labels and matching them up with local var table entries. I'll see if I can find an easy way to do this that I can recommend to the Jacoco team. Until then this is going to remain borked.


> Investigate the test with byteman do not work with the jacoco
> -------------------------------------------------------------
>
>                 Key: JBTM-2553
>                 URL: https://issues.jboss.org/browse/JBTM-2553
>             Project: JBoss Transaction Manager
>          Issue Type: Sub-task
>          Components: Testing
>            Reporter: Amos Feng
>            Assignee: Amos Feng
>             Fix For: 5.next
>
>




--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jbossts-issues mailing list