[aspectc-user] tracing object creation
Darrell Schiebel
darrell at schiebel.us
Wed Nov 11 02:01:37 CET 2020
Hello,
I would like to use Aspect C++ to track the construction of objects in a
specific namespace (in this example "casa"). I want to have a message
printed each time an object is created from one of the classes in the
namespace.
I have gone through the reference manual but I am still having trouble
understanding how one narrows the methods down to only the constructors.
This is what I've come up with based on an example from the reference
manual:
aspect Trace {
pointcut methods() = "casa::...::;
advice execution(methods()) : before() {
std::cout << "executing " << JoinPoint::signature() << "(";
for (unsigned i = 0; i < JoinPoint::args(); i++)
printvalue(tjp->arg(i), JoinPoint::argtype(i));
cout << ")" << endl;
tjp->proceed();
cout << "after" << endl;
}
};
but I am sure it falls short.
Thanks for any advice.
Darrell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aspectc.org/pipermail/aspectc-user/attachments/20201110/556be79d/attachment.htm>
More information about the aspectc-user
mailing list