فهرست منبع

Remove v8::Debug agent stuff

Debug Agent support was removed from V8 with 3.28 line which
is pretty old meanwhile.
Stefan Siegl 10 سال پیش
والد
کامیت
b38c31b521
10فایلهای تغییر یافته به همراه1 افزوده شده و 261 حذف شده
  1. 0 14
      README.md
  2. 0 12
      config.m4
  3. 1 1
      config.w32
  4. 0 4
      php_v8js_macros.h
  5. 0 36
      samples/debug_callback_line_processor.php
  6. 0 22
      samples/debug_line_processor.php
  7. 0 22
      v8js_class.cc
  8. 0 113
      v8js_debug.cc
  9. 0 25
      v8js_debug.h
  10. 0 12
      v8js_v8.cc

+ 0 - 14
README.md

@@ -55,10 +55,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 */
 
     /**
@@ -140,16 +136,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 **/
 
     /**

+ 0 - 12
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.h>]],
-                               [[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 <v8-debug.h>]],
     v8js_class.cc			\
     v8js_commonjs.cc		\
     v8js_convert.cc			\
-    v8js_debug.cc			\
     v8js_exceptions.cc		\
     v8js_methods.cc			\
     v8js_object_export.cc	\

+ 1 - 1
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");

+ 0 - 4
php_v8js_macros.h

@@ -85,10 +85,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<v8::Value> zval_to_v8js(zval *, v8::Isolate * TSRMLS_DC);
 

+ 0 - 36
samples/debug_callback_line_processor.php

@@ -1,36 +0,0 @@
-<?php
-
-class LineProcessor {
-  protected $_processor;
-
-  public function readLineLoop() {
-	$fh = fopen('php://stdin', 'r');
-	$p = $this->_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');
-
-

+ 0 - 22
samples/debug_line_processor.php

@@ -1,22 +0,0 @@
-<?php
-
-$v8 = new V8Js();
-$v8->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).');');
-}
-

+ 0 - 22
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"
@@ -1000,17 +999,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()
 
@@ -1055,10 +1043,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}
 };
 /* }}} */
@@ -1125,12 +1109,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

+ 0 - 113
v8js_debug.cc

@@ -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 <[email protected]>                          |
-  +----------------------------------------------------------------------+
-*/
-
-#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<v8::Context> context =
-		v8::Local<v8::Context>::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 */

+ 0 - 25
v8js_debug.h

@@ -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 <[email protected]>                          |
-  +----------------------------------------------------------------------+
-*/
-
-#ifndef V8JS_DEBUG_H
-#define V8JS_DEBUG_H
-
-#include <v8-debug.h>
-
-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 */
-

+ 0 - 12
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<v8::Value> result = v8_call(c->isolate);