const phpdbg_command_t *subs; /* Sub Commands */
};
+#define PHPDBG_END_COMAND {NULL, 0, NULL, 0, '\0', NULL, NULL}
+
ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
HashTable bp[PHPDBG_BREAK_TABLES]; /* break points */
char *exec; /* file to execute */
PHPDBG_BREAK_EX_D(on, "specify breakpoint by expression", 'o'),
PHPDBG_BREAK_EX_D(lineno, "specify breakpoint by line of currently executing file", 'l'),
PHPDBG_BREAK_EX_D(func, "specify breakpoint by global function name", 'f'),
- {NULL, 0, 0}
+ PHPDBG_END_COMAND
};
#endif /* PHPDBG_BREAK_H */
static const phpdbg_command_t phpdbg_info_commands[] = {
PHPDBG_INFO_EX_D(files, "lists included files", 'f'),
- {NULL, 0, 0}
+ PHPDBG_END_COMAND
};
#endif /* PHPDBG_INFO_H */
void phpdbg_list_file(const char*, long, long, int TSRMLS_DC);
static const phpdbg_command_t phpdbg_list_commands[] = {
- PHPDBG_LIST_EX_D(lines, "lists the specified lines", 'l'),
- PHPDBG_LIST_EX_D(class, "lists the specified class", 'c'),
- PHPDBG_LIST_EX_D(method, "lists the specified method", 'm'),
+ PHPDBG_LIST_EX_D(lines, "lists the specified lines", 'l'),
+ PHPDBG_LIST_EX_D(class, "lists the specified class", 'c'),
+ PHPDBG_LIST_EX_D(method, "lists the specified method", 'm'),
PHPDBG_LIST_EX_D(func, "lists the specified function", 'f'),
- {NULL, 0, 0}
+ PHPDBG_END_COMAND
};
#endif /* PHPDBG_LIST_H */
* Commands
*/
static const phpdbg_command_t phpdbg_print_commands[] = {
- PHPDBG_PRINT_D(exec, "print execution context instructions", 'e'),
- PHPDBG_PRINT_D(opline, "print the current opline information", 'o'),
- PHPDBG_PRINT_D(class, "print out the instructions in the specified class", 'c'),
- PHPDBG_PRINT_D(method, "print out the instructions in the specified method", 'm'),
+ PHPDBG_PRINT_D(exec, "print execution context instructions", 'e'),
+ PHPDBG_PRINT_D(opline, "print the current opline information", 'o'),
+ PHPDBG_PRINT_D(class, "print out the instructions in the specified class", 'c'),
+ PHPDBG_PRINT_D(method, "print out the instructions in the specified method", 'm'),
PHPDBG_PRINT_D(func, "print out the instructions in the specified function", 'f'),
- {0, 0, 0, 0}
+ PHPDBG_END_COMAND
};
#endif /* PHPDBG_PRINT_H */
PHPDBG_COMMAND_EX_D(aliases, "show alias list", 'a'),
PHPDBG_COMMAND_EX_D(oplog, "sets oplog output", 'O'),
PHPDBG_COMMAND_EX_D(quit, "exit phpdbg", 'q'),
- {NULL, 0, 0}
+ PHPDBG_END_COMAND
}; /* }}} */
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
phpdbg_error("Failed to execute %s!", cmd);
}
break;
-
+
case PHPDBG_LEAVE:
case PHPDBG_FINISH:
case PHPDBG_UNTIL:
/* skip possible breakpoints */
goto next;
}
-
+
/* run to next line */
if (last_step == PHPDBG_UNTIL
&& last_file == execute_data->op_array->filename
/* skip possible breakpoints */
goto next;
}
-
+
/* run to finish */
if (last_step == PHPDBG_FINISH) {
if (execute_data->opline < last_op) {
last_op = NULL;
}
}
-
+
/* break for leave */
if (last_step == PHPDBG_LEAVE) {
if (execute_data->opline == last_op) {
/* not while in conditionals */
phpdbg_print_opline(
execute_data, 0 TSRMLS_CC);
-
+
/* conditions cannot be executed by eval()'d code */
if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)
&& (PHPDBG_G(flags) & PHPDBG_HAS_COND_BP)
next:
last_lineno = execute_data->opline->lineno;
last_file = execute_data->op_array->filename;
-
+
switch (last_step) {
case PHPDBG_FINISH:
if (!last_op) {
last_op = &execute_data->op_array->opcodes[execute_data->op_array->last-1];
}
break;
-
+
case PHPDBG_LEAVE:
if (!last_op) {
- last_op = &execute_data->op_array->opcodes[execute_data->op_array->last-2];
+ last_op = &execute_data->op_array->opcodes[execute_data->op_array->last-2];
}
break;
}
<?php
-include 'web-bootstrap.php';
class phpdbg {
public function isGreat($greeting = null) {