- WS changes

This commit is contained in:
Felipe Pena 2013-11-10 16:29:05 -02:00
parent 7752077b63
commit aedf45252f

View File

@ -29,50 +29,49 @@ static const phpdbg_command_t phpdbg_prompt_commands[];
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
static PHPDBG_COMMAND(exec) { /* {{{ */
static PHPDBG_COMMAND(exec) /* {{{ */
{
if (PHPDBG_G(exec)) {
printf(
"Unsetting old execution context: %s\n", PHPDBG_G(exec));
printf("Unsetting old execution context: %s\n", PHPDBG_G(exec));
efree(PHPDBG_G(exec));
PHPDBG_G(exec) = NULL;
}
if (PHPDBG_G(ops)) {
printf(
"Destroying compiled opcodes\n");
printf("Destroying compiled opcodes\n");
destroy_op_array(PHPDBG_G(ops) TSRMLS_CC);
efree(PHPDBG_G(ops));
PHPDBG_G(ops) = NULL;
}
PHPDBG_G(exec) = estrndup(
expr, PHPDBG_G(exec_len)=expr_len);
PHPDBG_G(exec) = estrndup(expr, PHPDBG_G(exec_len) = expr_len);
printf(
"Set execution context: %s\n", PHPDBG_G(exec));
printf("Set execution context: %s\n", PHPDBG_G(exec));
return SUCCESS;
} /* }}} */
static inline int phpdbg_compile(TSRMLS_D) {
static inline int phpdbg_compile(TSRMLS_D) /* {{{ */
{
zend_file_handle fh;
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(
&fh, ZEND_INCLUDE TSRMLS_CC);
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(&fh, ZEND_INCLUDE TSRMLS_CC);
zend_destroy_file_handle(&fh TSRMLS_CC);
printf("Success\n");
return SUCCESS;
} else {
}
printf("Could not open file %s\n", PHPDBG_G(exec));
return FAILURE;
}
}
} /* }}} */
static PHPDBG_COMMAND(compile) { /* {{{ */
static PHPDBG_COMMAND(compile) /* {{{ */
{
if (PHPDBG_G(exec)) {
if (PHPDBG_G(ops)) {
printf("Destroying compiled opcodes\n");
destroy_op_array(PHPDBG_G(ops) TSRMLS_CC);
@ -86,20 +85,24 @@ static PHPDBG_COMMAND(compile) { /* {{{ */
}
} /* }}} */
static PHPDBG_COMMAND(step) { /* {{{ */
static PHPDBG_COMMAND(step) /* {{{ */
{
PHPDBG_G(stepping) = atoi(expr);
return SUCCESS;
} /* }}} */
static PHPDBG_COMMAND(next) { /* {{{ */
static PHPDBG_COMMAND(next) /* {{{ */
{
return PHPDBG_NEXT;
} /* }}} */
static PHPDBG_COMMAND(cont) { /* {{{ */
static PHPDBG_COMMAND(cont) /* {{{ */
{
return SUCCESS;
} /* }}} */
static PHPDBG_COMMAND(run) { /* {{{ */
static PHPDBG_COMMAND(run) /* {{{ */
{
if (PHPDBG_G(ops) || PHPDBG_G(exec)) {
if (!PHPDBG_G(ops)) {
if (phpdbg_compile(TSRMLS_C) == FAILURE) {
@ -127,14 +130,14 @@ static PHPDBG_COMMAND(run) { /* {{{ */
}
} /* }}} */
static PHPDBG_COMMAND(eval) { /* {{{ */
static PHPDBG_COMMAND(eval) /* {{{ */
{
zval retval;
if (expr) {
if (zend_eval_stringl((char*)expr, expr_len-1, &retval, "eval()'d code" TSRMLS_CC) == SUCCESS) {
printf("Success: ");
zend_print_zval_r(
&retval, 0 TSRMLS_CC);
zend_print_zval_r(&retval, 0 TSRMLS_CC);
printf("\n");
zval_dtor(&retval);
}