instructs phpdbg to insert a breakpoint at the next opcode */
static PHP_FUNCTION(phpdbg_break_next)
{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
- if (zend_parse_parameters_none() != SUCCESS) {
++ if (zend_parse_parameters_none() == FAILURE && EG(current_execute_data)) {
+ return;
- } else if (EG(current_execute_data) && EG(active_op_array)) {
- zend_ulong opline_num = (EG(current_execute_data)->opline -
- EG(active_op_array)->opcodes);
-
- phpdbg_set_breakpoint_opline_ex(
- &EG(active_op_array)->opcodes[opline_num+1] TSRMLS_CC);
+ }
+
+ phpdbg_set_breakpoint_opline_ex((phpdbg_opline_ptr_t) EG(current_execute_data)->opline + 1 TSRMLS_CC);
} /* }}} */
/* {{{ proto void phpdbg_break_file(string file, integer line) */
static PHP_FUNCTION(phpdbg_break_file)
{
- char *file = NULL;
- int flen = 0;
- long line;
+ char *file = NULL;
- size_t flen = 0;
- long line;
++ size_t flen = 0;
++ long line;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &file, &flen, &line) == FAILURE) {
- return;
- }
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &file, &flen, &line) == FAILURE) {
+ return;
+ }
- phpdbg_set_breakpoint_file(file, line TSRMLS_CC);
+ phpdbg_set_breakpoint_file(file, line TSRMLS_CC);
} /* }}} */
/* {{{ proto void phpdbg_break_method(string class, string method) */
static PHP_FUNCTION(phpdbg_break_method)
{
-- char *class = NULL,
-- *method = NULL;
- size_t clen = 0,
- mlen = 0;
- int clen = 0,
- mlen = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &class, &clen, &method, &mlen) == FAILURE) {
- return;
- }
++ char *class = NULL, *method = NULL;
++ size_t clen = 0, mlen = 0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &class, &clen, &method, &mlen) == FAILURE) {
+ return;
+ }
- phpdbg_set_breakpoint_method(class, method TSRMLS_CC);
+ phpdbg_set_breakpoint_method(class, method TSRMLS_CC);
} /* }}} */
/* {{{ proto void phpdbg_break_function(string function) */
case PHPDBG_NEXT:
return;
}
- } while (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING));
+ } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING));
-
+ }
-
}
-- } else fprintf(stdout, "%s\n", message);
++ } else {
++ fprintf(stdout, "%s\n", message);
++ }
}
/* }}} */
__try {
#endif
zend_mm_heap *mm_heap;
+ void* (*_malloc)(size_t);
+ void (*_free)(void*);
+ void* (*_realloc)(void*, size_t);
- #ifndef _WIN32
- /* setup remote server if necessary */
- if (!cleaning && listen > 0) {
- server = phpdbg_open_socket(address, listen TSRMLS_CC);
- if (-1 > server || phpdbg_remote_init(address, listen, server, &socket, &stream TSRMLS_CC) == FAILURE) {
- exit(0);
+ /* set flags from command line */
+ PHPDBG_G(flags) = flags;
+
+ if (settings) {
+ #ifdef ZTS
+ *((zend_phpdbg_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(phpdbg_globals_id)]) = *settings;
+ #else
+ phpdbg_globals = *settings;
+ #endif
}
- sigaction(SIGIO, &sigio_struct, NULL);
+ /* setup remote server if necessary */
+ if (!cleaning && listen > 0) {
+ server = phpdbg_open_socket(address, listen TSRMLS_CC);
+ if (-1 > server || phpdbg_remote_init(address, listen, server, &socket, &stream TSRMLS_CC) == FAILURE) {
+ exit(0);
+ }
- /* set remote flag to stop service shutting down upon quit */
- remote = 1;
- }
+ #ifndef _WIN32
+ sigaction(SIGIO, &sigio_struct, NULL);
#endif
+ /* set remote flag to stop service shutting down upon quit */
+ remote = 1;
+ }
+
mm_heap = phpdbg_mm_get_heap();
+ zend_mm_get_custom_handlers(mm_heap, &_malloc, &_free, &_realloc);
- if (mm_heap->use_zend_alloc) {
- mm_heap->_malloc = phpdbg_malloc_wrapper;
- mm_heap->_realloc = phpdbg_realloc_wrapper;
- mm_heap->_free = phpdbg_free_wrapper;
- mm_heap->use_zend_alloc = 0;
+ if (!_malloc) {
+ _malloc = phpdbg_malloc_wrapper;
+ }
+ if (!_realloc) {
+ _realloc = phpdbg_realloc_wrapper;
+ }
+ if (!_free) {
+ _free = phpdbg_free_wrapper;
}
zend_activate(TSRMLS_C);
PG(modules_activated) = 0;
- /* set flags from command line */
- PHPDBG_G(flags) = flags;
-
+#ifndef _WIN32
/* setup io here */
if (remote) {
PHPDBG_G(flags) |= PHPDBG_IS_REMOTE;
/* if -r is on the command line more than once just quit */
goto phpdbg_out;
}
+ phpdbg_startup_run = 0;
}
+/* #ifndef for making compiler shutting up */
+#ifndef _WIN32
phpdbg_interact:
+#endif
/* phpdbg main() */
do {
zend_try {
}
}
}
+#endif
} zend_end_try();
- } while(!cleaning && !(PHPDBG_G(flags) & PHPDBG_IS_QUITTING));
-
+ } while (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING));
+
+
+ if (PHPDBG_G(exec) && (PHPDBG_G(flags) & PHPDBG_IS_CLEANING)) {
+ exec = strdup(PHPDBG_G(exec)); /* preserve exec, don't reparse that from cmd */
+ }
+
/* this must be forced */
CG(unclean_shutdown) = 0;
} __except(phpdbg_exception_handler_win32(xp = GetExceptionInformation())) {
phpdbg_error("segfault", "", "Access violation (Segementation fault) encountered\ntrying to abort cleanly...");
}
+phpdbg_out:
#endif
+ if (cleaning <= 0) {
+ PHPDBG_G(flags) &= ~PHPDBG_IS_CLEANING;
+ cleaning = -1;
+ }
+
{
int i;
/* free argv */
{
php_stream_statbuf ssb;
char realpath[MAXPATHLEN];
+ const char *original_path = path;
+ zend_bool pending;
- if (php_stream_stat_path(path, &ssb) != FAILURE) {
- if (ssb.sb.st_mode & (S_IFREG|S_IFLNK)) {
- HashTable *broken;
- phpdbg_breakfile_t new_break;
- size_t path_len = 0L;
+ HashTable *broken, *file_breaks = &PHPDBG_G(bp)[PHPDBG_BREAK_FILE];
+ phpdbg_breakfile_t new_break;
+ size_t path_len = 0L;
- if (VCWD_REALPATH(path, realpath)) {
- path = realpath;
+ if (VCWD_REALPATH(path, realpath)) {
+ path = realpath;
+ }
+ path_len = strlen(path);
+
- if (!zend_hash_exists(&PHPDBG_G(file_sources), path, path_len)) {
++ if (!zend_hash_str_exists(&PHPDBG_G(file_sources), path, path_len)) {
+ if (php_stream_stat_path(path, &ssb) == FAILURE) {
+ if (original_path[0] == '/') {
+ phpdbg_error("breakpoint", "type=\"nofile\" add=\"fail\" file=\"%s\"", "Cannot stat %s, it does not exist", original_path);
+ return;
}
+
+ file_breaks = &PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING];
+ path = original_path;
path_len = strlen(path);
+ pending = 1;
+ } else if (!(ssb.sb.st_mode & (S_IFREG|S_IFLNK))) {
+ phpdbg_error("breakpoint", "type=\"notregular\" add=\"fail\" file=\"%s\"", "Cannot set breakpoint in %s, it is not a regular file", path);
+ return;
+ }
+ }
- if (!(broken = zend_hash_str_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], path, path_len))) {
- HashTable breaks;
- if (zend_hash_find(file_breaks, path, path_len, (void **) &broken) == FAILURE) {
++ if (!(broken = zend_hash_str_find_ptr(file_breaks, path, path_len))) {
+ HashTable breaks;
+ zend_hash_init(&breaks, 8, NULL, phpdbg_file_breaks_dtor, 0);
- zend_hash_init(&breaks, 8, NULL, phpdbg_file_breaks_dtor, 0);
- zend_hash_add(file_breaks, path, path_len, &breaks, sizeof(HashTable), (void **) &broken);
++ broken = zend_hash_str_add_mem(file_breaks, path, path_len, &breaks, sizeof(HashTable));
+ }
- broken = zend_hash_str_update_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], path, path_len, &breaks, sizeof(HashTable));
- }
+ if (!zend_hash_index_exists(broken, line_num)) {
+ PHPDBG_BREAK_INIT(new_break, PHPDBG_BREAK_FILE);
+ new_break.filename = estrndup(path, path_len);
+ new_break.line = line_num;
+
- zend_hash_index_update(broken, line_num, (void **) &new_break, sizeof(phpdbg_breakfile_t), NULL);
++ zend_hash_index_update_mem(broken, line_num, &new_break, sizeof(phpdbg_breakfile_t));
- if (!zend_hash_index_exists(broken, line_num)) {
- PHPDBG_G(flags) |= PHPDBG_HAS_FILE_BP;
+ if (pending) {
+ PHPDBG_G(flags) |= PHPDBG_HAS_PENDING_FILE_BP;
- PHPDBG_BREAK_INIT(new_break, PHPDBG_BREAK_FILE);
- new_break.filename = estrndup(path, path_len);
- new_break.line = line_num;
+ phpdbg_notice("breakpoint", "add=\"success\" id=\"%d\" file=\"%s\" line=\"%ld\" pending=\"pending\"", "Pending breakpoint #%d added at %s:%ld", new_break.id, new_break.filename, new_break.line);
+ } else {
+ PHPDBG_G(flags) |= PHPDBG_HAS_FILE_BP;
- zend_hash_index_update_mem(broken, line_num, &new_break, sizeof(phpdbg_breakfile_t));
+ phpdbg_notice("breakpoint", "add=\"success\" id=\"%d\" file=\"%s\" line=\"%ld\"", "Breakpoint #%d added at %s:%ld", new_break.id, new_break.filename, new_break.line);
+ }
- phpdbg_notice("breakpoint", "add=\"success\" id=\"%d\" file=\"%s\" line=\"%ld\"", "Breakpoint #%d added at %s:%ld", new_break.id, new_break.filename, new_break.line);
+ PHPDBG_BREAK_MAPPING(new_break.id, broken);
+ } else {
+ phpdbg_error("breakpoint", "type=\"exists\" add=\"fail\" file=\"%s\" line=\"%ld\"", "Breakpoint at %s:%ld exists", path, line_num);
+ }
+ } /* }}} */
- PHPDBG_BREAK_MAPPING(new_break.id, broken);
- } else {
- phpdbg_error("breakpoint", "type=\"exists\" add=\"fail\" file=\"%s\" line=\"%ld\"", "Breakpoint at %s:%ld exists", path, line_num);
+ PHPDBG_API void phpdbg_resolve_pending_file_break(const char *file TSRMLS_DC) /* {{{ */
+ {
- HashPosition position[2];
+ HashTable *fileht;
+ uint filelen = strlen(file);
++ zend_string *cur;
+
- zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], &position[0]);
- while (zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], (void**) &fileht, &position[0]) == SUCCESS) {
- const char *cur;
- uint curlen;
-
- zend_hash_get_current_key_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], (char **) &cur, &curlen, NULL, 0, &position[0]);
- zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], &position[0]);
-
- if (curlen < filelen && file[filelen - curlen - 1] == '/' && !memcmp(file + filelen - curlen, cur, curlen)) {
++ ZEND_HASH_FOREACH_STR_KEY_PTR(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], cur, fileht) {
++ if (cur->len < filelen && file[filelen - cur->len - 1] == '/' && !memcmp(file + filelen - cur->len, cur->val, cur->len)) {
+ phpdbg_breakfile_t *brake, new_brake;
- HashTable *master = NULL;
++ HashTable *master;
+ dtor_func_t dtor;
+
+ PHPDBG_G(flags) |= PHPDBG_HAS_FILE_BP;
+
- if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen, (void **) &master) == FAILURE) {
++ if (!(master = zend_hash_str_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen))) {
+ dtor = PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING].pDestructor;
+ PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING].pDestructor = NULL;
- zend_hash_add(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen, fileht, sizeof(HashTable), (void **) &fileht);
++ fileht = zend_hash_str_add_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], file, filelen, fileht, sizeof(HashTable));
}
- } else {
- phpdbg_error("breakpoint", "type=\"notregular\" add=\"fail\" file=\"%s\"", "Cannot set breakpoint in %s, it is not a regular file", path);
- for (zend_hash_internal_pointer_reset_ex(fileht, &position[1]);
- zend_hash_get_current_data_ex(fileht, (void**)&brake, &position[1]) == SUCCESS;
- zend_hash_move_forward_ex(fileht, &position[1])) {
++ ZEND_HASH_FOREACH_PTR(fileht, brake) {
+ new_brake = *brake;
+ new_brake.filename = estrndup(file, filelen);
+ PHPDBG_BREAK_UNMAPPING(brake->id);
+
+ if (master) {
- zend_hash_index_update(master, brake->line, (void **) &new_brake, sizeof(phpdbg_breakfile_t), NULL);
++ zend_hash_index_update_mem(master, brake->line, &new_brake, sizeof(phpdbg_breakfile_t));
+ PHPDBG_BREAK_MAPPING(brake->id, master);
+ } else {
+ efree((char *) brake->filename);
+ *brake = new_brake;
+ PHPDBG_BREAK_MAPPING(brake->id, fileht);
+ }
- }
++ } ZEND_HASH_FOREACH_END();
+
- zend_hash_del(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], cur, curlen);
++ zend_hash_del(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], cur);
+
+ if (!master) {
+ PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING].pDestructor = dtor;
+ }
+
+ if (!zend_hash_num_elements(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING])) {
+ PHPDBG_G(flags) &= ~PHPDBG_HAS_PENDING_FILE_BP;
+ }
}
- } else {
- phpdbg_error("breakpoint", "type=\"nofile\" add=\"fail\" file=\"%s\"", "Cannot stat %s, it does not exist", path);
-- }
++ } ZEND_HASH_FOREACH_END();
} /* }}} */
PHPDBG_API void phpdbg_set_breakpoint_symbol(const char *name, size_t name_len TSRMLS_DC) /* {{{ */
phpdbg_out(SEPARATE "\n");
phpdbg_out("File Breakpoints:\n");
- for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position[0]);
- zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], (void**) &points, &position[0]) == SUCCESS;
- zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position[0])) {
+ ZEND_HASH_FOREACH_PTR(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], points) {
phpdbg_breakfile_t *brake;
- for (zend_hash_internal_pointer_reset_ex(points, &position[1]);
- zend_hash_get_current_data_ex(points, (void**)&brake, &position[1]) == SUCCESS;
- zend_hash_move_forward_ex(points, &position[1])) {
+ ZEND_HASH_FOREACH_PTR(points, brake) {
phpdbg_writeln("file", "id=\"%d\" name=\"%s\" line=\"%lu\" disabled=\"%s\"", "#%d\t\t%s:%lu%s",
brake->id, brake->filename, brake->line,
- ((phpdbg_breakbase_t*)brake)->disabled ? " [disabled]" : "");
- }
- }
+ ((phpdbg_breakbase_t *) brake)->disabled ? " [disabled]" : "");
+ } ZEND_HASH_FOREACH_END();
+ } ZEND_HASH_FOREACH_END();
+ } if ((PHPDBG_G(flags) & PHPDBG_HAS_PENDING_FILE_BP)) {
- HashPosition position[2];
+ HashTable *points;
+
+ phpdbg_out(SEPARATE "\n");
+ phpdbg_out("Pending File Breakpoints:\n");
- for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], &position[0]);
- zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], (void**) &points, &position[0]) == SUCCESS;
- zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], &position[0])) {
++ ZEND_HASH_FOREACH_PTR(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], points) {
+ phpdbg_breakfile_t *brake;
- for (zend_hash_internal_pointer_reset_ex(points, &position[1]);
- zend_hash_get_current_data_ex(points, (void**)&brake, &position[1]) == SUCCESS;
- zend_hash_move_forward_ex(points, &position[1])) {
++ ZEND_HASH_FOREACH_PTR(points, brake) {
+ phpdbg_writeln("file", "id=\"%d\" name=\"%s\" line=\"%lu\" disabled=\"%s\" pending=\"pending\"", "#%d\t\t%s:%lu%s",
+ brake->id, brake->filename, brake->line,
- ((phpdbg_breakbase_t*)brake)->disabled ? " [disabled]" : "");
- }
- }
-
++ ((phpdbg_breakbase_t *) brake)->disabled ? " [disabled]" : "");
++ } ZEND_HASH_FOREACH_END();
++ } ZEND_HASH_FOREACH_END();
} break;
case PHPDBG_BREAK_OPLINE: if ((PHPDBG_G(flags) & PHPDBG_HAS_OPLINE_BP)) {
dataptr->line[line] = endptr - data.buf;
dataptr = erealloc(dataptr, sizeof(phpdbg_file_source) + sizeof(uint) * line);
+ zend_hash_str_add_ptr(&PHPDBG_G(file_sources), filename, strlen(filename), dataptr);
+ phpdbg_resolve_pending_file_break(filename TSRMLS_CC);
ret = PHPDBG_G(compile_file)(&fake, type TSRMLS_CC);
- /* A Bison parser, made by GNU Bison 2.6. */
-/* A Bison parser, made by GNU Bison 2.7. */
++/* A Bison parser, made by GNU Bison 2.7.12-4996. */
/* Bison implementation for Yacc-like parsers in C
-- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
++ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define YYBISON 1
/* Bison version. */
- #define YYBISON_VERSION "2.6"
-#define YYBISON_VERSION "2.7"
++#define YYBISON_VERSION "2.7.12-4996"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
#define yynerrs phpdbg_nerrs
/* Copy the first part of user declarations. */
-
- /* Line 336 of yacc.c */
+ /* Line 371 of yacc.c */
-#line 1 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
+#line 1 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
/*
extern int phpdbg_debug;
#endif
/* "%code requires" blocks. */
-
- /* Line 350 of yacc.c */
+ /* Line 387 of yacc.c */
-#line 31 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
+#line 31 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
#include "phpdbg.h"
#ifndef YY_TYPEDEF_YY_SCANNER_T
# endif
# endif
# ifndef YY_
- # define YY_(msgid) msgid
+ # define YY_(Msgid) Msgid
+ # endif
+ #endif
+
++#ifndef __attribute__
++/* This feature is available in gcc versions 2.5 and later. */
++# if (! defined __GNUC__ || __GNUC__ < 2 \
++ || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
++# define __attribute__(Spec) /* empty */
+# endif
+#endif
+
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
- # define YYUSE(e) ((void) (e))
+ # define YYUSE(E) ((void) (E))
#else
- # define YYUSE(e) /* empty */
+ # define YYUSE(E) /* empty */
#endif
++
/* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint
- # define YYID(n) (n)
+ # define YYID(N) (N)
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# else
YYUSE (yyoutput);
# endif
-- switch (yytype)
-- {
-- default:
- break;
- break;
-- }
++ YYUSE (yytype);
}
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-- switch (yytype)
-- {
--
-- default:
- break;
- break;
-- }
++ YYUSE (yytype);
}
switch (yyn)
{
case 3:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 68 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 68 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(1) - (1)])); }
break;
case 5:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 73 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 73 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(1) - (1)])); }
break;
case 6:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 74 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 74 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ phpdbg_stack_push(PHPDBG_G(parser_stack), &(yyvsp[(2) - (2)])); }
break;
case 7:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 75 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 75 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (2)]); }
break;
case 8:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 79 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 79 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = FILE_PARAM;
(yyval).file.name = (yyvsp[(2) - (3)]).str;
break;
case 9:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 84 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 84 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = NUMERIC_FILE_PARAM;
(yyval).file.name = (yyvsp[(1) - (4)]).str;
break;
case 10:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 89 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 89 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = FILE_PARAM;
(yyval).file.name = malloc((yyvsp[(1) - (4)]).len + (yyvsp[(2) - (4)]).len + 1);
break;
case 11:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 99 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 99 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = NUMERIC_FILE_PARAM;
(yyval).file.name = malloc((yyvsp[(1) - (5)]).len + (yyvsp[(2) - (5)]).len + 1);
break;
case 12:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 109 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 109 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = METHOD_PARAM;
(yyval).method.class = (yyvsp[(1) - (3)]).str;
break;
case 13:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 114 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 114 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = NUMERIC_METHOD_PARAM;
(yyval).method.class = (yyvsp[(1) - (5)]).str;
break;
case 14:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 120 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 120 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = NUMERIC_FUNCTION_PARAM;
(yyval).str = (yyvsp[(1) - (3)]).str;
break;
case 15:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 126 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 126 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = COND_PARAM;
(yyval).str = (yyvsp[(2) - (2)]).str;
break;
case 16:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 131 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 131 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 17:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 132 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 132 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 18:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 133 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 133 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 19:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 134 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 134 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 20:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 135 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 135 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 21:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 136 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 136 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 22:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 137 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 137 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ (yyval) = (yyvsp[(1) - (1)]); }
break;
case 23:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 141 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 141 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{ PHPDBG_G(req_id) = (yyvsp[(1) - (1)]).num; }
break;
case 25:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 146 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 146 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = EVAL_PARAM;
(yyval).str = (yyvsp[(3) - (3)]).str;
break;
case 26:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 151 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 151 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = SHELL_PARAM;
(yyval).str = (yyvsp[(3) - (3)]).str;
break;
case 27:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 156 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 156 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = RUN_PARAM;
(yyval).len = 0;
break;
case 28:
-
- /* Line 1803 of yacc.c */
-/* Line 1792 of yacc.c */
-#line 160 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 1802 of yacc.c */
+#line 160 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
{
(yyval).type = RUN_PARAM;
(yyval).str = (yyvsp[(3) - (3)]).str;
break;
-
- /* Line 1803 of yacc.c */
- #line 1707 "sapi/phpdbg/phpdbg_parser.c"
-/* Line 1792 of yacc.c */
++/* Line 1802 of yacc.c */
+ #line 1667 "sapi/phpdbg/phpdbg_parser.c"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
}
-
- /* Line 2049 of yacc.c */
-/* Line 2055 of yacc.c */
-#line 167 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 2050 of yacc.c */
+#line 167 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
static int yyerror(void ***tsrm_ls, const char *msg) {
- /* A Bison parser, made by GNU Bison 2.6. */
-/* A Bison parser, made by GNU Bison 2.7. */
++/* A Bison parser, made by GNU Bison 2.7.12-4996. */
/* Bison interface for Yacc-like parsers in C
-- Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
++ Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
extern int phpdbg_debug;
#endif
/* "%code requires" blocks. */
-
- /* Line 2056 of yacc.c */
-/* Line 2058 of yacc.c */
-#line 31 "/usr/src/php-src/sapi/phpdbg/phpdbg_parser.y"
++/* Line 2060 of yacc.c */
+#line 31 "/Users/Bob/php-src-X/sapi/phpdbg/phpdbg_parser.y"
#include "phpdbg.h"
#ifndef YY_TYPEDEF_YY_SCANNER_T
#endif
-
- /* Line 2056 of yacc.c */
- #line 57 "sapi/phpdbg/phpdbg_parser.h"
-/* Line 2058 of yacc.c */
++/* Line 2060 of yacc.c */
+ #line 55 "sapi/phpdbg/phpdbg_parser.h"
/* Tokens. */
#ifndef YYTOKENTYPE
size_t res_len = strlen(res);
if ((res_len != PHPDBG_G(exec_len)) || (memcmp(res, PHPDBG_G(exec), res_len) != SUCCESS)) {
- if (EG(in_execution)) {
++ if (PHPDBG_G(in_execution)) {
+ if (phpdbg_ask_user_permission("Do you really want to stop execution to set a new execution context?" TSRMLS_CC) == FAILURE) {
+ return FAILURE;
+ }
+ }
if (PHPDBG_G(exec)) {
phpdbg_notice("exec", "type=\"unset\" context=\"%s\"", "Unsetting old execution context: %s", PHPDBG_G(exec));
phpdbg_notice("exec", "type=\"set\" context=\"%s\"", "Set execution context: %s", PHPDBG_G(exec));
- if (phpdbg_compile(TSRMLS_C) == FAILURE) {
- phpdbg_error("compile", "type=\"compilefailure\" context=\"%s\"", "Failed to compile %s", PHPDBG_G(exec));
- if (EG(in_execution)) {
++ if (PHPDBG_G(in_execution)) {
+ phpdbg_clean(1 TSRMLS_CC);
}
+
+ phpdbg_compile(TSRMLS_C);
} else {
phpdbg_notice("exec", "type=\"unchanged\"", "Execution context not changed");
}
PHPDBG_COMMAND(run) /* {{{ */
{
- if (PHPDBG_G(in_execution)) {
- phpdbg_error("inactive", "type=\"isrunning\"", "Cannot start another execution while one is in progress");
- return SUCCESS;
- }
-
if (PHPDBG_G(ops) || PHPDBG_G(exec)) {
- zend_op **orig_opline = EG(opline_ptr);
- zend_op_array *orig_op_array = EG(active_op_array);
- zval **orig_retval_ptr = EG(return_value_ptr_ptr);
- zend_bool restore = 1;
zend_execute_data *ex = EG(current_execute_data);
+ zend_bool restore = 1;
- if (EG(in_execution)) {
++ if (PHPDBG_G(in_execution)) {
+ if (phpdbg_ask_user_permission("Do you really want to restart execution?" TSRMLS_CC) == SUCCESS) {
+ phpdbg_startup_run++;
+ phpdbg_clean(1 TSRMLS_CC);
+ }
+ return SUCCESS;
+ }
+
if (!PHPDBG_G(ops)) {
if (phpdbg_compile(TSRMLS_C) == FAILURE) {
phpdbg_error("compile", "type=\"compilefailure\" context=\"%s\"", "Failed to compile %s, cannot run", PHPDBG_G(exec));
}
zend_try {
- PHPDBG_G(flags) &= ~PHPDBG_IS_INTERACTIVE;
+ PHPDBG_G(flags) ^= PHPDBG_IS_INTERACTIVE;
+ PHPDBG_G(flags) |= PHPDBG_IS_RUNNING;
- zend_execute(EG(active_op_array) TSRMLS_CC);
- PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE;
+ zend_execute(PHPDBG_G(ops), &PHPDBG_G(retval) TSRMLS_CC);
+ PHPDBG_G(flags) ^= PHPDBG_IS_INTERACTIVE;
- phpdbg_notice("stop", "type=\"normal\"", "Script ended normally");
} zend_catch {
- EG(active_op_array) = orig_op_array;
- EG(opline_ptr) = orig_opline;
- EG(return_value_ptr_ptr) = orig_retval_ptr;
+ PHPDBG_G(in_execution) = 0;
- if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
+
+ if (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)) {
phpdbg_error("stop", "type=\"bailout\"", "Caught exit/error from VM");
restore = 0;
}
if (EG(exception)) {
phpdbg_handle_exception(TSRMLS_C);
}
- EG(active_op_array) = orig_op_array;
- EG(opline_ptr) = orig_opline;
- EG(return_value_ptr_ptr) = orig_retval_ptr;
-
+
+ phpdbg_clean(1 TSRMLS_CC);
}
+
+ PHPDBG_G(flags) &= ~PHPDBG_IS_RUNNING;
} else {
phpdbg_error("inactive", "type=\"nocontext\"", "Nothing to execute!");
}
PHPDBG_COMMAND(clean) /* {{{ */
{
- if (EG(in_execution)) {
+ if (PHPDBG_G(in_execution)) {
- phpdbg_error("inactive", "type=\"isrunning\"", "Cannot clean environment while executing");
- return SUCCESS;
+ if (phpdbg_ask_user_permission("Do you really want to clean your current environment?" TSRMLS_CC) == FAILURE) {
+ return SUCCESS;
+ }
}
phpdbg_out("Cleaning Execution Environment\n");
#ifdef PHP_WIN32
#define PARA ((phpdbg_param_t *)stack.next)->type
- if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE && (RUN_PARAM == PARA || EVAL_PARAM == PARA)) {
- sigio_watcher_start();
- }
+ if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE && (RUN_PARAM == PARA || EVAL_PARAM == PARA)) {
+ sigio_watcher_start();
+ }
#endif
- switch (ret = phpdbg_stack_execute(&stack, allow_async_unsafe TSRMLS_CC)) {
- case FAILURE:
- if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
- if (!allow_async_unsafe || phpdbg_call_register(&stack TSRMLS_CC) == FAILURE) {
- phpdbg_output_err_buf(NULL, "%b", "%b" TSRMLS_CC);
- }
+ switch (ret = phpdbg_stack_execute(&stack, allow_async_unsafe TSRMLS_CC)) {
+ case FAILURE:
+ if (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)) {
+ if (!allow_async_unsafe || phpdbg_call_register(&stack TSRMLS_CC) == FAILURE) {
+ phpdbg_output_err_buf(NULL, "%b", "%b" TSRMLS_CC);
}
- break;
+ }
+ break;
- case PHPDBG_LEAVE:
- case PHPDBG_FINISH:
- case PHPDBG_UNTIL:
- case PHPDBG_NEXT: {
- phpdbg_activate_err_buf(0 TSRMLS_CC);
- phpdbg_free_err_buf(TSRMLS_C);
- if (!PHPDBG_G(in_execution) && !(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) {
- phpdbg_error("command", "type=\"noexec\"", "Not running");
- }
- goto out;
+ case PHPDBG_LEAVE:
+ case PHPDBG_FINISH:
+ case PHPDBG_UNTIL:
+ case PHPDBG_NEXT: {
+ phpdbg_activate_err_buf(0 TSRMLS_CC);
+ phpdbg_free_err_buf(TSRMLS_C);
- if (!EG(in_execution) && !(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)) {
++ if (!PHPDBG_G(in_execution) && !(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)) {
+ phpdbg_error("command", "type=\"noexec\"", "Not running");
}
+ break;
}
+ }
- phpdbg_activate_err_buf(0 TSRMLS_CC);
- phpdbg_free_err_buf(TSRMLS_C);
+ phpdbg_activate_err_buf(0 TSRMLS_CC);
+ phpdbg_free_err_buf(TSRMLS_C);
#ifdef PHP_WIN32
- if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE && (RUN_PARAM == PARA || EVAL_PARAM == PARA)) {
- sigio_watcher_stop();
- }
+ if (PHPDBG_G(flags) & PHPDBG_IS_REMOTE && (RUN_PARAM == PARA || EVAL_PARAM == PARA)) {
+ sigio_watcher_stop();
+ }
#undef PARA
#endif
- }
+ }
- phpdbg_stack_free(&stack);
- phpdbg_destroy_input(&input TSRMLS_CC);
- PHPDBG_G(req_id) = 0;
- } while ((input = phpdbg_read_input(NULL TSRMLS_CC)));
+ phpdbg_stack_free(&stack);
+ phpdbg_destroy_input(&input TSRMLS_CC);
+ PHPDBG_G(req_id) = 0;
+ input = NULL;
}
- out:
if (input) {
phpdbg_stack_free(&stack);
phpdbg_destroy_input(&input TSRMLS_CC);
} \
} while (0)
-#if PHP_VERSION_ID >= 50500
void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
{
-#else
-void phpdbg_execute_ex(zend_op_array *op_array TSRMLS_DC) /* {{{ */
-{
- long long flags = 0;
- zend_ulong address = 0L;
- zend_execute_data *execute_data;
- zend_bool nested = 0;
-#endif
- zend_bool original_in_execution = EG(in_execution);
+ zend_bool original_in_execution = PHPDBG_G(in_execution);
HashTable vars;
-#if PHP_VERSION_ID < 50500
- if (EG(exception)) {
- return;
- }
-#endif
+ zend_hash_init(&vars, execute_data->func->op_array.last, NULL, NULL, 0);
- EG(in_execution) = 1;
-
-#if PHP_VERSION_ID >= 50500
- if (0) {
-zend_vm_enter:
- execute_data = phpdbg_create_execute_data(EG(active_op_array), 1 TSRMLS_CC);
- }
- zend_hash_init(&vars, EG(active_op_array)->last, NULL, NULL, 0);
-#else
-zend_vm_enter:
- execute_data = phpdbg_create_execute_data(op_array, nested TSRMLS_CC);
- nested = 1;
- zend_hash_init(&vars, EG(active_op_array)->last, NULL, NULL, 0);
-#endif
+ if ((PHPDBG_G(flags) & (PHPDBG_IS_STOPPING | PHPDBG_IS_RUNNING)) == PHPDBG_IS_STOPPING) {
+ zend_bailout();
+ }
+
+ PHPDBG_G(in_execution) = 1;
while (1) {
if ((PHPDBG_G(flags) & PHPDBG_BP_RESOLVE_MASK)) {