Skip to content

Commit 6e825df

Browse files
authored
Add --enable-phpdbg-debug option on Windows (#14568)
This enables outputting additional debugging messages when running phpdbg for developing and troubleshooting phpdbg itself. Option was already added in Autotools and this adds it also to Windows build system. Because additional info is printed when running tests, the --enable-phpdbg-debug option is excluded when building with --enable-snapshot-build if not provided explicitly.
1 parent e3f1073 commit 6e825df

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

UPGRADING.INTERNALS

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
159159
- The HAVE_OPENSSL symbol has been removed.
160160
- The HAVE_OPENSSL_EXT symbol is now consistently defined to value 1 whether
161161
the openssl extension is available either as shared or built statically.
162+
- Added configure option --enable-phpdbg-debug to build phpdbg in debug mode.
162163

163164
========================
164165
3. Module changes

sapi/phpdbg/config.m4

+5-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ PHP_ARG_ENABLE([phpdbg],
88
PHP_ARG_ENABLE([phpdbg-debug],
99
[for phpdbg debug build],
1010
[AS_HELP_STRING([--enable-phpdbg-debug],
11-
[Build phpdbg in debug mode])],
11+
[Build phpdbg in debug mode to enable additional diagnostic output for
12+
developing and troubleshooting phpdbg itself])],
1213
[no],
1314
[no])
1415

@@ -23,13 +24,10 @@ if test "$PHP_PHPDBG" != "no"; then
2324
AC_HEADER_TIOCGWINSZ
2425
AC_DEFINE(HAVE_PHPDBG, 1, [ ])
2526

26-
if test "$PHP_PHPDBG_DEBUG" != "no"; then
27-
AC_DEFINE(PHPDBG_DEBUG, 1, [ ])
28-
else
29-
AC_DEFINE(PHPDBG_DEBUG, 0, [ ])
30-
fi
31-
3227
PHP_PHPDBG_CFLAGS="-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
28+
AS_VAR_IF([PHP_PHPDBG_DEBUG], [no],,
29+
[AS_VAR_APPEND([PHP_PHPDBG_CFLAGS], [" -DPHPDBG_DEBUG=1"])])
30+
3331
PHP_PHPDBG_FILES="phpdbg.c phpdbg_parser.c phpdbg_lexer.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c phpdbg_cmd.c phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_btree.c phpdbg_sigsafe.c phpdbg_io.c phpdbg_out.c"
3432

3533
AC_MSG_CHECKING([for phpdbg and readline integration])

sapi/phpdbg/config.w32

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
ARG_ENABLE('phpdbg', 'Build phpdbg', 'no');
22
ARG_ENABLE('phpdbgs', 'Build phpdbg shared', 'no');
3+
ARG_ENABLE('phpdbg-debug', 'Build phpdbg in debug mode to enable additional \
4+
diagnostic output for developing and troubleshooting phpdbg itself', 'no');
35

46
PHPDBG_SOURCES='phpdbg.c phpdbg_prompt.c phpdbg_cmd.c phpdbg_info.c phpdbg_help.c phpdbg_break.c ' +
57
'phpdbg_print.c phpdbg_bp.c phpdbg_list.c phpdbg_utils.c ' +
@@ -17,10 +19,18 @@ if (PHP_PHPDBG == "yes") {
1719
ADD_FLAG("LIBS_PHPDBG", "ws2_32.lib user32.lib");
1820
ADD_FLAG("CFLAGS_PHPDBG", "/D YY_NO_UNISTD_H");
1921
ADD_FLAG("LDFLAGS_PHPDBG", "/stack:8388608");
22+
23+
if(PHP_PHPDBG_DEBUG == "yes") {
24+
ADD_FLAG("CFLAGS_PHPDBG", "/D PHPDBG_DEBUG=1");
25+
}
2026
}
2127

2228
if (PHP_PHPDBGS == "yes") {
2329
SAPI('phpdbgs', PHPDBG_SOURCES, PHPDBG_DLL, '/D PHP_PHPDBG_EXPORTS');
2430
ADD_FLAG("LIBS_PHPDBGS", "ws2_32.lib user32.lib");
2531
ADD_FLAG("CFLAGS_PHPDBGS", "/D YY_NO_UNISTD_H");
32+
33+
if(PHP_PHPDBG_DEBUG == "yes") {
34+
ADD_FLAG("CFLAGS_PHPDBGS", "/D PHPDBG_DEBUG=1");
35+
}
2636
}

sapi/phpdbg/phpdbg_out.h

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#ifndef PHPDBG_OUT_H
2020
#define PHPDBG_OUT_H
2121

22+
#ifndef PHPDBG_DEBUG
23+
# define PHPDBG_DEBUG 0
24+
#endif
25+
2226
/**
2327
* Error/notice/formatting helpers
2428
*/

win32/build/confutils.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ can be built that way. \
455455

456456
var snapshot_build_exclusions = new Array(
457457
'debug', 'lzf-better-compression', 'php-build', 'snapshot-template', 'zts',
458-
'ipv6', 'fd-setsize', 'pgi', 'pgo', 'all-shared', 'config-profile', 'sanitizer'
458+
'ipv6', 'fd-setsize', 'pgi', 'pgo', 'all-shared', 'config-profile', 'sanitizer',
459+
'phpdbg-debug'
459460
);
460461
var force;
461462

0 commit comments

Comments
 (0)