]> granicus.if.org Git - php/commitdiff
Merge branch 'master' of https://github.com/krakjoe/phpdbg
authorkrakjoe <joe.watkins@live.co.uk>
Tue, 12 Nov 2013 02:35:07 +0000 (02:35 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Tue, 12 Nov 2013 02:35:07 +0000 (02:35 +0000)
1  2 
phpdbg_list.c
phpdbg_list.h
phpdbg_prompt.c

diff --cc phpdbg_list.c
index f4209e12198ff9f7dbea452ab24bea8461e57aaa,d5e07d49df77fc59285549427d42c1b751464930..3bfa2141626555e0d34f660dedf7e5f42a9be454
@@@ -74,3 -73,17 +74,17 @@@ void phpdbg_list_file(const char *filen
  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);
+ } /* }}} */
diff --cc phpdbg_list.h
index 883f9917f1bb8f49c88b171259ca68bf827be688,95cc06e93a89f2822301f0b5152d7aa89b01af4e..2a2587504afb1f1573ddefd932ffeabe272891f9
@@@ -20,6 -20,9 +20,7 @@@
  #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 */
diff --cc phpdbg_prompt.c
index c30d15589b5d44f084203d900cd4d75d2c950651,f7ec9419b883d853462694dd24ba37b62111f207..11cc9146dc4eff9241773d41e39642c0a8d81a75
@@@ -497,18 -498,32 +498,32 @@@ static PHPDBG_COMMAND(quiet) { /* {{{ *
  
  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;
  } /* }}} */