Mohan, I am also at a loss as to what you are trying to do. - Normally one uses the execution() pointcut with before/after advice and pick out every (useful) method in the program. That way you can build up the flow along with the context e.g. arguments - With the call() pointcut you can use thisJoinPoint to identify the target method and thisEnclosingJoinPointStaticPart to identify the invoker - The call() pointcut can be useful when you don't control the target class and hence the join point matched by execution() is not available for weaving.
Matthew Webster AOSD Project Java Technology Centre, MP146 IBM Hursley Park, Winchester, SO21 2JN, England Telephone: +44 196 2816139 (external) 246139 (internal) Email: Matthew Webster/UK/IBM @ IBMGB, [EMAIL PROTECTED] http://w3.hursley.ibm.com/~websterm/ "Mohan Radhakrishnan" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 17/12/2006 05:40 Please respond to [email protected] To [email protected] cc Subject Re: [aspectj-users] Tracing a method call Hi, I was thinking of tracing the flow of method calls from beginning to end. (beginning) method 1 --> method 1.1 method 1.2 --> method 1.2.1--> method 1.2.1.1(end) Is it possible to bore into the api to trace something like this if we know only that method 1 exists ? Thanks, Mohan On 12/3/06, Alexandru Popescu <[EMAIL PROTECTED]> wrote: On 12/3/06, Mohan Radhakrishnan <[EMAIL PROTECTED] > wrote: > Hi, > Can we trace a method call through the codebase using pointcuts like > this > > pointcut callStaticMethod (): > call (* com.test.MyObject.callStaticMethod (..)); > > before(): callStaticMethod() { > System.out.println( thisJoinPointStaticPart. > getSourceLocation().getWithinType() ); > System.out.println( thisJoinPointStaticPart. > getSignature().getDeclaringTypeName() ); > } > > > Assume that there is a call line like this. method1 -> method2 -> method3 > etc. We don't have annotations declared on these > methods. > > If each method calls only one other method then we can trace the call line ? > Is this possible ? > I am not sure I understand what you intend to do: to track method3 invocation only when this happens in the flow of method2 called from method1? If so, then look for the cflow/cflowbelow pointcuts. ./alex -- .w( the_mindstorm )p. > Thanks, > Mohan > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
