static inline void phpdbg_sigint_handler(int signo) /* {{{ */
{
TSRMLS_FETCH();
- PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
+
+ if (EG(in_execution)) {
+ /* we don't want to set signalled while phpdbg is interactive */
+ if (!(PHPDBG_G(flags) & PHPDBG_IS_INTERACTIVE)) {
+ PHPDBG_G(flags) |= PHPDBG_IS_SIGNALED;
+ }
+ } else {
+ /* if we are not executing then just provide advice */
+ phpdbg_writeln(EMPTY);
+ phpdbg_error(
+ "Please leave phpdbg gracefully !");
+ }
} /* }}} */
int main(int argc, char **argv) /* {{{ */
}
}
- PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
- phpdbg_clear_param(
- &PHPDBG_G(lparam) TSRMLS_CC);
- PHPDBG_G(lparam) = param;
+ if (!(PHPDBG_G(flags) & PHPDBG_IS_INITIALIZING)) {
+ PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
+ phpdbg_clear_param(
+ &PHPDBG_G(lparam) TSRMLS_CC);
+ PHPDBG_G(lparam) = param;
+ }
rc = command->handler(¶m, input TSRMLS_CC);
break;
return SUCCESS;
} /* }}} */
+PHPDBG_INFO(literal) /* {{{ */
+{
+ if (EG(in_execution) && EG(active_op_array)) {
+ zend_uint literal =0;
+ phpdbg_notice(
+ "Literal Constants %d", EG(active_op_array)->last_literal-1);
+
+ while (literal < EG(active_op_array)->last_literal) {
+ phpdbg_write("|-------- C%lu -------> [", literal);
+ zend_print_zval(
+ &EG(active_op_array)->literals[literal].constant, 0);
+ phpdbg_write("]");
+ phpdbg_writeln(EMPTY);
+ literal++;
+ }
+ } else {
+ phpdbg_error("Not executing !");
+ }
+
+ return SUCCESS;
+} /* }}} */
+
static inline void phpdbg_print_class_name(zend_class_entry **ce TSRMLS_DC) /* {{{ */
{
phpdbg_write(
PHPDBG_INFO(funcs);
PHPDBG_INFO(error);
PHPDBG_INFO(vars);
+PHPDBG_INFO(literal);
static const phpdbg_command_t phpdbg_info_commands[] = {
- PHPDBG_COMMAND_D_EX(files, "lists included files", 'F', info_files, NULL, 0),
- PHPDBG_COMMAND_D_EX(classes, "lists loaded classes", 'c', info_classes, NULL, 0),
- PHPDBG_COMMAND_D_EX(funcs, "lists loaded classes", 'f', info_funcs, NULL, 0),
- PHPDBG_COMMAND_D_EX(error, "show the last error", 'e', info_error, NULL, 0),
- PHPDBG_COMMAND_D_EX(vars, "show active variables", 'v', info_vars, NULL, 0),
+ PHPDBG_COMMAND_D_EX(files, "lists included files", 'F', info_files, NULL, 0),
+ PHPDBG_COMMAND_D_EX(classes, "lists loaded classes", 'c', info_classes, NULL, 0),
+ PHPDBG_COMMAND_D_EX(funcs, "lists loaded classes", 'f', info_funcs, NULL, 0),
+ PHPDBG_COMMAND_D_EX(error, "show the last error", 'e', info_error, NULL, 0),
+ PHPDBG_COMMAND_D_EX(vars, "show active variables", 'v', info_vars, NULL, 0),
+ PHPDBG_COMMAND_D_EX(literal, "show active literal constants", 'l', info_literal, NULL, 0),
PHPDBG_END_COMMAND
};
{
int ret = SUCCESS;
- phpdbg_input_t *input = phpdbg_read_input(NULL TSRMLS_CC);
+ PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE;
+ phpdbg_input_t *input = phpdbg_read_input(NULL TSRMLS_CC);
+
if (input && input->length > 0L) {
do {
switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, input TSRMLS_CC)) {
out:
phpdbg_destroy_input(&input TSRMLS_CC);
+
+ PHPDBG_G(flags) &= ~PHPDBG_IS_INTERACTIVE;
return ret;
} /* }}} */