I use aspectC ++ to generate a program control flow.
trace.ah :
#ifndef __trace_ah__ #define __trace_ah__ #include <cstdio> // Control flow tracing example aspect trace { // print the function name before execution starts pointcut virtual methods() = "% ...::%(...)"; advice execution (methods()) : before () { cout << "entering: " << JoinPoint::signature() << endl; // print input parameters** } advice execution(methods()) : after() { // print output parameters** cout << "leaving: " << JoinPoint::signature() << endl; } //prints return values of non void functions advice execution("% ...::%(...)" && !"void ...::%(...)") : after() { JoinPoint::Result res = *tjp->result(); cout << "leaving " << tjp->signature()<< " << returning value--" << res<<endl; } }; }; #endif
Question:
1. How to print the variables themselves, passed as arguments to the functions?
2.How to print input parameter values ββfor each function?
source share