From: krakjoe Date: Sun, 10 Nov 2013 22:46:49 +0000 (+0000) Subject: Merge branch 'master' of https://github.com/krakjoe/phpdbg X-Git-Tag: php-5.6.0alpha1~110^2~503 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aba249e5c7c6fe74223c692d1ab12f93de9989c9;p=php Merge branch 'master' of https://github.com/krakjoe/phpdbg --- aba249e5c7c6fe74223c692d1ab12f93de9989c9 diff --cc phpdbg.c index 491b55b5f4,73108d799f..2ebc518484 --- a/phpdbg.c +++ b/phpdbg.c @@@ -54,10 -52,15 +55,15 @@@ static void php_phpdbg_destroy_bp_file( zend_llist_destroy((zend_llist*)brake); } /* }}} */ + static void php_phpdbg_destroy_bp_symbol(void *brake) /* {{{ */ + { - efree(((phpdbg_breaksymbol_t*)brake)->symbol); ++ efree((char*)((phpdbg_breaksymbol_t*)brake)->symbol); + } /* }}} */ + static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */ { - zend_hash_init(&PHPDBG_G(bp_files), 8, NULL, php_phpdbg_destroy_break, 0); - zend_hash_init(&PHPDBG_G(bp_symbols), 8, NULL, php_phpdbg_destroy_break, 0); + zend_hash_init(&PHPDBG_G(bp_files), 8, NULL, php_phpdbg_destroy_bp_file, 0); + zend_hash_init(&PHPDBG_G(bp_symbols), 8, NULL, php_phpdbg_destroy_bp_symbol, 0); return SUCCESS; } /* }}} */ @@@ -222,14 -180,7 +228,14 @@@ int main(int argc, char *argv[]) /* {{ setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ #endif - while ((opt = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 1, 1)) != -1) { +#ifdef ZTS + tsrm_startup(1, 1, 0, NULL); + + tsrm_ls = ts_resource(0); +#endif + - while ((opt = php_getopt(argc, argv, phpdbg_options, &php_optarg, &php_optind, 0, 2)) != -1) { ++ while ((opt = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2)) != -1) { + printf("OPT: %d\n", opt); switch (opt) { case 'c': if (ini_path_override) { @@@ -280,18 -231,6 +286,17 @@@ phpdbg->phpinfo_as_text = 1; phpdbg->php_ini_ignore_cwd = 0; phpdbg->php_ini_ignore = 0; + + if (ini_entries) { + ini_entries = realloc(ini_entries, ini_entries_len + sizeof(phpdbg_ini_hardcoded)); + memmove(ini_entries + sizeof(phpdbg_ini_hardcoded) - 2, ini_entries, ini_entries_len + 1); + memcpy(ini_entries, phpdbg_ini_hardcoded, sizeof(phpdbg_ini_hardcoded) - 2); + } else { + ini_entries = malloc(sizeof(phpdbg_ini_hardcoded)); + memcpy(ini_entries, phpdbg_ini_hardcoded, sizeof(phpdbg_ini_hardcoded)); + } + ini_entries_len += sizeof(phpdbg_ini_hardcoded) - 2; - printf("ini_entries: %d\n", ini_entries_len); + phpdbg->ini_entries = ini_entries; if (phpdbg->startup(phpdbg) == SUCCESS) {