Skip to content

Commit

Permalink
- Fix handling of paths under Windows
Browse files Browse the repository at this point in the history
#- You always have to replace the : in the filename by | and the \ by /
#  in order to have breakpoints working.

SVN Rev: 655
  • Loading branch information
derickr committed Apr 14, 2003
1 parent 2db29fb commit 628cc73
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
37 changes: 35 additions & 2 deletions xdebug.c
Expand Up @@ -1454,6 +1454,36 @@ static inline zval *get_zval(znode *node, temp_variable *Ts, int *is_var)
return NULL;
}

static char* xdebug_mangle_filename(char *name)
{
#if WIN32|WINNT
char *dup;
unsigned int i;

dup = xdstrdup(name);
for (i = 0; i < strlen(dup); i++) {
switch (dup[i]) {
case ':':
dup[i] = '|';
break;
case '\\':
dup[i] = '/';
break;
}
}
return dup;
#else
return name;
#endif
}

static void xdebug_free_filename(char *name)
{
#if WIN32|WINNT
xdfree(name);
#endif
}


ZEND_DLEXPORT void xdebug_statement_call (zend_op_array *op_array)
{
Expand Down Expand Up @@ -1525,18 +1555,21 @@ ZEND_DLEXPORT void xdebug_statement_call (zend_op_array *op_array)
}

if (XG(context).line_breakpoints) {

char *filename = xdebug_mangle_filename(file);
for (le = XDEBUG_LLIST_HEAD(XG(context).line_breakpoints); le != NULL; le = XDEBUG_LLIST_NEXT(le)) {
brk = XDEBUG_LLIST_VALP(le);

if (lineno == brk->lineno && memcmp(brk->file, file + file_len - brk->file_len, brk->file_len) == 0) {
if (lineno == brk->lineno && memcmp(brk->file, filename + file_len - brk->file_len, brk->file_len) == 0) {
if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), file, lineno, XDEBUG_BREAK)) {
XG(remote_enabled) = 0;
XG(remote_enable) = 0;
return;
break;
}
break;
}
}
xdebug_free_filename(filename);
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions xdebug_handler_gdb.c
Expand Up @@ -610,7 +610,17 @@ char *xdebug_handle_breakpoint(xdebug_con *context, xdebug_arg *args)
} else {
/* Make search key */
if (method->args[0][0] != '/') {
#if WIN32|WINNT
if (strlen(method->args[0]) > 3
&& method->args[0][1] != '|')
{
tmp_name = xdebug_sprintf("/%s", method->args[0]);
} else {
tmp_name = xdebug_sprintf("%s", method->args[0]);
}
#else
tmp_name = xdebug_sprintf("/%s", method->args[0]);
#endif
} else {
tmp_name = xdebug_sprintf("%s", method->args[0]);
}
Expand Down

0 comments on commit 628cc73

Please sign in to comment.