[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c - Added xdebug_get_stack_depth() to return the current stack depth level.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Mon, 9 Aug 2004 08:27:59 +0200

Date: Mon Aug 9 08:27:58 CEST 2004
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Added xdebug_get_stack_depth() to return the current stack depth level.
- Cleaned up some whitespace.

Modified files:
           xdebug/php_xdebug.h (version: 1.77)
           xdebug/xdebug.c (version: 1.232)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- xdebug/php_xdebug.h:1.76 Fri Jun 11 10:42:12 2004 GMT
+++ xdebug/php_xdebug.h Mon Aug 09 04:27:58 2004 GMT
@@ -56,6 +56,7 @@
 #endif
 
 /* call stack functions */
+PHP_FUNCTION(xdebug_get_stack_depth);
 PHP_FUNCTION(xdebug_get_function_stack);
 PHP_FUNCTION(xdebug_call_class);
 PHP_FUNCTION(xdebug_call_function);

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -r1.231 -r1.232
--- xdebug/xdebug.c:1.231 Thu Aug 05 09:07:26 2004 GMT
+++ xdebug/xdebug.c Mon Aug 09 04:27:58 2004 GMT
@@ -94,6 +94,7 @@
 int zend_xdebug_initialised = 0;
 
 function_entry xdebug_functions[] = {
+ PHP_FE(xdebug_get_stack_depth, NULL)
         PHP_FE(xdebug_get_function_stack, NULL)
         PHP_FE(xdebug_call_class, NULL)
         PHP_FE(xdebug_call_function, NULL)
@@ -249,9 +250,9 @@
         STD_PHP_INI_BOOLEAN("xdebug.extended_info", "1", PHP_INI_SYSTEM, OnUpdateBool, extended_info, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_ENTRY("xdebug.manual_url", "http://www.php.net", PHP_INI_ALL, OnUpdateString, manual_url, zend_xdebug_globals, xdebug_globals)
 #if ZEND_EXTENSION_API_NO < 90000000
- STD_PHP_INI_ENTRY("xdebug.max_nesting_level", "64", PHP_INI_ALL, OnUpdateInt, max_nesting_level, zend_xdebug_globals, xdebug_globals)
+ STD_PHP_INI_ENTRY("xdebug.max_nesting_level", "100", PHP_INI_ALL, OnUpdateInt, max_nesting_level, zend_xdebug_globals, xdebug_globals)
 #else
- STD_PHP_INI_ENTRY("xdebug.max_nesting_level", "64", PHP_INI_ALL, OnUpdateLong, max_nesting_level, zend_xdebug_globals, xdebug_globals)
+ STD_PHP_INI_ENTRY("xdebug.max_nesting_level", "100", PHP_INI_ALL, OnUpdateLong, max_nesting_level, zend_xdebug_globals, xdebug_globals)
 #endif
         STD_PHP_INI_BOOLEAN("xdebug.show_local_vars", "0", PHP_INI_ALL, OnUpdateBool, show_local_vars, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_BOOLEAN("xdebug.show_mem_delta", "0", PHP_INI_ALL, OnUpdateBool, show_mem_delta, zend_xdebug_globals, xdebug_globals)
@@ -1012,16 +1013,18 @@
 
         fse->symbol_table = EG(active_symbol_table);
 
- /* Because include/require is treated as a stack level, we have to
- add used variables in include/required files to all the stack levels
- above, until we hit a function or the to level stack. This is so
- that the variables show up correctly where they should be. We
- always call add_used_varialbes on the current stack level, otherwise
- vars in include files do not show up in the locals list. */
+ /* Because include/require is treated as a stack level, we have to add used
+ * variables in include/required files to all the stack levels above, until
+ * we hit a function or the to level stack. This is so that the variables
+ * show up correctly where they should be. We always call
+ * add_used_variables on the current stack level, otherwise vars in include
+ * files do not show up in the locals list. */
         for (le = XDEBUG_LLIST_TAIL(XG(stack)); le != NULL; le = XDEBUG_LLIST_PREV(le)) {
                 xfse = XDEBUG_LLIST_VALP(le);
                 add_used_variables(xfse, op_array);
- if (XDEBUG_IS_FUNCTION(xfse->function.type)) break;
+ if (XDEBUG_IS_FUNCTION(xfse->function.type)) {
+ break;
+ }
         }
 
         /* Check for entry breakpoints */
@@ -1552,6 +1555,15 @@
 }
 /* }}} */
 
+/* {{{ proto integet xdebug_get_stack_depth()
+ Returns the stack depth */
+PHP_FUNCTION(xdebug_get_stack_depth)
+{
+ /* We substract one so that the function call to xdebug_get_stack_depth()
+ * is not part of the returned depth. */
+ RETURN_LONG(XG(stack)->size - 1);
+}
+
 /* {{{ proto array xdebug_get_function_stack()
    Returns an array representing the current stack */
 PHP_FUNCTION(xdebug_get_function_stack)
Received on Mon Aug 09 2004 - 08:28:05 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:02 BST