When an AT ENTRY rule is injected into a method which begins with a while loop the injected code can end up inside the loop. causing them to trigger at each loop iteration. The problem is that the loop label may be visited before the first instruction in the loop and trigger code is only added when an instruction is reached. So, the GOTO which returns to the label will return to a label preceding the trigger code. The trigger code should be injected when the code is visited (i.e. at the call to visitCode ) so it precedes the visit to the while label.
n.b. this will have the unfortunate side effect that the trigger code will be injected before any visitLine instruction causing stack traces to list the line number for the trigger frame as -1.