使用修改后的 DEBUG_ZEND 级别编译 PHP
我正在调试 PHP 扩展,并在浏览 PHP 源代码时发现了这一点:
#if DEBUG_ZEND>=2
printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, Z_REFCOUNT_PP(zval_ptr), Z_REFCOUNT_PP(zval_ptr) - 1);
#endif
所以我想将 DEBUG_ZEND 设置为 2 进行编译。在 Zend/zend_compile.h
中,我看到:
#define DEBUG_ZEND 0
我编辑了该值改为 2,然后尝试通常的操作:
./configure --enable-debug
make
make
做了一段时间,但随后我看到一堆 Reducing refcount for ...
消息,然后 make
失败:
make: *** [ext/phar/phar.phar] Error 255
如果我将 DEBUG_ZEND
设置回 0,PHP 可以正常编译。我能找到的对 DEBUG_ZEND
的唯一参考是在这个错误报告中:
http://bugs.php.net/bug.php?id=45761
这段代码看起来很相关:
我通过在配置命令的开头添加 CFLAGS="-DDEBUG_ZEND=2" 来重新配置,执行“make clean”,然后“make”...
所以我添加了 CFLAGS="-DDEBUG_ZEND=2" 就在
configure
中的 shebang 之后,并且能够编译。但是,在运行我的脚本时,我没有看到任何有关引用计数的额外输出,因此我并不真正相信它做了任何事情。
将 DEBUG_ZEND
设置为 2 编译 PHP 的正确方法是什么?
I'm debugging a PHP extension and found this while poking through the PHP source code:
#if DEBUG_ZEND>=2
printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, Z_REFCOUNT_PP(zval_ptr), Z_REFCOUNT_PP(zval_ptr) - 1);
#endif
So I want to compile with DEBUG_ZEND set to 2. In Zend/zend_compile.h
, I saw:
#define DEBUG_ZEND 0
I edited that value to be 2 instead, and then tried the usual:
./configure --enable-debug
make
make
does its thing for awhile, but then I see a bunch of Reducing refcount for ...
messages and then make
fails:
make: *** [ext/phar/phar.phar] Error 255
If I set DEBUG_ZEND
back to 0, PHP compiles fine. The only reference I could find to DEBUG_ZEND
was in this bug report:
http://bugs.php.net/bug.php?id=45761
This snippet looked relevant:
I reconfigured by adding CFLAGS="-DDEBUG_ZEND=2" to the start of the configure command, did a 'make clean', then 'make' ...
So I added CFLAGS="-DDEBUG_ZEND=2"
right after the shebang in configure
and was able to compile. However, I ddin't see any extra output about refcounts when running my scripts, so I'm not really convinced it did anything.
What's the proper way of compiling PHP with DEBUG_ZEND
set to 2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在配置脚本之后设置环境变量,则不会影响 ./configure。您想要为配置脚本设置变量。
If you set the environment variable after the configure script it doesn't affect ./configure. You want to set the variable for the configure script.