out:
close(fd);
} /* }}} */
-void phpdbg_list_function(const zend_function *fbc) /* {{{ */
+
- ops->line_end - ops->line_start + 1, ops->line_start);
++void phpdbg_list_function(const zend_function *fbc TSRMLS_DC) /* {{{ */
+ {
+ const zend_op_array *ops;
+
+ if (fbc->type != ZEND_USER_FUNCTION) {
+ return;
+ }
+
+ ops = (zend_op_array*)fbc;
+
+ phpdbg_list_file(ops->filename,
++ ops->line_end - ops->line_start + 1, ops->line_start TSRMLS_CC);
+ } /* }}} */
#ifndef PHPDBG_LIST_H
#define PHPDBG_LIST_H
-#include "zend_compile.h"
-
-void phpdbg_list_file(const char*, long, long);
-void phpdbg_list_function(const zend_function*);
++void phpdbg_list_function(const zend_function* TSRMLS_DC);
+void phpdbg_list_file(const char*, long, long TSRMLS_DC);
#endif /* PHPDBG_LIST_H */
static PHPDBG_COMMAND(list) /* {{{ */
{
- long offset = 0, count = strtol(expr, NULL, 0);
- const char *filename = PHPDBG_G(exec);
-
- if (zend_is_executing(TSRMLS_C)) {
- filename = zend_get_executed_filename(TSRMLS_C);
- offset = zend_get_executed_lineno(TSRMLS_C);
- } else if (!filename) {
- printf("[No file to list]\n");
- return SUCCESS;
- }
+ if (phpdbg_is_numeric(expr)) {
+ long offset = 0, count = strtol(expr, NULL, 0);
+ const char *filename = PHPDBG_G(exec);
+
+ if (zend_is_executing(TSRMLS_C)) {
+ filename = zend_get_executed_filename(TSRMLS_C);
+ offset = zend_get_executed_lineno(TSRMLS_C);
+ } else if (!filename) {
+ printf("[No file to list]\n");
+ return SUCCESS;
+ }
- phpdbg_list_file(filename, count, offset TSRMLS_CC);
- phpdbg_list_file(filename, count, offset);
++ phpdbg_list_file(filename, count, offset TSRMLS_CC);
+ } else {
+ zend_function* fbc;
+
+ if (!EG(function_table)) {
+ printf("[No function table loaded]\n");
+ return SUCCESS;
+ }
+
+ if (zend_hash_find(EG(function_table), expr, strlen(expr)+1,
+ (void**)&fbc) == SUCCESS) {
- phpdbg_list_function(fbc);
++ phpdbg_list_function(fbc TSRMLS_CC);
+ }
+ }
return SUCCESS;
} /* }}} */