diff --git a/src/debugger/com.c b/src/debugger/com.c index 8c9d6f87f..ca0906cc2 100644 --- a/src/debugger/com.c +++ b/src/debugger/com.c @@ -52,6 +52,7 @@ #include "com.h" #include "debugger_private.h" +#include "handler_dbgp.h" #include "lib/private.h" ZEND_EXTERN_MODULE_GLOBALS(xdebug) @@ -348,11 +349,7 @@ static void xdebug_init_debugger() xdebug_open_log(); /* Get handler from mode */ - XG_DBG(context).handler = xdebug_handler_get(XINI_DBG(remote_handler)); - if (!XG_DBG(context).handler) { - zend_error(E_WARNING, "The remote debug handler '%s' is not supported", XINI_DBG(remote_handler)); - return; - } + XG_DBG(context).handler = &xdebug_handler_dbgp; if (XINI_DBG(remote_connect_back)) { zval *remote_addr = NULL; diff --git a/src/debugger/debugger.c b/src/debugger/debugger.c index 3e5f4f0b2..23d24f43b 100644 --- a/src/debugger/debugger.c +++ b/src/debugger/debugger.c @@ -475,20 +475,10 @@ void xdebug_debugger_minit(void) void xdebug_debugger_minfo(void) { - xdebug_remote_handler_info *ptr = xdebug_handlers_get(); - php_info_print_table_start(); php_info_print_table_header(2, "Debugger", "enabled"); php_info_print_table_row(2, "IDE Key", XG_DBG(ide_key)); php_info_print_table_end(); - - php_info_print_table_start(); - php_info_print_table_header(1, "Supported protocols"); - while (ptr->name) { - php_info_print_table_row(1, ptr->description); - ptr++; - } - php_info_print_table_end(); } void xdebug_debugger_rinit(void) diff --git a/src/debugger/debugger.h b/src/debugger/debugger.h index 4ea6160db..39f8fd8be 100644 --- a/src/debugger/debugger.h +++ b/src/debugger/debugger.h @@ -46,7 +46,6 @@ typedef struct _xdebug_debugger_settings_t { zend_long remote_port; /* 9000 */ char *remote_host; /* localhost */ long remote_mode; /* XDEBUG_NONE, XDEBUG_JIT, XDEBUG_REQ */ - char *remote_handler; /* php3, gdb, dbgp */ zend_bool remote_autostart; /* Disables the requirement for XDEBUG_SESSION_START */ zend_bool remote_connect_back; /* connect back to the HTTP requestor */ char *remote_log; /* Filename to log protocol communication to */ diff --git a/src/debugger/handler_dbgp.c b/src/debugger/handler_dbgp.c index 6018d2774..4417dbfcb 100644 --- a/src/debugger/handler_dbgp.c +++ b/src/debugger/handler_dbgp.c @@ -58,6 +58,19 @@ ZEND_EXTERN_MODULE_GLOBALS(xdebug) +xdebug_remote_handler xdebug_handler_dbgp = { + xdebug_dbgp_init, + xdebug_dbgp_deinit, + xdebug_dbgp_error, + xdebug_dbgp_break_on_line, + xdebug_dbgp_breakpoint, + xdebug_dbgp_resolve_breakpoints, + xdebug_dbgp_stream_output, + xdebug_dbgp_notification, + xdebug_dbgp_log, + xdebug_dbgp_register_eval_id, +}; + static char *create_eval_key_file(char *filename, int lineno); static char *create_eval_key_id(int id); static void line_breakpoint_resolve_helper(xdebug_con *context, function_stack_entry *fse, xdebug_brk_info *brk_info); diff --git a/src/debugger/handler_dbgp.h b/src/debugger/handler_dbgp.h index 5fc9dddd8..606e0ef6f 100644 --- a/src/debugger/handler_dbgp.h +++ b/src/debugger/handler_dbgp.h @@ -110,17 +110,6 @@ int xdebug_dbgp_notification(xdebug_con *context, const char *file, long lineno, void XDEBUG_ATTRIBUTE_FORMAT(printf, 2, 3) xdebug_dbgp_log(int log_level, const char *fmt, ...); int xdebug_dbgp_register_eval_id(xdebug_con *context, function_stack_entry *fse); -#define xdebug_handler_dbgp { \ - xdebug_dbgp_init, \ - xdebug_dbgp_deinit, \ - xdebug_dbgp_error, \ - xdebug_dbgp_break_on_line, \ - xdebug_dbgp_breakpoint, \ - xdebug_dbgp_resolve_breakpoints, \ - xdebug_dbgp_stream_output, \ - xdebug_dbgp_notification, \ - xdebug_dbgp_log, \ - xdebug_dbgp_register_eval_id, \ -} +extern xdebug_remote_handler xdebug_handler_dbgp; #endif diff --git a/src/debugger/handlers.c b/src/debugger/handlers.c index 1392530f9..f4e3f64ce 100644 --- a/src/debugger/handlers.c +++ b/src/debugger/handlers.c @@ -22,29 +22,6 @@ #include "handler_dbgp.h" #include "lib/mm.h" -xdebug_remote_handler_info handlers[] = { - { "dbgp", "DBGp - Common DeBuGger Protocol", xdebug_handler_dbgp }, - { 0, NULL, { NULL, NULL, NULL, NULL, NULL, NULL, NULL } } -}; - -xdebug_remote_handler* xdebug_handler_get(char* mode) -{ - xdebug_remote_handler_info *ptr = handlers; - - while (ptr->name) { - if (strcmp(mode, ptr->name) == 0) { - return &ptr->handler; - } - ptr++; - } - return NULL; -} - -xdebug_remote_handler_info* xdebug_handlers_get(void) -{ - return handlers; -} - void xdebug_brk_info_dtor(xdebug_brk_info *brk_info) { if (brk_info->classname) { diff --git a/src/debugger/handlers.h b/src/debugger/handlers.h index 72e497268..7c4c0b445 100644 --- a/src/debugger/handlers.h +++ b/src/debugger/handlers.h @@ -151,15 +151,6 @@ struct _xdebug_remote_handler { int (*register_eval_id)(xdebug_con *h, function_stack_entry *fse); }; -struct _xdebug_remote_handler_info { - const char *name; - const char *description; - xdebug_remote_handler handler; -}; - -xdebug_remote_handler* xdebug_handler_get(char* mode); -xdebug_remote_handler_info* xdebug_handlers_get(void); - void xdebug_brk_info_dtor(xdebug_brk_info *brk); void xdebug_llist_brk_dtor(void *dummy, xdebug_brk_info *brk); void xdebug_hash_brk_dtor(xdebug_brk_info *brk); diff --git a/tests/debugger/dbgp-non-existent-handler.phpt b/tests/debugger/dbgp-non-existent-handler.phpt deleted file mode 100644 index 4868ebd4f..000000000 --- a/tests/debugger/dbgp-non-existent-handler.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -DBGp: Using an unknown remote handler ---INI-- -xdebug.remote_handler=foobar -xdebug.remote_enable=1 -xdebug.remote_autostart=1 ---FILE-- - ---EXPECTF-- -%s: The remote debug handler 'foobar' is not supported in %sdbgp-non-existent-handler.php on line %d -Alive! diff --git a/xdebug.c b/xdebug.c index 7f93936b8..a35965895 100644 --- a/xdebug.c +++ b/xdebug.c @@ -330,7 +330,6 @@ PHP_INI_BEGIN() /* Remote debugger settings */ STD_PHP_INI_BOOLEAN("xdebug.remote_enable", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, settings.debugger.remote_enable, zend_xdebug_globals, xdebug_globals) - STD_PHP_INI_ENTRY("xdebug.remote_handler", "dbgp", PHP_INI_ALL, OnUpdateString, settings.debugger.remote_handler, zend_xdebug_globals, xdebug_globals) STD_PHP_INI_ENTRY("xdebug.remote_host", "localhost", PHP_INI_ALL, OnUpdateString, settings.debugger.remote_host, zend_xdebug_globals, xdebug_globals) PHP_INI_ENTRY("xdebug.remote_mode", "req", PHP_INI_ALL, OnUpdateDebugMode) STD_PHP_INI_ENTRY("xdebug.remote_port", "9000", PHP_INI_ALL, OnUpdateLong, settings.debugger.remote_port, zend_xdebug_globals, xdebug_globals)