]> granicus.if.org Git - php/commitdiff
additional list option, class methods
authorkrakjoe <joe.watkins@live.co.uk>
Tue, 12 Nov 2013 06:43:23 +0000 (06:43 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Tue, 12 Nov 2013 06:43:23 +0000 (06:43 +0000)
phpdbg_help.c
phpdbg_prompt.c

index d942ebeb611172b09f7b79e6d1c5367ac7736bca..b887380d0722a2d7b50231c24eece812451e6542 100644 (file)
@@ -141,7 +141,9 @@ PHPDBG_HELP(list) /* {{{ */
        printf("\tphpdbg> list 2\n");
        printf("Will print next 2 lines from the current file\n");
        printf("\tphpdbg> list func\n");
-       printf("Will print func source code\n");
+       printf("Will print the source of the global function \"func\"\n");
+       printf("\tphpdbg> list .mine\n");
+       printf("Will print the source of the class method \"mine\"\n");
        printf("Note: before listing functions you must have a populated function table, try compile !!\n");
        return SUCCESS;
 } /* }}} */
index 72d9023912861c408b9a304fa0bbae249ea67210..d42e638b51997e41186a557c953fb822f79a76e8 100644 (file)
@@ -547,22 +547,40 @@ static PHPDBG_COMMAND(list) /* {{{ */
 
                phpdbg_list_file(filename, count, offset TSRMLS_CC);
        } else {
+           HashTable *func_table = EG(function_table);
                zend_function* fbc;
+        const char *func_name = expr;
+        size_t func_name_len = expr_len;
         
-               if (!EG(function_table)) {
+        /* search active scope if begins with period */
+        if (func_name[0] == '.') {
+           if (EG(scope)) {
+               func_name++;
+               func_name_len--;
+               
+               func_table = &EG(scope)->function_table;
+           } else {
+               printf(
+                   "%sNo active class%s\n",
+                   PHPDBG_RED_LINE(TSRMLS_C), PHPDBG_END_LINE(TSRMLS_C));
+               return FAILURE;
+           }
+        } else if (!EG(function_table)) {
                        printf(
                            "%sNo function table loaded%s\n",
                            PHPDBG_RED_LINE(TSRMLS_C), PHPDBG_END_LINE(TSRMLS_C));
                        return SUCCESS;
+               } else {
+                   func_table = EG(function_table);
                }
-
-               if (zend_hash_find(EG(function_table), expr, expr_len,
+        
+               if (zend_hash_find(func_table, func_name, func_name_len,
                        (void**)&fbc) == SUCCESS) {
                        phpdbg_list_function(fbc TSRMLS_CC);
                } else {
                    printf(
                        "%sFunction %s not found%s\n", 
-                       PHPDBG_RED_LINE(TSRMLS_C), expr, PHPDBG_END_LINE(TSRMLS_C));
+                       PHPDBG_RED_LINE(TSRMLS_C), func_name, PHPDBG_END_LINE(TSRMLS_C));
                }
        }