Modifications to autogenerated PHP extension Makefiles to make life easier
There are a couple odd defaults in the Makefile that phpize+configure generate for you that you may want to modify while developing and debugging.
By default, extensions compile with -O2. This can lead to tools like valgrind and gdb getting confused about what line number correlates to what section of the binary. It’s located under CFLAGS and can just be deleted when you need a debug build.
You can enable valgrind to run on your extension by adding the -m flag to the run-tests.php invocation in the test: section of the Makefile.
To enable tracking of variables in valgrind (useful whenever you see Conditional jump or move depends on uninitialised value from valgrind), you have to edit the run-tests.php file itself. Search for valgrind -q and add --track-origins=yes to enable variable tracking.











