Permalink
Browse files

This commit was manufactured by cvs2svn to create tag 'XDEBUG_0_6_0'.

SVN Rev: 11
  • Loading branch information...
1 parent 039ec21 commit 2cce04ea7334ffae8177d73504262cd70ac1c287 Unknown Author committed Apr 25, 2002
Showing with 110 additions and 11 deletions.
  1. +6 −2 .cvsignore
  2. +14 −0 Changelog
  3. +3 −0 php_xdebug.h
  4. +21 −0 tests/test2.php
  5. +66 −9 xdebug.c
View
@@ -17,9 +17,13 @@ dynlib.m4
install-sh
ltmain.sh
include
-Makefile.global
+Makefile.*
missing
mkinstalldirs
modules
scan_makefile_in.awk
-
+config.guess
+*swp
+config.log
+libtool
+config.status
View
@@ -0,0 +1,14 @@
+Thu Apr 25 08:27:48 CEST 2002 Derick Rethans <d.rethans@jdimedia.nl>
+/xdebug/php_xdebug.h
+/xdebug/xdebug.c
+/xdebug/tests/test2.php:
+- Implement userland functions
+
+Thu Apr 25 08:27:03 CEST 2002 Derick Rethans <d.rethans@jdimedia.nl>
+/xdebug/.cvsignore:
+- Update cvsignore
+
+Wed Apr 24 16:30:12 CEST 2002 Derick Rethans <d.rethans@jdimedia.nl>
+/xdebug/.cvsignore:
+- Fix cvsignore
+
View
@@ -43,6 +43,9 @@ PHP_MINFO_FUNCTION(xdebug);
PHP_FUNCTION(xdebug_get_function_stack);
+PHP_FUNCTION(xdebug_call_function);
+PHP_FUNCTION(xdebug_call_file);
+PHP_FUNCTION(xdebug_call_line);
typedef struct function_stack_entry {
char *function_name;
View
@@ -0,0 +1,21 @@
+<?php
+ function foo2 ($a, $b, $c)
+ {
+ echo xdebug_call_function(). "\n";
+ echo xdebug_call_line(). "\n";
+ echo xdebug_call_file(). "\n";
+ }
+
+ function foo ($a)
+ {
+ foo2 ($b, $a, array ('blaat', 5, FALSE));
+ }
+
+ function foo3 ($a)
+ {
+ foo ($a + 4);
+ }
+
+ echo foo3 (5);
+
+?>
View
@@ -51,6 +51,9 @@ void xdebug_error_cb(int type, const char *error_filename, const uint error_line
function_entry xdebug_functions[] = {
PHP_FE(xdebug_get_function_stack, NULL)
+ PHP_FE(xdebug_call_function, NULL)
+ PHP_FE(xdebug_call_file, NULL)
+ PHP_FE(xdebug_call_line, NULL)
{NULL, NULL, NULL}
};
@@ -374,17 +377,71 @@ zend_op_array *xdebug_compile_file(zend_file_handle *file_handle, int type TSRML
PHP_FUNCTION(xdebug_get_function_stack)
{
char buffer[1024];
+ srm_llist_element *le;
+ int k;
array_init(return_value);
-#if 0
- i = XG(top);
- if (i) {
- do {
- snprintf (buffer, 1024, "%s:%d: %s", i->e.filename, i->e.lineno, i->e.function_name);
- add_next_index_string(return_value, (char*) &buffer, 1);
- } while (i = i->next);
+ le = SRM_LLIST_HEAD(XG(stack));
+
+ for (k = 0; k < XG(stack)->size - 1; k++, le = SRM_LLIST_NEXT(le)) {
+ int c = 0; /* Comma flag */
+ int j = 0; /* Counter */
+ struct function_stack_entry *i = SRM_LLIST_VALP(le);
+
+ snprintf (buffer, 1024, "%s:%d: %s", i->filename, i->lineno, i->function_name);
+ add_next_index_string(return_value, (char*) &buffer, 1);
}
-#endif
+}
+
+PHP_FUNCTION(xdebug_call_function)
+{
+ srm_llist_element *le;
+ struct function_stack_entry *i;
+
+ le = SRM_LLIST_TAIL(XG(stack));
+ if (le->prev) {
+ le = SRM_LLIST_PREV(le);
+ if (le->prev) {
+ le = SRM_LLIST_PREV(le);
+ }
+ }
+ i = SRM_LLIST_VALP(le);
+
+ RETURN_STRING(i->function_name, 1);
+}
+
+PHP_FUNCTION(xdebug_call_line)
+{
+ srm_llist_element *le;
+ struct function_stack_entry *i;
+
+ le = SRM_LLIST_TAIL(XG(stack));
+ if (le->prev) {
+ le = SRM_LLIST_PREV(le);
+ if (le->prev) {
+ le = SRM_LLIST_PREV(le);
+ }
+ }
+ i = SRM_LLIST_VALP(le);
+
+ RETURN_LONG(i->lineno);
+}
+
+PHP_FUNCTION(xdebug_call_file)
+{
+ srm_llist_element *le;
+ struct function_stack_entry *i;
+
+ le = SRM_LLIST_TAIL(XG(stack));
+ if (le->prev) {
+ le = SRM_LLIST_PREV(le);
+ if (le->prev) {
+ le = SRM_LLIST_PREV(le);
+ }
+ }
+ i = SRM_LLIST_VALP(le);
+
+ RETURN_STRING(i->filename, 1);
}
@@ -618,7 +675,7 @@ ZEND_DLEXPORT void function_end (zend_op_array *op_array)
ZEND_DLEXPORT void statement_call (zend_op_array *op_array)
{
- printf ("call statement, %s line %d\n", op_array->filename, op_array->opcodes[0].lineno);
+// printf ("call statement, %s line %d\n", op_array->filename, op_array->opcodes[0].lineno);
}

0 comments on commit 2cce04e

Please sign in to comment.