[ 
https://issues.apache.org/jira/browse/GROOVY-7647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Egor Ushakov updated GROOVY-7647:
---------------------------------
    Description: 
Try to debug the code:
{code}
boolean boolVar = false;
if (boolVar) { // set breakpoint here and step over
    print "ok";
} // end of file
{code}
It steps over line with print even though it is not executed.
Seem that compiler does not generate line info for the last block:
 public java.lang.Object run();
    descriptor: ()Ljava/lang/Object;
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=1
         0: invokestatic  #18                 // Method 
$getCallSiteArray:()[Lorg/codehaus/groovy/runtime/callsite/CallSite;
         3: astore_1
         4: iconst_0
         5: istore_2
         6: iload_2
         7: pop
         8: iload_2
         9: ifeq          28
        12: aload_1
        13: ldc           #41                 // int 1
        15: aaload
        16: aload_0
        17: ldc           #43                 // String ok
        19: invokeinterface #47,  3           // InterfaceMethod 
org/codehaus/groovy/runtime/callsite/CallSite.callCurrent:(Lgroovy/lang/GroovyObject;Ljava/lang/Object;)Ljava/lang/Object;
        24: areturn
        25: goto          30
        28: aconst_null
        29: areturn
        30: aconst_null
        31: areturn
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      30     0  this   Lsdfklajsdlkjas/test;
            6      24     2 boolVar   Z
      LineNumberTable:
        line 15: 4
        line 16: 8
        line 17: 12


  was:
Try to debug the code:
boolean boolVar = false;
if (boolVar) { // set breakpoint here and step over
    print "ok";
} // end of file
It steps over line with print even though it is not executed.
Seem that compiler does not generate line info for the last block:
 public java.lang.Object run();
    descriptor: ()Ljava/lang/Object;
    flags: ACC_PUBLIC
    Code:
      stack=3, locals=3, args_size=1
         0: invokestatic  #18                 // Method 
$getCallSiteArray:()[Lorg/codehaus/groovy/runtime/callsite/CallSite;
         3: astore_1
         4: iconst_0
         5: istore_2
         6: iload_2
         7: pop
         8: iload_2
         9: ifeq          28
        12: aload_1
        13: ldc           #41                 // int 1
        15: aaload
        16: aload_0
        17: ldc           #43                 // String ok
        19: invokeinterface #47,  3           // InterfaceMethod 
org/codehaus/groovy/runtime/callsite/CallSite.callCurrent:(Lgroovy/lang/GroovyObject;Ljava/lang/Object;)Ljava/lang/Object;
        24: areturn
        25: goto          30
        28: aconst_null
        29: areturn
        30: aconst_null
        31: areturn
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      30     0  this   Lsdfklajsdlkjas/test;
            6      24     2 boolVar   Z
      LineNumberTable:
        line 15: 4
        line 16: 8
        line 17: 12



> Incorrect line information for debug
> ------------------------------------
>
>                 Key: GROOVY-7647
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7647
>             Project: Groovy
>          Issue Type: Bug
>          Components: class generator, Compiler
>    Affects Versions: 2.4.5
>            Reporter: Egor Ushakov
>            Priority: Critical
>
> Try to debug the code:
> {code}
> boolean boolVar = false;
> if (boolVar) { // set breakpoint here and step over
>     print "ok";
> } // end of file
> {code}
> It steps over line with print even though it is not executed.
> Seem that compiler does not generate line info for the last block:
>  public java.lang.Object run();
>     descriptor: ()Ljava/lang/Object;
>     flags: ACC_PUBLIC
>     Code:
>       stack=3, locals=3, args_size=1
>          0: invokestatic  #18                 // Method 
> $getCallSiteArray:()[Lorg/codehaus/groovy/runtime/callsite/CallSite;
>          3: astore_1
>          4: iconst_0
>          5: istore_2
>          6: iload_2
>          7: pop
>          8: iload_2
>          9: ifeq          28
>         12: aload_1
>         13: ldc           #41                 // int 1
>         15: aaload
>         16: aload_0
>         17: ldc           #43                 // String ok
>         19: invokeinterface #47,  3           // InterfaceMethod 
> org/codehaus/groovy/runtime/callsite/CallSite.callCurrent:(Lgroovy/lang/GroovyObject;Ljava/lang/Object;)Ljava/lang/Object;
>         24: areturn
>         25: goto          30
>         28: aconst_null
>         29: areturn
>         30: aconst_null
>         31: areturn
>       LocalVariableTable:
>         Start  Length  Slot  Name   Signature
>             0      30     0  this   Lsdfklajsdlkjas/test;
>             6      24     2 boolVar   Z
>       LineNumberTable:
>         line 15: 4
>         line 16: 8
>         line 17: 12



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to