[aspectc-user] pointers
Olaf Spinczyk
Olaf.Spinczyk at informatik.uni-erlangen.de
Thu Jul 14 12:20:36 CEST 2005
Hi,
your advice code is invoked for the call. "within" is only an additional
condition to filter the matched join points. Therefore, the arguments
from the join point API are bound to the arguments from the call. If you
need the arguments of the execution of A::a(), you have to define an
additional execution advice for this join point ("% A::a(...)") and save
the values somewhere to access it later in the advice for the call.
Olaf
Jamal Siadat wrote:
> Hi,
>
> haha, yes they do start at 0 :) but I was trying to capture the second
> argument for ("% A::a(...)") .. but this one gives out the argument for
> the dummy method. I actually tried:
> cout << "in the advice b is "<<*static_cast<float*>(tjp->arg(1)) <<endl;
>
> as shown in trace.ah ( that I previously attached). But it seems that its
> only capturing the dummy parameters :(. I also tried args and it wouldn't
> work.
>
> Thanks
>
>
>
>
>
>>Hi,
>>
>>Jamal Siadat wrote:
>>
>>>And for the Bug:
>>>
>>>I may have acciedently discovered a bug! I have attached a couple of
>>>files
>>>that you may look at. The interesting thing is that if you change the
>>>before advice to an after advice in the aspect you'll get a segmentation
>>>fault when you run it!!!!!
>>>Oh and can anyone tell me how I can get away with using the after advice
>>>and being able to capture the arguments. As you can see I've tried
>>>*tjp->arg<1>() as well but it doesn't seem to work.
>>>
>>>
>>>Thanks in advance,
>>
>>computers start counting at 0 ;-).
>>
>>This modified aspect works for me:
>>
>>---
>>aspect Cache {
>>pointcut calls()= call("float dummy(...) ") && within ("% A::a(...)") ;
>>advice calls() :after (){
>>
>>// cout << "b is "<< *tjp->arg<1>() <<endl;
>>cout << "in the advice b is "<< *tjp->arg<0>() <<endl;
>>}
>>};
>>---
>>
>>I suppose the problem was that you used the unsafe dynamic join point
>>API to access an argument that did not exist. The result is
>>undeterministic behavior.
>>
>>Best regards,
>>
>>Olaf
>>
>
>
>
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user
More information about the aspectc-user
mailing list