[aspectc-user] Get caller of aspect

Olaf Spinczyk os at aspectc.org
Tue Jun 28 10:59:46 CEST 2016


Hi!

You could trace the dynamic call graph with execution advice instead if
call advice. This has the advantage that you get the signature of the
right (dynamically dispatched) target function in case of virtual
function calls or calls via function pointers.

If you actually need context information from the caller side, which is
not the case in your example code, you could also implement a
combination of call and execution advice. For instance, if you push the
function name on a stack (per thread) in the execution advice, the top
of stack can be used in the call advice to obtain the caller's name.

Best regards,

Olaf


On 06/28/2016 02:02, João Bispo wrote:
> Hello,
>
> I would like to build a call graph using AspectC++, and for this, for
> each function call, I need the caller and the callee. I already know
> how to get the callee:
>
>
>   advice call("% %()") : before() {
>
>      std::cout << "Callee: " << JoinPoint::signature() << std::endl;
>
>   }
>
>
> Is there a way to obtain the caller in the same aspect as the callee?
>
> Thanks,
>
> João Bispo
>
>
> _______________________________________________
> aspectc-user mailing list
> aspectc-user at aspectc.org
> http://www.aspectc.org/mailman/listinfo/aspectc-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20160628/986e7c1b/attachment.html>


More information about the aspectc-user mailing list