cvs: ZendEngine2 / zend_builtin_functions.c zend_builtin_functions.h zend_default_classes.c
| From: | Marcus Boerger | Date: | Thu, 28 Aug 2003 20:35:54 +0000 |
| Subject: | cvs: ZendEngine2 / zend_builtin_functions.c zend_builtin_functions.h zend_default_classes.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1730@lists.php.net to get a copy of this message | ||
helly Thu Aug 28 16:35:54 2003 EDT
Modified files:
/ZendEngine2 zend_builtin_functions.c zend_builtin_functions.h
zend_default_classes.c
Log:
- Split debug_backtrace() into lowlevel c function and php function wrapper
- Add trace property to default method based on new zend_fetch_debug_backtrace
# Unforunatley the handler for uncaught exception can't show this backtrace
# simply because there is currently no way to do it. If i can think of a
# solution i'll add it. Until them i am open to any ideas/help.
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.207 ZendEngine2/zend_builtin_functions.c:1.208
--- ZendEngine2/zend_builtin_functions.c:1.207 Thu Aug 28 12:41:19 2003
+++ ZendEngine2/zend_builtin_functions.c Thu Aug 28 16:35:53 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.207 2003/08/28 16:41:19 sas Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.208 2003/08/28 20:35:53 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -1537,9 +1537,8 @@
}
/* }}} */
-/* {{{ proto void debug_backtrace(void)
- Prints out a backtrace */
-ZEND_FUNCTION(debug_backtrace)
+
+ZEND_API void zend_fetch_debug_backtrace(zval *return_value TSRMLS_DC)
{
zend_execute_data *ptr;
int lineno;
@@ -1554,10 +1553,6 @@
int arg_stack_consistent = 0;
int frames_on_stack = 0;
- if (ZEND_NUM_ARGS()) {
- ZEND_WRONG_PARAM_COUNT();
- }
-
while (--args >= EG(argument_stack).elements) {
if (*args--) {
break;
@@ -1679,6 +1674,18 @@
}
/* }}} */
+
+/* {{{ proto array debug_backtrace(void)
+ Return backtrace as array */
+ZEND_FUNCTION(debug_backtrace)
+{
+ if (ZEND_NUM_ARGS()) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ zend_fetch_debug_backtrace(return_value TSRMLS_CC);
+}
+/* }}} */
/* {{{ proto bool extension_loaded(string extension_name)
Returns true if the named extension is loaded */
Index: ZendEngine2/zend_builtin_functions.h
diff -u ZendEngine2/zend_builtin_functions.h:1.12 ZendEngine2/zend_builtin_functions.h:1.13
--- ZendEngine2/zend_builtin_functions.h:1.12 Tue Jun 10 16:03:24 2003
+++ ZendEngine2/zend_builtin_functions.h Thu Aug 28 16:35:54 2003
@@ -17,12 +17,13 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.h,v 1.12 2003/06/10 20:03:24 imajes Exp $ */
+/* $Id: zend_builtin_functions.h,v 1.13 2003/08/28 20:35:54 helly Exp $ */
#ifndef ZEND_BUILTIN_FUNCTIONS_H
#define ZEND_BUILTIN_FUNCTIONS_H
int zend_startup_builtin_functions(TSRMLS_D);
+ZEND_API void zend_fetch_debug_backtrace(zval *return_value TSRMLS_DC);
#endif /* ZEND_BUILTIN_FUNCTIONS_H */
Index: ZendEngine2/zend_default_classes.c
diff -u ZendEngine2/zend_default_classes.c:1.16 ZendEngine2/zend_default_classes.c:1.17
--- ZendEngine2/zend_default_classes.c:1.16 Sun Aug 24 13:32:47 2003
+++ ZendEngine2/zend_default_classes.c Thu Aug 28 16:35:54 2003
@@ -17,11 +17,12 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_default_classes.c,v 1.16 2003/08/24 17:32:47 helly Exp $ */
+/* $Id: zend_default_classes.c,v 1.17 2003/08/28 20:35:54 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
#include "zend_reflection_api.h"
+#include "zend_builtin_functions.h"
zend_class_entry *default_exception_ptr;
@@ -29,6 +30,7 @@
{
zval tmp, obj;
zend_object *object;
+ zval *trace;
obj.value.obj = zend_objects_new(&object, class_type TSRMLS_CC);
@@ -36,8 +38,14 @@
zend_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(object->properties, &class_type->default_properties, (copy_ctor_func_t)
zval_add_ref, (void *) &tmp, sizeof(zval *));
+ ALLOC_ZVAL(trace);
+ trace->is_ref = 0;
+ trace->refcount = 0;
+ zend_fetch_debug_backtrace(trace TSRMLS_CC);
+
zend_update_property_string(class_type, &obj, "file", sizeof("file")-1,
zend_get_executed_filename(TSRMLS_C) TSRMLS_CC);
zend_update_property_long(class_type, &obj, "line", sizeof("line")-1,
zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC);
+ zend_update_property(class_type, &obj, "trace", sizeof("trace")-1, trace
TSRMLS_CC);
return obj.value.obj;
}
@@ -128,6 +136,7 @@
zend_declare_property_long(default_exception_ptr, "code", sizeof("code")-1, 0,
ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ptr, "file", sizeof("file")-1,
ZEND_ACC_PROTECTED);
zend_declare_property_null(default_exception_ptr, "line", sizeof("line")-1,
ZEND_ACC_PROTECTED);
+ zend_declare_property_null(default_exception_ptr, "trace", sizeof("trace")-1,
ZEND_ACC_PROTECTED);
}
ZEND_API zend_class_entry *zend_exception_get_default(void)