Named C++ lambdas for profiling and debugging

1.6k views Asked by At

We use quite a lot of C++11 lambdas in our code, but found that it leads to difficulties with profiling and debugging tools. For instance the MSVC profiler will show lambdas as:

`anonymous namespace'::<lambda0>::operator()(void)const     
`anonymous namespace'::<lambda1>::operator()(double,double)const    
...

This does not really help to identify the lambda at first glance in a stacktrace or profiler summary.

Is there any way to give the lambda a name for debugging purposes (it should be the mangled name of the scope in which it is defined, IMHO)? I am okay with platform specific solutions (#pragma?) and hacks.

Special namespaces could work but it would require jumping to some hoops from our regular namespace.

0

There are 0 answers