Commit: f566a6136bbd4fd4f3afeaeccb666bd7806562b8 Author: krakjoe <joe.watk...@live.co.uk> Tue, 12 Nov 2013 06:43:23 +0000 Parents: a29c0e5c96be3d7414e8e541e1d3e7376f12cdb9 Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f566a6136bbd4fd4f3afeaeccb666bd7806562b8 Log: additional list option, class methods Changed paths: M phpdbg_help.c M phpdbg_prompt.c Diff: diff --git a/phpdbg_help.c b/phpdbg_help.c index d942ebe..b887380 100644 --- a/phpdbg_help.c +++ b/phpdbg_help.c @@ -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; } /* }}} */ diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 72d9023..d42e638 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -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)); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php