diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2016-10-12 20:11:51 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2016-10-12 20:15:49 +0200 |
commit | 5aae01104f88f98f42fd997d360757651f7cc919 (patch) | |
tree | 7952bc03a1e88f1c1208e19c23e8a98ba968e3b7 /sapi/phpdbg/phpdbg_bp.c | |
parent | 74b5662536ccdf9b7b02c495f02a27c64e27fff7 (diff) | |
download | php-git-5aae01104f88f98f42fd997d360757651f7cc919.tar.gz |
Add stdin command and -s command line parameter to phpdbg
This allows reading the initial script file from stdin instead of being forced to put the script into a file in order to run it with phpdbg.
Especially important for programmatic execution of phpdbg.
Also adding tests/include_once.phpt and tests/set_exception_handler.phpt as I seem to have forgotten to git add them sometime long ago...
Diffstat (limited to 'sapi/phpdbg/phpdbg_bp.c')
-rw-r--r-- | sapi/phpdbg/phpdbg_bp.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index 4cb1dae42c..da4c8f71bf 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -230,7 +230,7 @@ PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str) /* {{{ */ } } /* }}} */ -PHPDBG_API void phpdbg_set_breakpoint_file(const char *path, long line_num) /* {{{ */ +PHPDBG_API void phpdbg_set_breakpoint_file(const char *path, size_t path_len, long line_num) /* {{{ */ { php_stream_statbuf ssb; char realpath[MAXPATHLEN]; @@ -240,10 +240,11 @@ PHPDBG_API void phpdbg_set_breakpoint_file(const char *path, long line_num) /* { HashTable *broken, *file_breaks = &PHPDBG_G(bp)[PHPDBG_BREAK_FILE]; phpdbg_breakfile_t new_break; - size_t path_len = 0L; - if (VCWD_REALPATH(path, realpath)) { - path = realpath; + if (!path_len) { + if (VCWD_REALPATH(path, realpath)) { + path = realpath; + } } path_len = strlen(path); @@ -886,21 +887,13 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_file(zend_op_array *op_ { HashTable *breaks; phpdbg_breakbase_t *brake; - size_t path_len; - char realpath[MAXPATHLEN]; - const char *path = ZSTR_VAL(op_array->filename); - - if (VCWD_REALPATH(path, realpath)) { - path = realpath; - } - - path_len = strlen(path); #if 0 - phpdbg_debug("Op at: %.*s %d\n", path_len, path, (*EG(opline_ptr))->lineno); + phpdbg_debug("Op at: %.*s %d\n", ZSTR_LEN(op_array->filename), ZSTR_VAL(op_array->filename), (*EG(opline_ptr))->lineno); #endif - if (!(breaks = zend_hash_str_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], path, path_len))) { + /* NOTE: realpath resolution should have happened at compile time - no reason to do it here again */ + if (!(breaks = zend_hash_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], op_array->filename))) { return NULL; } |