com php-src: ...: phpdbg.c phpdbg.h phpdbg_help.c phpdbg _help.h phpdbg_prompt.c
| From: | Bob Weinand | Date: | Sun, 10 Nov 2013 11:03:29 +0000 |
| Subject: | com php-src: ...: phpdbg.c phpdbg.h phpdbg_help.c phpdbg _help.h phpdbg_prompt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75229@lists.php.net to get a copy of this message | ||
Commit: 6df19b3aa25b4384ab806841ebbafa8f4fe95962
Author: krakjoe <joe.watkins@live.co.uk> Sun, 10 Nov 2013 11:03:29 +0000
Parents: ad3aa32a2f3c4b13135cabdcc8605bf9f3409f16
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6df19b3aa25b4384ab806841ebbafa8f4fe95962
Log:
..
Changed paths:
M phpdbg..c
M phpdbg.h
M phpdbg_help.c
M phpdbg_help.h
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index b5ba10a..88d6ead 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -20,7 +20,9 @@
ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
-static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) {}
+static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) {
+ pg->exec = NULL;
+}
static PHP_MINIT_FUNCTION(phpdbg) {
ZEND_INIT_MODULE_GLOBALS(phpdbg, php_phpdbg_globals_ctor, NULL);
@@ -40,6 +42,9 @@ static PHP_RINIT_FUNCTION(phpdbg) {
static PHP_RSHUTDOWN_FUNCTION(phpdbg) {
zend_hash_destroy(&PHPDBG_G(breaks));
+ if (PHPDBG_G(exec)) {
+ efree(PHPDBG_G(exec));
+ }
}
static zend_module_entry sapi_phpdbg_module_entry = {
diff --git a/phpdbg.h b/phpdbg.h
index 4a40c72..94ee720 100644
--- a/phpdbg.h
+++ b/phpdbg.h
@@ -38,6 +38,8 @@
ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
HashTable breaks;
+ char *exec; /* file to execute */
+ size_t exec_len; /* size of exec */
ZEND_END_MODULE_GLOBALS(phpdbg)
#include "phpdbg_prompt.h"
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 5cb2d20..586cd68 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -23,6 +23,13 @@
#include "phpdbg.h"
#include "phpdbg_help.h"
+PHPDBG_HELP(exec) /* {{{ */
+{
+ printf("doing exec help: %s\n", expr);
+
+ return SUCCESS;
+} /* }}} */
+
PHPDBG_HELP(print) /* {{{ */
{
printf("doing print help: %s\n", expr);
diff --git a/phpdbg_help.h b/phpdbg_help.h
index f2a2e2d..b3dfb22 100644
--- a/phpdbg_help.h
+++ b/phpdbg_help.h
@@ -31,6 +31,7 @@
/**
* Helper Forward Declarations
*/
+PHPDBG_HELP(exec);
PHPDBG_HELP(print);
PHPDBG_HELP(brake);
@@ -38,6 +39,7 @@ PHPDBG_HELP(brake);
* Commands
*/
static const phpdbg_command_t phpdbg_help_commands[] = {
+ PHPDBG_HELP_D(exec, "the execution context should be a valid phpdbg path"),
PHPDBG_HELP_D(print, "printing allows inspection of the execution environment"),
PHPDBG_HELP_D(brake, "brake points allow execution interruption"),
{NULL, 0, 0}
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index be33353..6fc59a0 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -25,9 +25,26 @@
static const phpdbg_command_t phpdbg_prompt_commands[];
-static PHPDBG_COMMAND(print) { /* {{{ */
- printf("%s", expr);
+ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
+
+static PHPDBG_COMMAND(exec) { /* {{{ */
+ if (PHPDBG_G(exec)) {
+ printf(
+ "Unsetting old execution context: %s\n", PHPDBG_G(exec));
+ efree(PHPDBG_G(exec));
+ }
+ PHPDBG_G(exec) = estrndup(
+ expr, PHPDBG_G(exec_len)=expr_len);
+
+ printf(
+ "Set execution context: %s\n", PHPDBG_G(exec));
+} /* }}} */
+
+static PHPDBG_COMMAND(print) { /* {{{ */
+ printf(
+ "%s\n", expr);
+
return SUCCESS;
} /* }}} */
@@ -75,7 +92,8 @@ static PHPDBG_COMMAND(help) /* {{{ */
return SUCCESS;
} /* }}} */
-static const phpdbg_command_t phpdbg_prompt_commands[] = {
+static const phpdbg_command_t phpdbg_prompt_commands[] = {
+ PHPDBG_COMMAND_D(exec, "set execution context"),
PHPDBG_COMMAND_D(print, "print something"),
PHPDBG_COMMAND_D(brake, "set brake point"),
PHPDBG_COMMAND_D(help, "show help menu"),