]> granicus.if.org Git - php/commitdiff
improve debugability in TS debug builds
authorAnatol Belski <ab@php.net>
Tue, 17 Feb 2015 18:15:22 +0000 (19:15 +0100)
committerAnatol Belski <ab@php.net>
Tue, 17 Feb 2015 18:15:22 +0000 (19:15 +0100)
gdb seems to be not always able to fetch the correct context for
thread locals. Thus, the "if (TSRMLS_CACHE)" clause causes gdb to
show crashes which aren't recognized neither with helgrind nor
in release builds. This is reproducable by setting breakpoints on
the exact line where PHP has a tsrm_get_ls_cache() call.

TSRM/TSRM.h

index cdb6e87a225d18ff8b7fba501e72a7274bb31c7b..859b3fac0159d23d35cb732a0712aa1d68ebd472 100644 (file)
@@ -170,7 +170,11 @@ TSRM_API void *tsrm_get_ls_cache(void);
 #define TSRMG_STATIC(id, type, element)        (((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
 #define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE
 #define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL
+#if ZEND_DEBUG
+#define TSRMLS_CACHE_UPDATE() TSRMLS_CACHE = tsrm_get_ls_cache()
+#else
 #define TSRMLS_CACHE_UPDATE() if (!TSRMLS_CACHE) TSRMLS_CACHE = tsrm_get_ls_cache()
+#endif
 #define TSRMLS_CACHE _tsrm_ls_cache
 
 /* BC only */