summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_utils.h
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2014-10-25 19:09:19 +0200
committerBob Weinand <bobwei9@hotmail.com>2014-10-25 19:09:19 +0200
commit044f37a832ec1f72c960b02dc7a5b9aca3f43f67 (patch)
treea910460a3bc2312bcf2aa6b81039396c6a46d0e7 /sapi/phpdbg/phpdbg_utils.h
parent87c28ccd28121070ba7225f0ad73b9246dcfdc49 (diff)
parent24babb01946ccb63b993b98b161455475a697d42 (diff)
downloadphp-git-044f37a832ec1f72c960b02dc7a5b9aca3f43f67.tar.gz
Merge remote-tracking branch 'origin/PHP-5.6'
Conflicts: sapi/phpdbg/phpdbg.c sapi/phpdbg/phpdbg_list.c
Diffstat (limited to 'sapi/phpdbg/phpdbg_utils.h')
-rw-r--r--sapi/phpdbg/phpdbg_utils.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/sapi/phpdbg/phpdbg_utils.h b/sapi/phpdbg/phpdbg_utils.h
index 83dc8e9694..feb5470b69 100644
--- a/sapi/phpdbg/phpdbg_utils.h
+++ b/sapi/phpdbg/phpdbg_utils.h
@@ -94,4 +94,29 @@ int phpdbg_is_auto_global(char *name, int len TSRMLS_DC);
PHPDBG_API void phpdbg_xml_var_dump(zval *zv TSRMLS_DC);
+#ifdef ZTS
+#define PHPDBG_OUTPUT_BACKUP_DEFINES() \
+ zend_output_globals *output_globals_ptr; \
+ zend_output_globals original_output_globals; \
+ output_globals_ptr = (zend_output_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(output_globals_id)];
+#else
+#define PHPDBG_OUTPUT_BACKUP_DEFINES() \
+ zend_output_globals *output_globals_ptr; \
+ zend_output_globals original_output_globals; \
+ output_globals_ptr = &output_globals;
+#endif
+
+#define PHPDBG_OUTPUT_BACKUP_SWAP() \
+ original_output_globals = *output_globals_ptr; \
+ memset(output_globals_ptr, 0, sizeof(zend_output_globals)); \
+ php_output_activate(TSRMLS_C);
+
+#define PHPDBG_OUTPUT_BACKUP() \
+ PHPDBG_OUTPUT_BACKUP_DEFINES() \
+ PHPDBG_OUTPUT_BACKUP_SWAP()
+
+#define PHPDBG_OUTPUT_BACKUP_RESTORE() \
+ php_output_deactivate(TSRMLS_C); \
+ *output_globals_ptr = original_output_globals;
+
#endif /* PHPDBG_UTILS_H */