diff --git a/README.md b/README.md index a4c3126..0eadd78 100644 --- a/README.md +++ b/README.md @@ -57,10 +57,6 @@ class V8Js const FLAG_FORCE_ARRAY = 2; const FLAG_PROPAGATE_PHP_EXCEPTIONS = 4; - const DEBUG_AUTO_BREAK_NEVER = 1; - const DEBUG_AUTO_BREAK_ONCE = 2; - const DEBUG_AUTO_BREAK_ALWAYS = 3; - /* Methods */ /** @@ -142,16 +138,6 @@ class V8Js public function clearPendingException() {} - /** - * Starts V8 debug agent for use with Google Chrome Developer Tools (Eclipse Plugin) - * @param string $agent_name - * @param int $port - * @param int $auto_break - * @return bool - */ - public function startDebugAgent($agent_name = "V8Js", $port = 9222, $auto_break = V8Js::DEBUG_AUTO_BREAK_NEVER) - {} - /** Static methods **/ /** diff --git a/config.m4 b/config.m4 index da6c8a1..e87a81e 100644 --- a/config.m4 +++ b/config.m4 @@ -110,17 +110,6 @@ int main () AC_MSG_ERROR([could not determine libv8 version]) fi - AC_CACHE_CHECK(for debuggersupport in v8, ac_cv_v8_debuggersupport, [ -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[v8::Debug::DisableAgent()]])], - [ac_cv_v8_debuggersupport=yes], - [ac_cv_v8_debuggersupport=no]) -]) - - if test "$ac_cv_v8_debuggersupport" = "yes"; then - AC_DEFINE([ENABLE_DEBUGGER_SUPPORT], [1], [Enable debugger support in V8Js]) - fi - AC_LANG_RESTORE LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS @@ -170,7 +159,6 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], v8js_class.cc \ v8js_commonjs.cc \ v8js_convert.cc \ - v8js_debug.cc \ v8js_exceptions.cc \ v8js_methods.cc \ v8js_object_export.cc \ diff --git a/config.w32 b/config.w32 index da32892..df85c80 100644 --- a/config.w32 +++ b/config.w32 @@ -13,7 +13,7 @@ if (PHP_V8JS != "no") { AC_DEFINE("PHP_V8_API_VERSION", "3017015", "", false); AC_DEFINE("PHP_V8_VERSION", "3.17.15", "", true); - EXTENSION("v8js", "v8js_array_access.cc v8js.cc v8js_class.cc v8js_commonjs.cc v8js_convert.cc v8js_debug.cc v8js_exceptions.cc v8js_methods.cc v8js_object_export.cc v8js_timer.cc v8js_v8.cc v8js_v8object_class.cc v8js_variables.cc", "yes"); + EXTENSION("v8js", "v8js_array_access.cc v8js.cc v8js_class.cc v8js_commonjs.cc v8js_convert.cc v8js_exceptions.cc v8js_methods.cc v8js_object_export.cc v8js_timer.cc v8js_v8.cc v8js_v8object_class.cc v8js_variables.cc", "yes"); } else { WARNING("v8js not enabled, headers or libs not found"); diff --git a/php_v8js_macros.h b/php_v8js_macros.h index 2e56d78..984e4ec 100644 --- a/php_v8js_macros.h +++ b/php_v8js_macros.h @@ -74,10 +74,6 @@ extern "C" { #define V8JS_FLAG_FORCE_ARRAY (1<<1) #define V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS (1<<2) -#define V8JS_DEBUG_AUTO_BREAK_NEVER 0 -#define V8JS_DEBUG_AUTO_BREAK_ONCE 1 -#define V8JS_DEBUG_AUTO_BREAK_ALWAYS 2 - /* Convert zval into V8 value */ v8::Handle zval_to_v8js(zval *, v8::Isolate * TSRMLS_DC); diff --git a/samples/debug_callback_line_processor.php b/samples/debug_callback_line_processor.php deleted file mode 100644 index 21afa42..0000000 --- a/samples/debug_callback_line_processor.php +++ /dev/null @@ -1,36 +0,0 @@ -_processor; - - while(($line = fgets($fh))) { - echo $p($line); - } - } - - public function setProcessor($p) { - $this->_processor = $p; - } -} - -$v8 = new V8Js(); -$v8->lp = new LineProcessor(); -$v8->startDebugAgent('LineProcessor', 9222, V8Js::DEBUG_AUTO_BREAK_NEVER); - -$JS = <<< EOT - print("Hello LineProcessor User!\\n"); - - PHP.lp.setProcessor(function (foo) { - return foo.toUpperCase(); - }); - - PHP.lp.readLineLoop(); -EOT; - -$v8->executeString($JS, 'processor.js'); - - diff --git a/samples/debug_line_processor.php b/samples/debug_line_processor.php deleted file mode 100644 index 2e9b1ee..0000000 --- a/samples/debug_line_processor.php +++ /dev/null @@ -1,22 +0,0 @@ -startDebugAgent('LineProcessor', 9222, V8Js::DEBUG_AUTO_BREAK_ALWAYS); - - -$JS = <<< EOT - print("Hello LineProcessor User!\\n"); - - function processLine(foo) { - return foo.toUpperCase(); - }; -EOT; - -$v8->executeString($JS, 'processor.js'); - -$fh = fopen('php://stdin', 'r'); - -while(($line = fgets($fh))) { - echo $v8->executeString('processLine('.json_encode($line).');'); -} - diff --git a/v8js_class.cc b/v8js_class.cc index e344285..29e2d8e 100644 --- a/v8js_class.cc +++ b/v8js_class.cc @@ -28,7 +28,6 @@ extern "C" { #include "php_v8js_macros.h" #include "v8js_v8.h" -#include "v8js_debug.h" #include "v8js_exceptions.h" #include "v8js_v8object_class.h" #include "v8js_timer.h" @@ -959,17 +958,6 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_checkstring, 0, 0, 1) ZEND_ARG_INFO(0, script) ZEND_END_ARG_INFO() -#ifdef ENABLE_DEBUGGER_SUPPORT -ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_destruct, 0, 0, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_v8js_startdebugagent, 0, 0, 0) - ZEND_ARG_INFO(0, agentName) - ZEND_ARG_INFO(0, port) - ZEND_ARG_INFO(0, auto_break) -ZEND_END_ARG_INFO() -#endif /* ENABLE_DEBUGGER_SUPPORT */ - ZEND_BEGIN_ARG_INFO(arginfo_v8js_getpendingexception, 0) ZEND_END_ARG_INFO() @@ -1014,10 +1002,6 @@ static const zend_function_entry v8js_methods[] = { /* {{{ */ PHP_ME(V8Js, getExtensions, arginfo_v8js_getextensions, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(V8Js, setTimeLimit, arginfo_v8js_settimelimit, ZEND_ACC_PUBLIC) PHP_ME(V8Js, setMemoryLimit, arginfo_v8js_setmemorylimit, ZEND_ACC_PUBLIC) -#ifdef ENABLE_DEBUGGER_SUPPORT - PHP_ME(V8Js, __destruct, arginfo_v8js_destruct, ZEND_ACC_PUBLIC|ZEND_ACC_DTOR) - PHP_ME(V8Js, startDebugAgent, arginfo_v8js_startdebugagent, ZEND_ACC_PUBLIC) -#endif {NULL, NULL, NULL} }; /* }}} */ @@ -1086,12 +1070,6 @@ PHP_MINIT_FUNCTION(v8js_class) /* {{{ */ zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_FORCE_ARRAY"), V8JS_FLAG_FORCE_ARRAY TSRMLS_CC); zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_PROPAGATE_PHP_EXCEPTIONS"), V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS TSRMLS_CC); -#ifdef ENABLE_DEBUGGER_SUPPORT - zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("DEBUG_AUTO_BREAK_NEVER"), V8JS_DEBUG_AUTO_BREAK_NEVER TSRMLS_CC); - zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("DEBUG_AUTO_BREAK_ONCE"), V8JS_DEBUG_AUTO_BREAK_ONCE TSRMLS_CC); - zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("DEBUG_AUTO_BREAK_ALWAYS"), V8JS_DEBUG_AUTO_BREAK_ALWAYS TSRMLS_CC); -#endif - le_v8js_script = zend_register_list_destructors_ex(v8js_script_dtor, NULL, PHP_V8JS_SCRIPT_RES_NAME, module_number); #if PHP_V8_API_VERSION >= 4004010 && PHP_V8_API_VERSION < 4004044 diff --git a/v8js_debug.cc b/v8js_debug.cc deleted file mode 100644 index 5721521..0000000 --- a/v8js_debug.cc +++ /dev/null @@ -1,113 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | - +----------------------------------------------------------------------+ - | http://www.opensource.org/licenses/mit-license.php MIT License | - +----------------------------------------------------------------------+ - | Author: Stefan Siegl | - +----------------------------------------------------------------------+ -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -extern "C" { -#include "php.h" -} - -#include "php_v8js_macros.h" -#include "v8js_debug.h" - -#ifdef ENABLE_DEBUGGER_SUPPORT - -v8js_ctx *v8js_debug_context; -int v8js_debug_auto_break_mode; - - -static void DispatchDebugMessages() { /* {{{ */ - if(v8js_debug_context == NULL) { - return; - } - - v8::Isolate* isolate = v8js_debug_context->isolate; - v8::Isolate::Scope isolate_scope(isolate); - - v8::HandleScope handle_scope(isolate); - v8::Local context = - v8::Local::New(isolate, v8js_debug_context->context); - v8::Context::Scope scope(context); - - v8::Debug::ProcessDebugMessages(); -} -/* }}} */ - -/* {{{ proto void V8Js::__destruct() - __destruct for V8Js */ -PHP_METHOD(V8Js, __destruct) -{ - v8js_ctx *c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC); - - if(!c->isolate) { - /* c->isolate is initialized by __construct, which wasn't called if this - * instance was deserialized (which we already caught in __wakeup). */ - return; - } - - V8JS_CTX_PROLOGUE(c); - if(v8js_debug_context == c) { - v8::Debug::DisableAgent(); - v8js_debug_context = NULL; - } -} -/* }}} */ - -/* {{{ proto bool V8Js::startDebugAgent(string agent_name[, int port[, int auto_break]]) - */ -PHP_METHOD(V8Js, startDebugAgent) -{ - char *str = NULL; - int str_len = 0; - long port = 0, auto_break = 0; - - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|sll", &str, &str_len, &port, &auto_break) == FAILURE) { - return; - } - - if(!port) { - port = 9222; - } - - V8JS_BEGIN_CTX(c, getThis()); - - if(v8js_debug_context == c) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Debug agent already started for this V8Js instance"); - RETURN_BOOL(0); - } - - if(v8js_debug_context != NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Debug agent already started for a different V8Js instance"); - RETURN_BOOL(0); - } - - v8js_debug_context = c; - v8js_debug_auto_break_mode = auto_break; - - v8::Debug::SetDebugMessageDispatchHandler(DispatchDebugMessages, true); - v8::Debug::EnableAgent(str_len ? str : "V8Js", port, auto_break > 0); - - if(auto_break) { - /* v8::Debug::EnableAgent doesn't really do what we want it to do, - since it only breaks processing on the default isolate. - Hence just trigger another DebugBreak, no for our main isolate. */ - v8::Debug::DebugBreak(c->isolate); - } - - RETURN_BOOL(1); -} -/* }}} */ - - -#endif /* ENABLE_DEBUGGER_SUPPORT */ diff --git a/v8js_debug.h b/v8js_debug.h deleted file mode 100644 index 378a6d3..0000000 --- a/v8js_debug.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 5 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | - +----------------------------------------------------------------------+ - | http://www.opensource.org/licenses/mit-license.php MIT License | - +----------------------------------------------------------------------+ - | Author: Stefan Siegl | - +----------------------------------------------------------------------+ -*/ - -#ifndef V8JS_DEBUG_H -#define V8JS_DEBUG_H - -#include - -extern PHP_METHOD(V8Js, __destruct); -extern PHP_METHOD(V8Js, startDebugAgent); - -extern v8js_ctx *v8js_debug_context; -extern int v8js_debug_auto_break_mode; - -#endif /* V8JS_DEBUG_H */ - diff --git a/v8js_v8.cc b/v8js_v8.cc index 09f4d39..4b99011 100644 --- a/v8js_v8.cc +++ b/v8js_v8.cc @@ -31,7 +31,6 @@ extern "C" { #include "php_v8js_macros.h" #include "v8js_v8.h" -#include "v8js_debug.h" #include "v8js_timer.h" #include "v8js_exceptions.h" @@ -123,17 +122,6 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, * the time & memory limit. */ v8js_timer_push(time_limit, memory_limit, c TSRMLS_CC); -#ifdef ENABLE_DEBUGGER_SUPPORT - if(c == v8js_debug_context && v8js_debug_auto_break_mode != V8JS_DEBUG_AUTO_BREAK_NEVER) { - v8::Debug::DebugBreak(c->isolate); - - if(v8js_debug_auto_break_mode == V8JS_DEBUG_AUTO_BREAK_ONCE) { - /* If break-once-mode was enabled, reset flag. */ - v8js_debug_auto_break_mode = V8JS_DEBUG_AUTO_BREAK_NEVER; - } - } -#endif /* ENABLE_DEBUGGER_SUPPORT */ - /* Execute script */ c->in_execution++; v8::Local result = v8_call(c->isolate);