mirror of
https://github.com/php/php-src.git
synced 2025-08-18 23:18:56 +02:00
- Added "set prompt" command
This commit is contained in:
parent
97f733e60d
commit
795e12b85e
8 changed files with 31 additions and 8 deletions
|
@ -18,7 +18,7 @@ if test "$PHP_PHPDBG" != "no"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PHP_PHPDBG_CFLAGS="-I$abc_srcdir"
|
PHP_PHPDBG_CFLAGS="-I$abc_srcdir"
|
||||||
PHP_PHPDBG_FILES="phpdbg.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c phpdbg_cmd.c"
|
PHP_PHPDBG_FILES="phpdbg.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c phpdbg_cmd.c phpdbg_set.c"
|
||||||
|
|
||||||
PHP_SUBST(PHP_PHPDBG_CFLAGS)
|
PHP_SUBST(PHP_PHPDBG_CFLAGS)
|
||||||
PHP_SUBST(PHP_PHPDBG_FILES)
|
PHP_SUBST(PHP_PHPDBG_FILES)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
ARG_ENABLE('phpdbg', 'Build phpdbg', 'yes');
|
ARG_ENABLE('phpdbg', 'Build phpdbg', 'yes');
|
||||||
|
|
||||||
if (PHP_PHPDBG == "yes") {
|
if (PHP_PHPDBG == "yes") {
|
||||||
SAPI('phpdbg', 'phpdbg.c phpdbg_prompt.c phpdbg_cmd.c phpdbg_info.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c', 'phpdbg.exe');
|
SAPI('phpdbg', 'phpdbg.c phpdbg_prompt.c phpdbg_cmd.c phpdbg_info.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_opcode.c phpdbg_list.c phpdbg_utils.c phpdbg_set.c', 'phpdbg.exe');
|
||||||
ADD_FLAG("LIBS_PHPDBG", "ws2_32.lib user32.lib");
|
ADD_FLAG("LIBS_PHPDBG", "ws2_32.lib user32.lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
phpdbg.c
10
phpdbg.c
|
@ -25,6 +25,7 @@
|
||||||
#include "phpdbg_bp.h"
|
#include "phpdbg_bp.h"
|
||||||
#include "phpdbg_break.h"
|
#include "phpdbg_break.h"
|
||||||
#include "phpdbg_utils.h"
|
#include "phpdbg_utils.h"
|
||||||
|
#include "phpdbg_set.h"
|
||||||
|
|
||||||
ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
|
ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ void (*zend_execute_old)(zend_op_array *op_array TSRMLS_DC);
|
||||||
|
|
||||||
static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
|
static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
|
||||||
{
|
{
|
||||||
|
pg->prompt = NULL;
|
||||||
pg->exec = NULL;
|
pg->exec = NULL;
|
||||||
pg->exec_len = 0;
|
pg->exec_len = 0;
|
||||||
pg->ops = NULL;
|
pg->ops = NULL;
|
||||||
|
@ -147,6 +149,11 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
|
||||||
PHPDBG_G(exec) = NULL;
|
PHPDBG_G(exec) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PHPDBG_G(prompt)) {
|
||||||
|
efree(PHPDBG_G(prompt));
|
||||||
|
PHPDBG_G(prompt) = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (PHPDBG_G(oplog)) {
|
if (PHPDBG_G(oplog)) {
|
||||||
fclose(
|
fclose(
|
||||||
PHPDBG_G(oplog));
|
PHPDBG_G(oplog));
|
||||||
|
@ -679,6 +686,9 @@ phpdbg_main:
|
||||||
/* set flags from command line */
|
/* set flags from command line */
|
||||||
PHPDBG_G(flags) = flags;
|
PHPDBG_G(flags) = flags;
|
||||||
|
|
||||||
|
/* set default prompt */
|
||||||
|
phpdbg_set_prompt(PROMPT TSRMLS_CC);
|
||||||
|
|
||||||
zend_try {
|
zend_try {
|
||||||
zend_activate_modules(TSRMLS_C);
|
zend_activate_modules(TSRMLS_C);
|
||||||
} zend_end_try();
|
} zend_end_try();
|
||||||
|
|
1
phpdbg.h
1
phpdbg.h
|
@ -131,6 +131,7 @@
|
||||||
/* {{{ structs */
|
/* {{{ structs */
|
||||||
ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
|
ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
|
||||||
HashTable bp[PHPDBG_BREAK_TABLES]; /* break points */
|
HashTable bp[PHPDBG_BREAK_TABLES]; /* break points */
|
||||||
|
char *prompt; /* prompt */
|
||||||
char *exec; /* file to execute */
|
char *exec; /* file to execute */
|
||||||
size_t exec_len; /* size of exec */
|
size_t exec_len; /* size of exec */
|
||||||
zend_op_array *ops; /* op_array */
|
zend_op_array *ops; /* op_array */
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "phpdbg.h"
|
#include "phpdbg.h"
|
||||||
#include "phpdbg_cmd.h"
|
#include "phpdbg_cmd.h"
|
||||||
#include "phpdbg_utils.h"
|
#include "phpdbg_utils.h"
|
||||||
|
#include "phpdbg_set.h"
|
||||||
|
|
||||||
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
|
||||||
|
|
||||||
|
@ -220,7 +221,7 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */
|
||||||
if (buffered == NULL) {
|
if (buffered == NULL) {
|
||||||
#ifndef HAVE_LIBREADLINE
|
#ifndef HAVE_LIBREADLINE
|
||||||
char buf[PHPDBG_MAX_CMD];
|
char buf[PHPDBG_MAX_CMD];
|
||||||
if (!phpdbg_write(PROMPT) ||
|
if (!phpdbg_write(phpdbg_get_prompt(TSRMLS_C)) ||
|
||||||
!fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) {
|
!fgets(buf, PHPDBG_MAX_CMD, PHPDBG_G(io)[PHPDBG_STDIN])) {
|
||||||
/* the user has gone away */
|
/* the user has gone away */
|
||||||
phpdbg_error("Failed to read console !");
|
phpdbg_error("Failed to read console !");
|
||||||
|
@ -231,7 +232,7 @@ PHPDBG_API phpdbg_input_t *phpdbg_read_input(char *buffered TSRMLS_DC) /* {{{ */
|
||||||
|
|
||||||
cmd = buf;
|
cmd = buf;
|
||||||
#else
|
#else
|
||||||
cmd = readline(PROMPT);
|
cmd = readline(phpdbg_get_prompt(TSRMLS_C));
|
||||||
if (!cmd) {
|
if (!cmd) {
|
||||||
/* the user has gone away */
|
/* the user has gone away */
|
||||||
phpdbg_error("Failed to read console !");
|
phpdbg_error("Failed to read console !");
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "phpdbg_utils.h"
|
#include "phpdbg_utils.h"
|
||||||
#include "phpdbg_prompt.h"
|
#include "phpdbg_prompt.h"
|
||||||
#include "phpdbg_cmd.h"
|
#include "phpdbg_cmd.h"
|
||||||
|
#include "phpdbg_set.h"
|
||||||
|
|
||||||
/* {{{ command declarations */
|
/* {{{ command declarations */
|
||||||
const phpdbg_command_t phpdbg_prompt_commands[] = {
|
const phpdbg_command_t phpdbg_prompt_commands[] = {
|
||||||
|
@ -45,6 +46,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
|
||||||
PHPDBG_COMMAND_D(until, "continue past the current line", 'u', NULL, 0),
|
PHPDBG_COMMAND_D(until, "continue past the current line", 'u', NULL, 0),
|
||||||
PHPDBG_COMMAND_D(finish, "continue past the end of the stack", 'F', NULL, 0),
|
PHPDBG_COMMAND_D(finish, "continue past the end of the stack", 'F', NULL, 0),
|
||||||
PHPDBG_COMMAND_D(leave, "continue until the end of the stack", 'L', NULL, 0),
|
PHPDBG_COMMAND_D(leave, "continue until the end of the stack", 'L', NULL, 0),
|
||||||
|
PHPDBG_COMMAND_D(set, "set debug properties", 'S', phpdbg_set_commands, 1),
|
||||||
PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, 2),
|
PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, 2),
|
||||||
PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, 1),
|
PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, 1),
|
||||||
PHPDBG_COMMAND_D(back, "show trace", 't', NULL, 0),
|
PHPDBG_COMMAND_D(back, "show trace", 't', NULL, 0),
|
||||||
|
@ -756,6 +758,14 @@ PHPDBG_COMMAND(info) /* {{{ */
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
PHPDBG_COMMAND(set) /* {{{ */
|
||||||
|
{
|
||||||
|
phpdbg_error(
|
||||||
|
"No information command selected !");
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
PHPDBG_COMMAND(break) /* {{{ */
|
PHPDBG_COMMAND(break) /* {{{ */
|
||||||
{
|
{
|
||||||
switch (param->type) {
|
switch (param->type) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ PHPDBG_COMMAND(until);
|
||||||
PHPDBG_COMMAND(finish);
|
PHPDBG_COMMAND(finish);
|
||||||
PHPDBG_COMMAND(leave);
|
PHPDBG_COMMAND(leave);
|
||||||
PHPDBG_COMMAND(frame);
|
PHPDBG_COMMAND(frame);
|
||||||
|
PHPDBG_COMMAND(set);
|
||||||
PHPDBG_COMMAND(print);
|
PHPDBG_COMMAND(print);
|
||||||
PHPDBG_COMMAND(break);
|
PHPDBG_COMMAND(break);
|
||||||
PHPDBG_COMMAND(back);
|
PHPDBG_COMMAND(back);
|
||||||
|
|
|
@ -70,7 +70,7 @@ int phpdbg_print(int TSRMLS_DC, FILE*, const char*, ...) PHP_ATTRIBUTE_FORMAT(pr
|
||||||
#define EMPTY "" /* }}} */
|
#define EMPTY "" /* }}} */
|
||||||
|
|
||||||
/* {{{ For prompt lines */
|
/* {{{ For prompt lines */
|
||||||
#define PROMPT ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;64mphpdbg>\033[0m " : "phpdbg> ") /* }}} */
|
#define PROMPT ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;64mphpdbg>\033[0m" : "phpdbg>") /* }}} */
|
||||||
|
|
||||||
/* {{{ For separation */
|
/* {{{ For separation */
|
||||||
#define SEPARATE "------------------------------------------------" /* }}} */
|
#define SEPARATE "------------------------------------------------" /* }}} */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue