com php-src: Fix bug #70138 (difference between gcc and clang): NEWS sapi/phpdbg/phpdbg.c

From: Date: Sun, 26 Jul 2015 19:49:18 +0000
Subject: com php-src: Fix bug #70138 (difference between gcc and clang): NEWS sapi/phpdbg/phpdbg.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88168@lists.php.net to get a copy of this message
Commit: f5bef4058cb0ec8ae817a9b249a2b355fb3286fc Author: Bob Weinand <bobwei9@hotmail.com> Sun, 26 Jul 2015 21:49:11 +0200 Parents: 9e8fec1ef70bc5ad79b9c471cf1c6a0845a25785 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f5bef4058cb0ec8ae817a9b249a2b355fb3286fc Log: Fix bug #70138 (difference between gcc and clang) Bugs: https://bugs.php.net/70138 Changed paths: M NEWS M sapi/phpdbg/phpdbg.c Diff: diff --git a/NEWS b/NEWS index 66441f7..829f1bb 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ PHP NEWS . Fixed bug #70111 (Segfault when a function uses both an explicit return type and an explicit cast). (Laruence) +- phpdbg + . Fixed bug #70138 (Segfault when displaying memory leaks). (Bob) + 23 Jul 2015, PHP 7.0.0 Beta 2 - Core: diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 48e1b6e..d92f1ab 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -1225,13 +1225,20 @@ void phpdbg_signal_handler(int sig, siginfo_t *info, void *context) /* {{{ */ #endif -/* A bit dark magic in order to have meaningful allocator adresses */ -#if ZEND_DEBUG && (__has_builtin(__builtin_frame_address) || ZEND_GCC_VERSION >= 3004) -#define FETCH_PARENT_FILELINE(argsize) \ +/* A bit dark magic in order to have meaningful allocator adresses [ppc(64) may return bogus addresses here] */ +#if ZEND_DEBUG && (__has_builtin(__builtin_frame_address) || ZEND_GCC_VERSION >= 3004) && !defined(__ppc__) && !defined(__ppc64__) +/* with gcc %rbp/%ebp for __builtin_frame_address() and clang returns the frame return address being at %ebp/%rbp + sizeof(void*) */ +# ifdef __clang__ +# define FETCH_PARENT_START() \ + parent -= ZEND_MM_ALIGNED_SIZE(sizeof(void *)); +# else +# define FETCH_PARENT_START() +# endif +# define FETCH_PARENT_FILELINE(argsize) \ char *__zend_filename, *__zend_orig_filename; \ uint __zend_lineno, __zend_orig_lineno; \ void *parent = __builtin_frame_address(1U); \ - parent -= ZEND_MM_ALIGNED_SIZE(sizeof(void *)); /* remove frame pointer adress */ \ + FETCH_PARENT_START() \ parent -= (argsize); /* size of first arguments */ \ parent -= sizeof(char *); /* filename */ \ __zend_filename = *(char **) parent; \ @@ -1245,11 +1252,11 @@ void phpdbg_signal_handler(int sig, siginfo_t *info, void *context) /* {{{ */ parent -= sizeof(uint); /* orig_lineno */ \ __zend_orig_lineno = *(uint *) parent; #elif ZEND_DEBUG -#define FETCH_PARENT_FILELINE(argsize) \ +# define FETCH_PARENT_FILELINE(argsize) \ char *__zend_filename = __FILE__, *__zend_orig_filename = NULL; \ uint __zend_lineno = __LINE__, __zend_orig_lineno = 0; #else -#define FETCH_PARENT_FILELINE(argsize) +# define FETCH_PARENT_FILELINE(argsize) #endif void *phpdbg_malloc_wrapper(size_t size) /* {{{ */

« previous php.cvs (#88168) next »