Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Missing LocalVariableTable info for around advice ?

Thank you Andy. I've started looking into the problem and will raise a bug against the compiler shortly. I let you know if I have any problems.
Regards,
  Per

-----Original Message-----
From: aspectj-dev-bounces@xxxxxxxxxxx
[mailto:aspectj-dev-bounces@xxxxxxxxxxx]On Behalf Of Andrew Clement
Sent: 14. juni 2005 15:14
To: AspectJ developer discussions
Subject: Re: [aspectj-dev] Missing LocalVariableTable info for around
advice ?






Hi Per,

Your diagnosis sounds right.  If you want to investigate further, you
should check out the AspectJ source tree and take a look around the weaver
module in BcelShadow.weaveAroundClosure()  (and maybe
BcelShadow.weaveAroundInline() also has a similar problem).  You will see
the helper method extractMethod() is called to move instructions around - I
can't see any support for ensuring the local variable table makes it across
in the copy.  You should raise a bug against AJ and use it to track your
findings and maybe your fix :)

Andy.
---
Andy Clement
AspectJ Dev
clemas@xxxxxxxxxx



                                                                           
             <per.hustad@telen                                             
             or.com>                                                       
             Sent by:                                                   To 
             aspectj-dev-bounc         <aspectj-dev@xxxxxxxxxxx>           
             es@xxxxxxxxxxx                                             cc 
                                                                           
                                                                   Subject 
             13/06/2005 16:44          [aspectj-dev] Missing               
                                       LocalVariableTable info for around  
                                       advice ?                            
             Please respond to                                             
             AspectJ developer                                             
                discussions                                                
             <aspectj-dev@ecli                                             
                 pse.org>                                                  
                                                                           
                                                                           




Hi!
When debugging java code woven with an "around" advice, it looks like the
LocalVariableTable information gets lost during the weaving. E.g.
considering the following code:

// Foo.java
public class Foo {
    private String myString = "A String";
    public static void main(String[] args) {
        new Foo().foo();
    }
    private void foo() {
      String myLocal = myString;
      System.out.println(myLocal);   // breakpoint here
    }
}
// Test.aj
aspect Test {
  void around() : ( execution(* Foo.foo(..) ) ) {
      System.out.println("before");
      proceed();
      System.out.println("after");
  }
}

We compiled with ajc 1.2.1:
  ajc -g -preserveAllLocals -sourceroots .

When running Foo in the Eclipse 3.1.0 debugger and setting a breakpoint at
the "System.out.println(myLocal);" line, the debugger "Variables" window is
empty. Also, disassembling with javap shows that the LocalVariableTable is
empty in the generated foo_aroundBody1$advice :

  private static final void
foo_aroundBody1$advice(Foo,Test,org.aspectj.runtime.internal.AroundClosure);

  Signature: (LFoo;LTest;Lorg/aspectj/runtime/internal/AroundClosure;)V
  Code:
   0:   getstatic       #34; //Field
java/lang/System.out:Ljava/io/PrintStream;
   3:   ldc     #47; //String before
   5:   invokevirtual   #40; //Method
java/io/PrintStream.println:(Ljava/lang/String;)V
   8:   aload_2
   9:   astore_3
   10:  aload_0
   11:  invokestatic    #65; //Method foo_aroundBody0:(LFoo;)V
   14:  getstatic       #34; //Field
java/lang/System.out:Ljava/io/PrintStream;
   17:  ldc     #55; //String after
   19:  invokevirtual   #40; //Method
java/io/PrintStream.println:(Ljava/lang/String;)V
   22:  return

  LineNumberTable:
   line 103: 0
   line 104: 8
   line 105: 14
   line 106: 22
  LocalVariableTable:
   Start  Length  Slot  Name   Signature
   0      23      0    this       LTest;
   0      23      1    ajc_aroundClosure
Lorg/aspectj/runtime/internal/AroundClosure;



I guess the answer is that the original class LocalVariableTable
information is not copied over to the foo_aroundBody1$advice, and to do
that would involves changes to the org.eclipse.jdt module. I would be happy
to look into this if someone could guide me where to start.

- Per

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-dev


Back to the top