add win32 configure option for CLI to switch on CRT heap debugging

This commit is contained in:
Wez Furlong 2003-12-22 13:08:04 +00:00
parent 85735c23c6
commit d756e1db23
2 changed files with 18 additions and 0 deletions

View File

@ -2,8 +2,12 @@
// $Id$
ARG_ENABLE('cli', 'Build CLI version of PHP', 'yes');
ARG_ENABLE('crt-debug', 'Extra CRT debugging', 'no');
if (PHP_CLI == "yes") {
SAPI('cli', 'getopt.c php_cli.c', 'php.exe');
if (PHP_CRT_DEBUG == "yes") {
ADD_FLAG("CFLAGS_CLI", "/D PHP_WIN32_DEBUG_HEAP");
}
}

View File

@ -537,6 +537,20 @@ int main(int argc, char *argv[])
void ***tsrm_ls;
#endif
#if defined(PHP_WIN32) && defined(_DEBUG) && defined(PHP_WIN32_DEBUG_HEAP)
{
int tmp_flag;
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
tmp_flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
tmp_flag |= _CRTDBG_DELAY_FREE_MEM_DF;
tmp_flag |= _CRTDBG_LEAK_CHECK_DF;
_CrtSetDbgFlag(tmp_flag);
}
#endif
#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)