summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_utils.h
diff options
context:
space:
mode:
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 */