Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] LocalVariableTable

Try this build:

http://www.eclipse.org/downloads/download.php?file=/tools/aspectj/dev/aspectj-1.6.12.20110804.jar

Andy

On 4 August 2011 10:36, Yoav A. <yoav_@xxxxxxxxxxx> wrote:
> I could do without the cflow advice for now.
>
> I suspect the problem is BcelAdvice.getAdviceInstructions. At the end of
> this method we go over this table and fix any variables that start at
> position 0:
>
> // Fix up the local variables: find any that have a startPC of 0 and ensure
> they target the new start of the method
> LocalVariableTable lvt =
> shadow.getEnclosingMethod().getMemberView().getMethod().getLocalVariableTable();
> if (lvt != null) {
>   LocalVariable[] lvTable = lvt.getLocalVariableTable();
>   for (int i = 0; i < lvTable.length; i++) {
>       LocalVariable lv = lvTable[i];
>       if (lv.getStartPC() == 0) {
>           start.addTargeter(new LocalVariableTag(lv.getSignature(),
> lv.getName(), lv.getIndex(), 0));
>       }
>   }
>
>
> perhaps we can skip here the 'this' variable?
>
>
> -----Original Message----- From: Andy Clement
> Sent: Thursday, August 04, 2011 8:00 PM
> To: AspectJ developer discussions
> Subject: Re: [aspectj-dev] LocalVariableTable
>
> could be, raise a bugzilla. not quite sure when I'll get to it
> though... do you want to look into it?
>
> Andy
>
> On 4 August 2011 09:51, Yoav A. <yoav_@xxxxxxxxxxx> wrote:
>>
>> When compiling with the cflow advice, according to the local variable
>> table
>> the this pointer are defined only from position 6.
>> LocalVariableTable:
>> Start  Length  Slot  Name   Signature
>> 6      36      0    this       Laspects/aspectj/LogAllToFile;
>> 6      36      1    thisJoinPoint       Lorg/aspectj/lang/JoinPoint;
>>
>> could it be problem for the debugging I/S?
>>
>>
>> -----Original Message----- From: Andy Clement
>> Sent: Thursday, August 04, 2011 7:26 PM
>> To: AspectJ developer discussions
>> Subject: Re: [aspectj-dev] LocalVariableTable
>>
>> 'this' is available from position 0.  Both the instance (this) and any
>> parameters are typically defined as having full range (from 0 through
>> to the end of the method) - and the 0>8 shows that.
>>
>> The next thing to try would be to write the code by hand in a .java
>> file and see what the difference is.  What I'm saying is after
>> compiling everything (so that your code has a call in to the advice),
>> create a java file like this:
>>
>> package aspects.aspectj;
>>
>> class  LogAllToFile {
>>  public void
>>
>> ajc$before$aspects_aspectj_LogAllToFile$1$8f05cad1(org.aspectj.lang.JoinPoint
>> thisJoinPoint) {
>>  this.log("before", thisJoinPoint);
>>  }
>> // ... the log method goes somewhere here
>> }
>>
>> Compile it to replace the aspect that AspectJ compiled (don't
>> recompile the affected target or it will no longer be advised).
>> If you compile that and it works correctly, then javap it and compare
>> the method generated by the aspect compiler against the method
>> generated by javac.  If it doesn't work then it is something else and
>> not the local variables.
>>
>> Andy
>>
>> On 4 August 2011 09:15, Yoav A. <yoav_@xxxxxxxxxxx> wrote:
>>>
>>> It does.
>>> public void
>>>
>>>
>>> ajc$before$aspects_aspectj_LogAllToFile$1$8f05cad1(org.aspectj.lang.JoinPoint);
>>> Code:
>>>  Stack=3, Locals=2, Args_size=2
>>>  0:    aload_0
>>>  1:    ldc    #62; //String before
>>>  3:    aload_1
>>>  4:    invokevirtual    #64; //Method
>>> log:(Ljava/lang/String;Lorg/aspectj/lang/JoinPoint;)V
>>>  7:    return
>>> LocalVariableTable:
>>>  Start  Length  Slot  Name   Signature
>>>  0      8      0    this       Laspects/aspectj/LogAllToFile;
>>>  0      8      1    thisJoinPoint       Lorg/aspectj/lang/JoinPoint;
>>>
>>> Is it possible that the JDWP expects 'this' to be available at code index
>>> 0?
>>>
>>>
>>> -----Original Message----- From: Andy Clement
>>> Sent: Thursday, August 04, 2011 2:04 AM
>>> To: AspectJ developer discussions
>>> Subject: Re: [aspectj-dev] LocalVariableTable
>>>
>>> on a cursory look it seems ok, but I see you have other aspects in the
>>> system (that are using cflow) that weave into that advice - turn those
>>> off, does it make your before advice debugging work?
>>>
>>> Andy
>>>
>>> On 3 August 2011 14:54, Yoav A. <yoav_@xxxxxxxxxxx> wrote:
>>>>
>>>> including the code:
>>>> Code:
>>>> Stack=4, Locals=6, Args_size=2
>>>> 0:    getstatic    #215; //Field
>>>> ajc$cflowCounter$0:Lorg/aspectj/runtime/internal/CFlowCounter;
>>>> 3:    invokevirtual    #219; //Method
>>>> org/aspectj/runtime/internal/CFlowCounter.inc:()V
>>>> 6:    aload_0
>>>> 7:    ldc    #62; //String before
>>>> 9:    aload_1
>>>> 10:    getstatic    #215; //Field
>>>> ajc$cflowCounter$0:Lorg/aspectj/runtime/internal/CFlowCounter;
>>>> 13:    invokevirtual    #219; //Method
>>>> org/aspectj/runtime/internal/CFlowCounter.inc:()V
>>>> 16:    invokevirtual    #64; //Method
>>>> log:(Ljava/lang/String;Lorg/aspectj/lang/JoinPoint;)V
>>>> 19:    goto    31
>>>> 22:    astore_3
>>>> 23:    getstatic    #215; //Field
>>>> ajc$cflowCounter$0:Lorg/aspectj/runtime/internal/CFlowCounter;
>>>> 26:    invokevirtual    #224; //Method
>>>> org/aspectj/runtime/internal/CFlowCounter.dec:()V
>>>> 29:    aload_3
>>>> 30:    athrow
>>>> 31:    nop
>>>> 32:    getstatic    #215; //Field
>>>> ajc$cflowCounter$0:Lorg/aspectj/runtime/internal/CFlowCounter;
>>>> 35:    invokevirtual    #224; //Method
>>>> org/aspectj/runtime/internal/CFlowCounter.dec:()V
>>>> 38:    nop
>>>> 39:    goto    53
>>>> 42:    astore    5
>>>> 44:    getstatic    #215; //Field
>>>> ajc$cflowCounter$0:Lorg/aspectj/runtime/internal/CFlowCounter;
>>>> 47:    invokevirtual    #224; //Method
>>>> org/aspectj/runtime/internal/CFlowCounter.dec:()V
>>>> 50:    aload    5
>>>> 52:    athrow
>>>> 53:    getstatic    #215; //Field
>>>> ajc$cflowCounter$0:Lorg/aspectj/runtime/internal/CFlowCounter;
>>>> 56:    invokevirtual    #224; //Method
>>>> org/aspectj/runtime/internal/CFlowCounter.dec:()V
>>>> 59:    return
>>>> 60:    return
>>>> Exception table:
>>>> from   to  target type
>>>>  16    19    22   Class java/lang/Throwable
>>>>
>>>>  6    42    42   Class java/lang/Throwable
>>>>
>>>> LocalVariableTable:
>>>> Start  Length  Slot  Name   Signature
>>>> 6      36      0    this       Laspects/aspectj/LogAllToFile;
>>>> 6      36      1    thisJoinPoint       Lorg/aspectj/lang/JoinPoint;
>>>>
>>>>
>>>> -----Original Message----- From: Andy Clement
>>>> Sent: Thursday, August 04, 2011 12:24 AM
>>>> To: AspectJ developer discussions
>>>> Subject: Re: [aspectj-dev] LocalVariableTable
>>>>
>>>> 1.6.5 is over 2 years old, I would upgrade.  I can't recall whether
>>>> something related to this has been fixed in the intervening time.
>>>>
>>>> I don't know what 'JBE' is, I just use javap.  Attach the 'javap
>>>> -verbose -private' output for the advice method and maybe something
>>>> will be obvious.  But I would recommend trying with 1.6.11 first.
>>>>
>>>> cheers,
>>>> Andy
>>>>
>>>> On 3 August 2011 13:51, Yoav A. <yoav_@xxxxxxxxxxx> wrote:
>>>>>
>>>>> It looks ok to me when checking with JBE. Is there any other way to
>>>>> check?
>>>>>
>>>>> This is the code:
>>>>> before() : everything() && scopeBefore() {
>>>>>  log("before", thisJoinPoint);
>>>>> }
>>>>>
>>>>> in the LocalVariableTable I have two entries:
>>>>> this and thisJoinpoint both start at pc 6. I there anything else to
>>>>> check?
>>>>>
>>>>> I am still with AJ 165, was there anything fixed since then in that
>>>>> area?
>>>>>
>>>>>
>>>>> -----Original Message----- From: Andy Clement
>>>>> Sent: Wednesday, August 03, 2011 10:43 PM
>>>>> To: AspectJ developer discussions
>>>>> Subject: Re: [aspectj-dev] LocalVariableTable
>>>>>
>>>>> Could be an issue with the local variable table.  Does it look valid
>>>>> to you? i.e. what is the method that is having trouble, what class is
>>>>> it in, what does the local variable table look like for that method?
>>>>>
>>>>> I remember a bug from a while back where some of the methods generated
>>>>> for around advice had unhelpful local variable table entries but that
>>>>> was addressed.  You haven't mentioned which AspectJ you are using, I
>>>>> assume 1.6.11 or later...
>>>>>
>>>>> If the local variable table looks funky, please raise a bug.
>>>>>
>>>>> Andy
>>>>>
>>>>> 2011/8/3 Yoav A. <yoav_@xxxxxxxxxxx>:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I am trying to write code over JDU that attempts to debug AJ code.
>>>>>> At some point when examining a stack frame inside an advice, I am
>>>>>> trying
>>>>>> to
>>>>>> get a mirror to the ‘this’ object using StackFrame.thisObject(). I get
>>>>>> an
>>>>>> exception:
>>>>>> Exception in thread "active event system driver"
>>>>>> com.sun.jdi.InternalException: Unexpected JDWP Error: 35
>>>>>>  at
>>>>>> com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:47)
>>>>>>  at
>>>>>> com.sun.tools.jdi.StackFrameImpl.thisObject(StackFrameImpl.java:127)
>>>>>>
>>>>>> Searching for this message leads to this old bug:
>>>>>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5005668
>>>>>>
>>>>>> could there be such a problem with ajc?
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>> _______________________________________________
>>>>> 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
>>>> _______________________________________________
>>>> 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
>>> _______________________________________________
>>> 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
>> _______________________________________________
>> 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
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>


Back to the top