Skip to content

Commit

Permalink
Merged pull request #526
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Dec 3, 2019
2 parents a330d7b + 3e74cb6 commit 5472584
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 74 deletions.
7 changes: 2 additions & 5 deletions src/debugger/com.c
Expand Up @@ -52,6 +52,7 @@
#include "com.h"

#include "debugger_private.h"
#include "handler_dbgp.h"
#include "lib/private.h"

ZEND_EXTERN_MODULE_GLOBALS(xdebug)
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions src/debugger/debugger.c
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/debugger/debugger.h
Expand Up @@ -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 */
Expand Down
13 changes: 13 additions & 0 deletions src/debugger/handler_dbgp.c
Expand Up @@ -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);
Expand Down
13 changes: 1 addition & 12 deletions src/debugger/handler_dbgp.h
Expand Up @@ -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
23 changes: 0 additions & 23 deletions src/debugger/handlers.c
Expand Up @@ -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) {
Expand Down
9 changes: 0 additions & 9 deletions src/debugger/handlers.h
Expand Up @@ -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);
Expand Down
13 changes: 0 additions & 13 deletions tests/debugger/dbgp-non-existent-handler.phpt

This file was deleted.

1 change: 0 additions & 1 deletion xdebug.c
Expand Up @@ -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)
Expand Down

0 comments on commit 5472584

Please sign in to comment.