Skip to content

Commit

Permalink
- Fixed problem with breakpoints on internal functions.
Browse files Browse the repository at this point in the history
SVN Rev: 388
  • Loading branch information
derickr committed Nov 5, 2002
1 parent 883683b commit cad7002
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
7 changes: 4 additions & 3 deletions php_xdebug.h
Expand Up @@ -106,6 +106,9 @@ typedef struct xdebug_var {
#define XDEBUG_BREAK 1
#define XDEBUG_STEP 2

#define XDEBUG_INTERNAL 1
#define XDEBUG_EXTERNAL 2

typedef struct xdebug_func {
char *class;
char *function;
Expand All @@ -115,6 +118,7 @@ typedef struct xdebug_func {

typedef struct function_stack_entry {
xdebug_func function;
int user_defined;

char *filename;
int lineno;
Expand All @@ -123,9 +127,6 @@ typedef struct function_stack_entry {
int varc;
xdebug_var vars[20];

int delayed_fname;
int delayed_cname;

unsigned int memory;
double time;

Expand Down
21 changes: 14 additions & 7 deletions xdebug.c
Expand Up @@ -397,7 +397,7 @@ xdebug_func xdebug_build_fname(zend_execute_data *edata, zend_op_array *new_op_a
}


static struct function_stack_entry *add_stack_frame(zend_execute_data *zdata, zend_op_array *op_array TSRMLS_DC)
static struct function_stack_entry *add_stack_frame(zend_execute_data *zdata, zend_op_array *op_array, int type TSRMLS_DC)
{
struct function_stack_entry *tmp;
zend_op *cur_opcode;
Expand All @@ -410,10 +410,9 @@ static struct function_stack_entry *add_stack_frame(zend_execute_data *zdata, ze
tmp->varc = 0;
tmp->refcount = 1;
tmp->level = XG(level);
tmp->delayed_fname = 0;
tmp->delayed_cname = 0;
tmp->arg_done = 0;
tmp->used_vars = NULL;
tmp->user_defined = type;

if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
tmp->filename = xdstrdup(EG(current_execute_data)->op_array->filename);
Expand Down Expand Up @@ -506,11 +505,19 @@ static int handle_breakpoints (struct function_stack_entry *fse)
if (fse->function.type == XFUNC_NORMAL) {
if (xdebug_hash_find(XG(context).function_breakpoints, fse->function.function, strlen(fse->function.function), (void *) &name)) {
/* Yup, breakpoint found, call handler */
XG(context).do_break = 1;
if (fse->user_defined == XDEBUG_EXTERNAL) {
XG(context).do_break = 1;
} else {
if (!XG(context).handler->remote_breakpoint(&(XG(context)), XG(stack), fse->filename, fse->lineno, XDEBUG_BREAK)) {
XG(remote_enabled) = 0;
XG(remote_enable) = 0;
return 0;
}
}
}
}
/* class->function breakpoints */
if (fse->function.type == XFUNC_MEMBER || fse->function.type == XFUNC_STATIC_MEMBER) {
else if (fse->function.type == XFUNC_MEMBER || fse->function.type == XFUNC_STATIC_MEMBER) {
if (fse->function.type == XFUNC_MEMBER) {
tmp_name = xdebug_sprintf ("%s->%s", fse->function.class, fse->function.function);
} else if (fse->function.type == XFUNC_STATIC_MEMBER) {
Expand Down Expand Up @@ -555,7 +562,7 @@ void xdebug_execute(zend_op_array *op_array TSRMLS_DC)
}

XG(level)++;
fse = add_stack_frame(edata, op_array TSRMLS_CC);
fse = add_stack_frame(edata, op_array, XDEBUG_EXTERNAL TSRMLS_CC);

if (XDEBUG_IS_FUNCTION(fse->function.type)) {
add_used_variables(fse, op_array);
Expand All @@ -581,7 +588,7 @@ void xdebug_execute_internal(zend_execute_data *current_execute_data, int return
struct function_stack_entry *fse;

XG(level)++;
fse = add_stack_frame(edata, edata->op_array TSRMLS_CC);
fse = add_stack_frame(edata, edata->op_array, XDEBUG_INTERNAL TSRMLS_CC);

/* Check for breakpoints */
if (XG(remote_enabled)) {
Expand Down

0 comments on commit cad7002

Please sign in to comment.