Documentation/Debugging
Using valgrind
You can use valgrind to detect memory corruption and leaks within QEMU. valgrind really doesn't function well when using KVM so it's advised to use TCG. Additionally, you will need to use the --smc-check=all
option to instruct valgrind to detect self-modifying which TCG makes extensive use of.