boostorg/coroutine — pull request #16 by anttirt (2014-10-06 13:25:22+00:00)
Title: Optionally register stacks with valgrind

Running programs that switch stacks under valgrind causes valgrind to spit warnings like the following:

==5234== Warning: client switching stacks? SP change: 0xffefffb90 --> 0x5c4b158
==5234== to suppress, use: --max-stackframe=68605921848 or greater

The `VALGRIND_STACK_[DE]REGISTER` macros tell valgrind to treat the selected memory regions as stack space which suppresses those errors. The macros result in a magic instruction sequence that valgrind recognizes and they don't cause any link dependency.

One concern is the `` header because to build with `valgrind=on` it has to be externally available. Valgrind's headers have a permissive license so they could in theory be distributed along with boost but I'm not sure about the details of including code from other projects in boost.

Also, I'm not sure how to write tests for this since it's a library project. If there's a mechanism for checking executable output then it should be easy enough to write a trivial program that switches stacks once and checks the valgrind output for the above warning.