mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Merge branch 'master' of https://github.com/krakjoe/phpdbg
This commit is contained in:
parent
4e6a8eeffa
commit
02ae3f8de1
6 changed files with 80 additions and 49 deletions
14
phpdbg.c
14
phpdbg.c
|
@ -162,6 +162,7 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
|
||||||
if (PHPDBG_G(prompt)[0]) {
|
if (PHPDBG_G(prompt)[0]) {
|
||||||
free(PHPDBG_G(prompt)[0]);
|
free(PHPDBG_G(prompt)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHPDBG_G(prompt)[1]) {
|
if (PHPDBG_G(prompt)[1]) {
|
||||||
free(PHPDBG_G(prompt)[1]);
|
free(PHPDBG_G(prompt)[1]);
|
||||||
}
|
}
|
||||||
|
@ -565,19 +566,21 @@ int main(int argc, char **argv) /* {{{ */
|
||||||
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
|
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
phpdbg_main:
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
tsrm_startup(1, 1, 0, NULL);
|
tsrm_startup(1, 1, 0, NULL);
|
||||||
|
|
||||||
tsrm_ls = ts_resource(0);
|
tsrm_ls = ts_resource(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!cleaning) {
|
||||||
bp_tmp_file = malloc(L_tmpnam);
|
bp_tmp_file = malloc(L_tmpnam);
|
||||||
tmpnam(bp_tmp_file);
|
tmpnam(bp_tmp_file);
|
||||||
if (bp_tmp_file == NULL) {
|
if (bp_tmp_file == NULL) {
|
||||||
phpdbg_error("Unable to create temporary file");
|
phpdbg_error("Unable to create temporary file");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
phpdbg_main:
|
|
||||||
ini_entries = NULL;
|
ini_entries = NULL;
|
||||||
ini_entries_len = 0;
|
ini_entries_len = 0;
|
||||||
ini_ignore = 0;
|
ini_ignore = 0;
|
||||||
|
@ -858,16 +861,15 @@ phpdbg_out:
|
||||||
sapi_shutdown();
|
sapi_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ZTS
|
||||||
|
tsrm_shutdown();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cleaning) {
|
if (cleaning) {
|
||||||
goto phpdbg_main;
|
goto phpdbg_main;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(bp_tmp_file);
|
free(bp_tmp_file);
|
||||||
|
|
||||||
#ifdef ZTS
|
|
||||||
/* bugggy */
|
|
||||||
/* tsrm_shutdown(); */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
5
phpdbg.h
5
phpdbg.h
|
@ -112,11 +112,12 @@
|
||||||
#define PHPDBG_IS_INITIALIZING (1<<19)
|
#define PHPDBG_IS_INITIALIZING (1<<19)
|
||||||
#define PHPDBG_IS_SIGNALED (1<<20)
|
#define PHPDBG_IS_SIGNALED (1<<20)
|
||||||
#define PHPDBG_IS_INTERACTIVE (1<<21)
|
#define PHPDBG_IS_INTERACTIVE (1<<21)
|
||||||
|
#define PHPDBG_IS_BP_ENABLED (1<<22)
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED)
|
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED|PHPDBG_IS_BP_ENABLED)
|
||||||
#else
|
#else
|
||||||
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET)
|
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_BP_ENABLED)
|
||||||
#endif /* }}} */
|
#endif /* }}} */
|
||||||
|
|
||||||
/* {{{ strings */
|
/* {{{ strings */
|
||||||
|
|
|
@ -545,6 +545,10 @@ int phpdbg_find_conditional_breakpoint(TSRMLS_D) /* {{{ */
|
||||||
|
|
||||||
int phpdbg_find_breakpoint(zend_execute_data* execute_data TSRMLS_DC) /* {{{ */
|
int phpdbg_find_breakpoint(zend_execute_data* execute_data TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
|
if (!(PHPDBG_G(flags) & PHPDBG_IS_BP_ENABLED)) {
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
/* conditions cannot be executed by eval()'d code */
|
/* conditions cannot be executed by eval()'d code */
|
||||||
if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)
|
if (!(PHPDBG_G(flags) & PHPDBG_IN_EVAL)
|
||||||
&& (PHPDBG_G(flags) & PHPDBG_HAS_COND_BP)
|
&& (PHPDBG_G(flags) & PHPDBG_HAS_COND_BP)
|
||||||
|
|
|
@ -234,7 +234,7 @@ PHPDBG_HELP(break) /* {{{ */
|
||||||
phpdbg_writeln(EMPTY);
|
phpdbg_writeln(EMPTY);
|
||||||
phpdbg_writeln("\t%sbreak [address] 0x7ff68f570e08", phpdbg_get_prompt(TSRMLS_C));
|
phpdbg_writeln("\t%sbreak [address] 0x7ff68f570e08", phpdbg_get_prompt(TSRMLS_C));
|
||||||
phpdbg_writeln("\t%sb [a] 0x7ff68f570e08", phpdbg_get_prompt(TSRMLS_C));
|
phpdbg_writeln("\t%sb [a] 0x7ff68f570e08", phpdbg_get_prompt(TSRMLS_C));
|
||||||
phpdbg_writeln("\tWill break at the opline with the address provided (addresses are shown during execution)");
|
phpdbg_writeln("\tWill break at the opline with the address provided");
|
||||||
phpdbg_writeln(EMPTY);
|
phpdbg_writeln(EMPTY);
|
||||||
phpdbg_writeln("\t%sbreak [lineno] 200", phpdbg_get_prompt(TSRMLS_C));
|
phpdbg_writeln("\t%sbreak [lineno] 200", phpdbg_get_prompt(TSRMLS_C));
|
||||||
phpdbg_writeln("\t%sb [l] 200", phpdbg_get_prompt(TSRMLS_C));
|
phpdbg_writeln("\t%sb [l] 200", phpdbg_get_prompt(TSRMLS_C));
|
||||||
|
|
22
phpdbg_set.c
22
phpdbg_set.c
|
@ -41,6 +41,28 @@ PHPDBG_SET(prompt) /* {{{ */
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
PHPDBG_SET(break) /* {{{ */
|
||||||
|
{
|
||||||
|
switch (param->type) {
|
||||||
|
case EMPTY_PARAM:
|
||||||
|
phpdbg_writeln("%s",
|
||||||
|
PHPDBG_G(flags) & PHPDBG_IS_BP_ENABLED ? "on" : "off");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case STR_PARAM:
|
||||||
|
if (strncasecmp(param->str, PHPDBG_STRL("on")) == 0) {
|
||||||
|
PHPDBG_G(flags) |= PHPDBG_IS_BP_ENABLED;
|
||||||
|
} else if (strncasecmp(param->str, PHPDBG_STRL("off")) == 0) {
|
||||||
|
PHPDBG_G(flags) ^= PHPDBG_IS_BP_ENABLED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
phpdbg_default_switch_case();
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
PHPDBG_SET(color) /* {{{ */
|
PHPDBG_SET(color) /* {{{ */
|
||||||
{
|
{
|
||||||
if ((param->type == STR_PARAM) && (input->argc == 3)) {
|
if ((param->type == STR_PARAM) && (input->argc == 3)) {
|
||||||
|
|
|
@ -27,11 +27,13 @@
|
||||||
PHPDBG_SET(prompt);
|
PHPDBG_SET(prompt);
|
||||||
PHPDBG_SET(color);
|
PHPDBG_SET(color);
|
||||||
PHPDBG_SET(oplog);
|
PHPDBG_SET(oplog);
|
||||||
|
PHPDBG_SET(break);
|
||||||
|
|
||||||
static const phpdbg_command_t phpdbg_set_commands[] = {
|
static const phpdbg_command_t phpdbg_set_commands[] = {
|
||||||
PHPDBG_COMMAND_D_EX(prompt, "usage: set prompt <string>", 'p', set_prompt, NULL, 0),
|
PHPDBG_COMMAND_D_EX(prompt, "usage: set prompt <string>", 'p', set_prompt, NULL, 0),
|
||||||
PHPDBG_COMMAND_D_EX(color, "usage: set color <element> <color>", 'c', set_color, NULL, 1),
|
PHPDBG_COMMAND_D_EX(color, "usage: set color <element> <color>", 'c', set_color, NULL, 1),
|
||||||
PHPDBG_COMMAND_D_EX(oplog, "usage: set oplog <output>", 'O', set_oplog, NULL, 0),
|
PHPDBG_COMMAND_D_EX(oplog, "usage: set oplog <output>", 'O', set_oplog, NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D_EX(break, "usage: set break <on|off>", 'b', set_break, NULL, 0),
|
||||||
PHPDBG_END_COMMAND
|
PHPDBG_END_COMMAND
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue