summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>1999-07-09 11:10:19 +0000
committerZeev Suraski <zeev@php.net>1999-07-09 11:10:19 +0000
commitcc26d0e60940b7a317768f86a07580b457069b0e (patch)
tree8df0fd09e1b1f0f922c99ef412f1b093eee43339
parent6abe9c34d9be62d62a2841635fd733802f15e83c (diff)
downloadphp-git-cc26d0e60940b7a317768f86a07580b457069b0e.tar.gz
Send a SIGSEGV instead of exiting, to trigger a core dump
-rw-r--r--Zend/zend_alloc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 740b424f95..b6fcbfc6ba 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -116,7 +116,11 @@ ZEND_API void *_emalloc(size_t size)
if (!p) {
fprintf(stderr,"FATAL: emalloc(): Unable to allocate %ld bytes\n", (long) size);
+#if !(WIN32||WINNT) && ZEND_DEBUG
+ kill(getpid(), SIGSEGV);
+#else
exit(1);
+#endif
HANDLE_UNBLOCK_INTERRUPTIONS();
return (void *)p;
}
@@ -222,7 +226,11 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure)
if (!p) {
if (!allow_failure) {
fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size);
+#if !(WIN32||WINNT) && ZEND_DEBUG
+ kill(getpid(), SIGSEGV);
+#else
exit(1);
+#endif
}
ADD_POINTER_TO_LIST(orig);
HANDLE_UNBLOCK_INTERRUPTIONS();