summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Weinand <bobwei9@hotmail.com>2014-04-13 17:34:27 +0200
committerBob Weinand <bobwei9@hotmail.com>2014-04-13 17:34:27 +0200
commiteae91d9de78a44410c43c18bb42e83e09bd7c5ba (patch)
tree829f6d4e1aed14be526741c7328b16fb8096f3e1
parentce7097fb607a43396aa2785cae07de4d6a196f74 (diff)
downloadphp-git-eae91d9de78a44410c43c18bb42e83e09bd7c5ba.tar.gz
Added help
-rw-r--r--phpdbg_help.c34
-rw-r--r--phpdbg_prompt.c4
-rw-r--r--phpdbg_watch.c14
3 files changed, 45 insertions, 7 deletions
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 72038dc0fd..757dc769b3 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -334,6 +334,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
" **finish** continue up to end of the current execution frame" CR
" **leave** continue up to end of the current execution frame and halt after the calling instruction" CR
" **break** set a breakpoint at the specified target" CR
+" **watch"" set a watchpoint on $variable" CR
" **ev** evaluate some code" CR
" **clear** clear one or all breakpoints" CR
" **clean** clean the execution environment" CR CR
@@ -838,8 +839,8 @@ phpdbg_help_text_t phpdbg_help_text[] = {
" Set the prompt to a bold >" CR CR
" $P S c error red-bold" CR
-" Use red bold for errors" CR
-" " CR
+" Use red bold for errors" CR CR
+
" $P S b 4 off" CR
" Temporarily disable breakpoint 4. This can be subsequently reenabled by a **s b 4 on**." CR
//*********** check oplog syntax
@@ -904,5 +905,34 @@ phpdbg_help_text_t phpdbg_help_text[] = {
"Note **until** will trigger a \"not executing\" error if not executing."
},
+{"watch",
+"Sets watchpoints on variables as long as they are defined" CR
+"Passing no parameter to **watch**, lists all actually active watchpoints" CR
+"Subcommands of **watch**:" CR CR
+
+" **Type** **Alias** **Purpose**" CR
+" **array** **a** Sets watchpoint on array/object to observe if an entry is added or removed" CR
+" **recursive** **r** Watches variable recursively and automatically adds watchpoints if some entry is added to an array/object" CR
+" **delete** **d** Removes watchpoint" CR CR
+
+"Note when **recursive** watchpoints are removed, watchpoints on all the children are removed too"
+
+"**Examples**" CR CR
+" $P watch $array" CR
+" Set watchpoint on $array" CR CR
+
+" $P watch" CR
+" $array" CR CR
+
+" $P w r $obj" CR
+" Set recursive watchpoint on $obj" CR CR
+
+" $P w d $obj" CR
+" Removed watchpoint $obj" CR CR
+
+"Technical note: If using this feature with a debugger, you will get many segmentation faults, each time when a memory page containing a watched address is hit." CR
+" You then you can continue, phpdbg will remove the write protection, so that the program can continue." CR
+" If phpdbg could not handle that segfault, the same segfault is triggered again and this time phpdbg will abort."
+},
{NULL, NULL /* end of table marker */}
}; /* }}} */
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index bc2e667e6b..9a9f45b8fa 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -1006,7 +1006,9 @@ PHPDBG_COMMAND(watch) /* {{{ */
phpdbg_list_watchpoints(TSRMLS_C);
} else switch (param->type) {
case STR_PARAM:
- phpdbg_create_var_watchpoint(param->str, param->len TSRMLS_CC);
+ if (phpdbg_create_var_watchpoint(param->str, param->len TSRMLS_CC) != FAILURE) {
+ phpdbg_notice("Set watchpoint on %.*s", (int)param->len, param->str);
+ }
break;
phpdbg_default_switch_case();
diff --git a/phpdbg_watch.c b/phpdbg_watch.c
index a1bb742cd6..ef5881ff94 100644
--- a/phpdbg_watch.c
+++ b/phpdbg_watch.c
@@ -392,6 +392,8 @@ PHPDBG_WATCH(delete) /* {{{ */
case STR_PARAM:
if (phpdbg_delete_var_watchpoint(param->str, param->len TSRMLS_CC) == FAILURE) {
phpdbg_error("Nothing was deleted, no corresponding watchpoint found");
+ } else {
+ phpdbg_notice("Removed watchpoint %.*s", (int)param->len, param->str);
}
break;
@@ -409,7 +411,9 @@ PHPDBG_WATCH(recursive) /* {{{ */
switch (param->type) {
case STR_PARAM:
- phpdbg_watchpoint_parse_input(param->str, param->len, EG(active_symbol_table), 0, phpdbg_create_recursive_watchpoint TSRMLS_CC);
+ if (phpdbg_watchpoint_parse_input(param->str, param->len, EG(active_symbol_table), 0, phpdbg_create_recursive_watchpoint TSRMLS_CC) != FAILURE) {
+ phpdbg_notice("Set recursive watchpoint on %.*s", (int)param->len, param->str);
+ }
break;
phpdbg_default_switch_case();
@@ -426,7 +430,9 @@ PHPDBG_WATCH(array) /* {{{ */
switch (param->type) {
case STR_PARAM:
- phpdbg_watchpoint_parse_input(param->str, param->len, EG(active_symbol_table), 0, phpdbg_create_array_watchpoint TSRMLS_CC);
+ if (phpdbg_watchpoint_parse_input(param->str, param->len, EG(active_symbol_table), 0, phpdbg_create_array_watchpoint TSRMLS_CC) != FAILURE) {
+ phpdbg_notice("Set array watchpoint on %.*s", (int)param->len, param->str);
+ }
break;
phpdbg_default_switch_case();
@@ -460,7 +466,7 @@ void phpdbg_watch_HashTable_dtor(zval **zv) {
int phpdbg_create_var_watchpoint(char *input, size_t len TSRMLS_DC) {
if (phpdbg_rebuild_symtable(TSRMLS_C) == FAILURE) {
- return SUCCESS;
+ return FAILURE;
}
return phpdbg_watchpoint_parse_input(input, len, EG(active_symbol_table), 0, phpdbg_create_watchpoint TSRMLS_CC);
@@ -468,7 +474,7 @@ int phpdbg_create_var_watchpoint(char *input, size_t len TSRMLS_DC) {
int phpdbg_delete_var_watchpoint(char *input, size_t len TSRMLS_DC) {
if (phpdbg_rebuild_symtable(TSRMLS_C) == FAILURE) {
- return SUCCESS;
+ return FAILURE;
}
return phpdbg_watchpoint_parse_input(input, len, EG(active_symbol_table), 0, phpdbg_delete_watchpoint TSRMLS_CC);