pg->quitting = 0;
pg->bp_count = 0;
pg->quiet = 0;
+ pg->last = NULL;
+ pg->last_params = NULL;
+ pg->last_params_len = 0;
} /* }}} */
static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
#define PHPDBG_NEXT 2
+typedef struct _phpdbg_command_t phpdbg_command_t;
+
ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
HashTable bp_files;
HashTable bp_symbols;
zend_bool has_sym_bp; /* symbol-based breakpoint has been set */
zend_bool quitting; /* quitting flag */
int quiet; /* quiet */
+ phpdbg_command_t *last; /* last command */
+ const char *last_params;/* last expression */
+ size_t last_params_len; /* last expression length */
ZEND_END_MODULE_GLOBALS(phpdbg)
#endif /* PHPDBG_H */
if (!EG(in_execution)) {
printf("Attempting compilation of %s\n", PHPDBG_G(exec));
-
+
if (php_stream_open_for_zend_ex(PHPDBG_G(exec), &fh,
USE_PATH|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC) == SUCCESS) {
PHPDBG_G(ops) = zend_compile_file(
while (command && command->name) {
if (command->name_len == expr_len
- && memcmp(cmd, command->name, expr_len) == 0) {
+ && memcmp(cmd, command->name, expr_len) == 0) {
+ PHPDBG_G(last) = command;
+ PHPDBG_G(last_params) = params;
+ PHPDBG_G(last_params_len) = cmd_len - expr_len;
return command->handler(params, cmd_len - expr_len TSRMLS_CC);
}
++command;
return PHPDBG_NEXT;
}
+ } else if (PHPDBG_G(last)) {
+ PHPDBG_G(last)->handler(
+ PHPDBG_G(last_params), PHPDBG_G(last_params_len) TSRMLS_CC);
}
if (!PHPDBG_G(quitting)) {
printf("phpdbg> ");
}
+
}
return SUCCESS;
/**
* Command representation
*/
-typedef struct _phpdbg_command_t {
+struct _phpdbg_command_t {
const char *name; /* Command name */
size_t name_len; /* Command name length */
const char *tip; /* Menu tip */
size_t tip_len; /* Menu tip length */
phpdbg_command_handler_t handler; /* Command handler */
-} phpdbg_command_t;
+} ;
/**
* Command Executor