[aspectc-user] how to match line with AspectC (ex : loop "for")

Stefan Marr aspectc at stefan-marr.de
Mon Mar 9 11:08:02 CET 2009


an advice directly on a specific language construct is not possible as  
far as I know.

But if I read the language reference correctly, you might give  
"within()" a try. Actually, its only a guess on what you like to  

You cannot capture all similar loops with this, but at least you will  
be able to advice fct() if it is in the lexical body of somefunction()

void somefunction() {
	for(i=0;i<count;i++) { fct(); }

advice call("% fct()") && within("void somefunction()") : around() {
	// this is similar to cflow, but matches hopefully
	// only on calls lexically in the body of somefunction()

Totally unrelated:

Is there a way to match macros?

In the Lua VM there is a handy macro:
#define GET_OPCODE(i)	(cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))

and for profiling it would be great if I could write an advice like  

advice call("% GET_OPCODE(...)") && within("void luaV_execute  
(lua_State*, int)") && args(Instruction)
: before(Instruction i) {

Best regards


On 09 Mar 2009, at 10:06, BACCARI med emir wrote:

> Hello,
> I want to match the execution of loop for like the code bellow in a  
> C implementation :
> for(i=0;i<count;i++)
>       { fct(); }
> but I think that aspectC allow me to match only executions of  
> functions :(
> If it's possible to capture different line in my code with  
> joinpoint, please tell me how can I do it.
> Thanks.
> Best Regards.
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user

Stefan Marr
Programming Technology Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium

More information about the aspectc-user mailing list