From e05b4977c5538f10c8cda6aba013116153262ac2 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Mon, 2 Dec 2013 13:19:13 +0000 Subject: added set break [id] --- phpdbg_set.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'phpdbg_set.c') diff --git a/phpdbg_set.c b/phpdbg_set.c index be8624ef97..0c046eeaa1 100644 --- a/phpdbg_set.c +++ b/phpdbg_set.c @@ -21,6 +21,7 @@ #include "phpdbg_cmd.h" #include "phpdbg_set.h" #include "phpdbg_utils.h" +#include "phpdbg_bp.h" ZEND_EXTERN_MODULE_GLOBALS(phpdbg); @@ -51,15 +52,33 @@ PHPDBG_SET(break) /* {{{ */ case STR_PARAM: if (strncasecmp(param->str, PHPDBG_STRL("on")) == 0) { - PHPDBG_G(flags) |= PHPDBG_IS_BP_ENABLED; + phpdbg_enable_breakpoints(TSRMLS_C); } else if (strncasecmp(param->str, PHPDBG_STRL("off")) == 0) { - PHPDBG_G(flags) &= ~PHPDBG_IS_BP_ENABLED; + phpdbg_disable_breakpoints(TSRMLS_C); } break; + + case NUMERIC_PARAM: { + if (input->argc > 2) { + if (phpdbg_argv_is(2, "on")) { + phpdbg_enable_breakpoint(param->num TSRMLS_CC); + } else if (phpdbg_argv_is(2, "off")) { + phpdbg_disable_breakpoint(param->num TSRMLS_CC); + } + } else { + phpdbg_breakbase_t *brake = phpdbg_find_breakbase(param->num TSRMLS_CC); + if (brake) { + phpdbg_writeln( + "%s", brake->disabled ? "off" : "on"); + } else { + phpdbg_error("Failed to find breakpoint #%lx", param->num); + } + } + } break; default: phpdbg_error( - "set break used incorrectly: set break "); + "set break used incorrectly: set break [id] "); } return SUCCESS; @@ -127,12 +146,12 @@ PHPDBG_SET(colors) /* {{{ */ goto done; } } + + default: + phpdbg_error( + "set colors used incorrectly: set colors "); } -usage: - phpdbg_error( - "set colors used incorrectly: set colors "); - done: return SUCCESS; } /* }}} */ -- cgit v1.2.1