[PHP-CVS] com php-src: better way to detect leave/finish: phpdbg.c phpdbg.h phpdbg_prompt.c

2013-12-21 Thread Bob Weinand
Commit:775376b362dfb9e9d0bf29dcd4cd2a2155117398
Author:krakjoe joe.watk...@live.co.uk Mon, 18 Nov 2013 03:18:37 
+
Parents:   8ada4342a47170a38799282919714997d3771c06
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=775376b362dfb9e9d0bf29dcd4cd2a2155117398

Log:
better way to detect leave/finish

Changed paths:
  M  phpdbg.c
  M  phpdbg.h
  M  phpdbg_prompt.c


Diff:
diff --git a/phpdbg.c b/phpdbg.c
index ec8d267..e542906 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -101,7 +101,7 @@ static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
 zend_hash_init(PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0);
 zend_hash_init(PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], 8, NULL, 
php_phpdbg_destroy_bp_methods, 0);
 zend_hash_init(PHPDBG_G(bp)[PHPDBG_BREAK_COND], 8, NULL, 
php_phpdbg_destroy_bp_condition, 0);
-
+   zend_hash_init(PHPDBG_G(seek), 8, NULL, NULL, 0);
return SUCCESS;
 } /* }}} */
 
@@ -112,7 +112,8 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
 zend_hash_destroy(PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE]);
 zend_hash_destroy(PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]);
 zend_hash_destroy(PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
-
+   zend_hash_destroy(PHPDBG_G(seek));
+   
 if (PHPDBG_G(exec)) {
 efree(PHPDBG_G(exec));
 PHPDBG_G(exec) = NULL;
diff --git a/phpdbg.h b/phpdbg.h
index 0416b93..a12e03b 100644
--- a/phpdbg.h
+++ b/phpdbg.h
@@ -118,7 +118,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
phpdbg_param_t   *lparam;   /* last param */
zend_ulong flags;   /* phpdbg flags */
FILE *oplog;/* opline log */
-   zend_ulong seek;/* seek opline 
*/
+   HashTable seek; /* seek oplines 
*/
 ZEND_END_MODULE_GLOBALS(phpdbg)
 /* }}} */
 
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 7f976bf..a36cb24 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -309,7 +309,11 @@ static PHPDBG_COMMAND(until) /* {{{ */

for (next = self; next  EG(active_op_array)-last; next++) {
if (EG(active_op_array)-opcodes[next].lineno != 
opline-lineno) {
-   PHPDBG_G(seek) = (zend_ulong) 
EG(active_op_array)-opcodes[next];
+   zend_hash_index_update(
+   PHPDBG_G(seek), 
+   (zend_ulong) 
EG(active_op_array)-opcodes[next], 
+   EG(active_op_array)-opcodes[next],
+   sizeof(zend_op), NULL);
break;
}
}
@@ -332,8 +336,15 @@ static PHPDBG_COMMAND(finish) /* {{{ */
zend_op  *opline = EG(active_op_array)-opcodes[self];

for (next = self; next  EG(active_op_array)-last; next++) {
-   if (EG(active_op_array)-opcodes[next].opcode == 
ZEND_RETURN) {
-   PHPDBG_G(seek) = (zend_ulong) 
EG(active_op_array)-opcodes[next];
+   switch (EG(active_op_array)-opcodes[next].opcode) {
+   case ZEND_RETURN:
+   case ZEND_THROW:
+   case ZEND_EXIT:
+   zend_hash_index_update(
+   PHPDBG_G(seek), 
+   (zend_ulong) 
EG(active_op_array)-opcodes[next], 
+   
EG(active_op_array)-opcodes[next],
+   sizeof(zend_op), NULL);
break;
}
}
@@ -356,8 +367,15 @@ static PHPDBG_COMMAND(leave) /* {{{ */
zend_op  *opline = EG(active_op_array)-opcodes[self];

for (next = self; next  EG(active_op_array)-last; next++) {
-   if (EG(active_op_array)-opcodes[next].opcode == 
ZEND_RETURN) {
-   PHPDBG_G(seek) = (zend_ulong) 
EG(active_op_array)-opcodes[next];
+   switch (EG(active_op_array)-opcodes[next].opcode) {
+   case ZEND_RETURN:
+   case ZEND_THROW:
+   case ZEND_EXIT:
+   zend_hash_index_update(
+   PHPDBG_G(seek), 
+   (zend_ulong) 
EG(active_op_array)-opcodes[next], 
+   
EG(active_op_array)-opcodes[next],
+   sizeof(zend_op), NULL);
break;
}
}
@@ -397,8 +415,10 @@ static 

[PHP-CVS] com php-src: class printer: phpdbg_opcode.c phpdbg_print.c phpdbg_prompt.c phpdbg_utils.c test.php

2013-12-21 Thread Bob Weinand
Commit:68cff82d8bd6b046cbac556136b88dd76d6a116b
Author:krakjoe joe.watk...@live.co.uk Wed, 13 Nov 2013 01:35:39 
+
Parents:   43c2748dced2a77b34c09c15e403c6970b74e2b2
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=68cff82d8bd6b046cbac556136b88dd76d6a116b

Log:
class printer

Changed paths:
  M  phpdbg_opcode.c
  M  phpdbg_print.c
  M  phpdbg_prompt.c
  M  phpdbg_utils.c
  M  test.php


Diff:
diff --git a/phpdbg_opcode.c b/phpdbg_opcode.c
index 5796678..39a5169 100644
--- a/phpdbg_opcode.c
+++ b/phpdbg_opcode.c
@@ -191,6 +191,7 @@ const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ 
*/
CASE(ZEND_RECV_VARIADIC);
 #endif
CASE(ZEND_OP_DATA);
-   default: return UNKNOWN;
+   default: 
+   return UNKNOWN;
}
 } /* }}} */
diff --git a/phpdbg_print.c b/phpdbg_print.c
index c0d8fb4..f5cbbd3 100644
--- a/phpdbg_print.c
+++ b/phpdbg_print.c
@@ -20,6 +20,7 @@
 #include phpdbg.h
 #include phpdbg_print.h
 #include phpdbg_utils.h
+#include phpdbg_opcode.h
 
 ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
 
@@ -41,7 +42,59 @@ PHPDBG_PRINT(class) /* {{{ */
 
if (expr  expr_len  0L) {
if (zend_lookup_class(expr, strlen(expr), ce TSRMLS_CC) == 
SUCCESS) {
+   phpdbg_notice(
+   %s %s: %s, 
+   ((*ce)-type == ZEND_USER_CLASS) ? 
+   User : Internal,
+   ((*ce)-ce_flags  ZEND_ACC_INTERFACE) ? 
+   Interface :
+   ((*ce)-ce_flags  ZEND_ACC_ABSTRACT) ?
+   Abstract Class :
+   Class, 
+   (*ce)-name);

+   phpdbg_writeln(Methods (%d):, 
zend_hash_num_elements((*ce)-function_table));
+   if (zend_hash_num_elements((*ce)-function_table)) {
+   HashPosition position;
+   zend_function *method;
+   
+   for 
(zend_hash_internal_pointer_reset_ex((*ce)-function_table, position);
+zend_hash_get_current_data_ex((*ce)-function_table, 
(void**) method, position) == SUCCESS;
+zend_hash_move_forward_ex((*ce)-function_table, 
position)) {
+switch (method-type) {
+   case ZEND_USER_FUNCTION: {
+   zend_op_array* op_array = method-op_array;
+   
+if (op_array) {
+zend_op *opline = op_array-opcodes[0];
+zend_uint   opcode = 0,
+end =  op_array-last-1;
+
+ phpdbg_writeln(
+\t%s::%s() in %s:%d-%d, 
+(*ce)-name, method-common.function_name,
+op_array-filename ? op_array-filename : 
unknown,
+op_array-line_start, op_array-line_end);
+
+do {
+char *decode = 
phpdbg_decode_opcode(opline-opcode);
+if (decode != NULL) {
+phpdbg_writeln(
+\t\t%p:%s, opline, decode); 
+} else phpdbg_error(\tFailed to decode 
opline @ %ld, opline);
+
+opline++;
+} while (++opcode  end);
+}  
+   } break;
+   
+   default: {
+   phpdbg_writeln(
+   \tInternal Method %s::%s(), (*ce)-name, 
method-common.function_name);
+   }
+}
+   }
+   }
} else {
phpdbg_error(Cannot find class %s/%lu, expr, expr_len);
}
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index f7cba8c..d2cd8be 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -547,7 +547,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */
 
 phpdbg_interactive_enter:
 phpdbg_write(PROMPT);
-
+
while (!(PHPDBG_G(flags)  PHPDBG_IS_QUITTING) 
   fgets(cmd, PHPDBG_MAX_CMD, stdin) != NULL) {
cmd_len = strlen(cmd) - 1;
diff --git a/phpdbg_utils.c b/phpdbg_utils.c
index 27ada70..3c8606c 100644
--- a/phpdbg_utils.c
+++ b/phpdbg_utils.c
@@ -23,6 +23,7 @@
 #include php.h
 #include spprintf.h
 #include phpdbg.h
+#include phpdbg_opcode.h
 #include phpdbg_utils.h
 
 ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
diff --git a/test.php b/test.php
index 457e487..0f240e1 100644
--- a/test.php
+++ b/test.php
@@ 

[PHP-CVS] com php-src: Merge branch 'master' of https://github.com/krakjoe/phpdbg: phpdbg_cmd.c phpdbg_prompt.c phpdbg_utils.c

2013-12-21 Thread Bob Weinand
Commit:64194ef6523ed307ecbf74a39c0cd3e50eb64855
Author:krakjoe joe.watk...@live.co.uk Mon, 9 Dec 2013 09:35:54 
+
Parents:   12d071fa7c94c7edafd56499443a26cd8716cc6b 
b35f6ee7234af7a4872b434875de8d761b09ebe9
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=64194ef6523ed307ecbf74a39c0cd3e50eb64855

Log:
Merge branch 'master' of https://github.com/krakjoe/phpdbg

Changed paths:
  MM  phpdbg_cmd.c
  MM  phpdbg_prompt.c
  MM  phpdbg_utils.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: fix windows build warning: phpdbg_info.c

2013-12-21 Thread Bob Weinand
Commit:682164ae992c50fc075fad294de040fb60ff6529
Author:krakjoe joe.watk...@live.co.uk Sun, 24 Nov 2013 12:17:51 
+
Parents:   d9c94663c1abed95074b5004fe75aef0ee756bab
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=682164ae992c50fc075fad294de040fb60ff6529

Log:
fix windows build warning

Changed paths:
  M  phpdbg_info.c


Diff:
diff --git a/phpdbg_info.c b/phpdbg_info.c
index 724b30c..d665f92 100644
--- a/phpdbg_info.c
+++ b/phpdbg_info.c
@@ -151,8 +151,7 @@ PHPDBG_INFO(literal) /* {{{ */
 {
if ((EG(in_execution)  EG(active_op_array)) || PHPDBG_G(ops)) {
zend_op_array *ops = EG(active_op_array) ? EG(active_op_array) 
: PHPDBG_G(ops);
-   unsigned int literal = 0;
-   int count = ops-last_literal-1;
+   int literal = 0, count = ops-last_literal-1;
 
if (ops-function_name) {
if (ops-scope) {


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: - Fix valgrind reports + CS: phpdbg.c phpdbg_list.c phpdbg_print.c

2013-12-21 Thread Bob Weinand
Commit:89514066787a1201bc4c4474cf78f21225ca412c
Author:Felipe Pena felipe...@gmail.com Mon, 18 Nov 2013 19:55:29 
-0200
Parents:   a1156cae5cd5e334a4225debfdf6141d97dd96ec
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=89514066787a1201bc4c4474cf78f21225ca412c

Log:
- Fix valgrind reports + CS

Changed paths:
  M  phpdbg.c
  M  phpdbg_list.c
  M  phpdbg_print.c


Diff:
diff --git a/phpdbg.c b/phpdbg.c
index eaa626d..6659075 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -41,6 +41,7 @@ static inline void 
php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
 pg-lcmd = NULL;
 pg-flags = PHPDBG_DEFAULT_FLAGS;
 pg-oplog = NULL;
+memset(pg-lparam, 0, sizeof(phpdbg_param_t));
 } /* }}} */
 
 static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
@@ -94,14 +95,14 @@ static void php_phpdbg_destroy_bp_condition(void *data) /* 
{{{ */
 } /* }}} */
 
 static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
-{  
+{
zend_hash_init(PHPDBG_G(bp)[PHPDBG_BREAK_FILE],   8, NULL, 
php_phpdbg_destroy_bp_file, 0);
zend_hash_init(PHPDBG_G(bp)[PHPDBG_BREAK_SYM], 8, NULL, 
php_phpdbg_destroy_bp_symbol, 0);
 zend_hash_init(PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0);
 zend_hash_init(PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], 8, NULL, 
php_phpdbg_destroy_bp_methods, 0);
 zend_hash_init(PHPDBG_G(bp)[PHPDBG_BREAK_COND], 8, NULL, 
php_phpdbg_destroy_bp_condition, 0);
zend_hash_init(PHPDBG_G(seek), 8, NULL, NULL, 0);
-   
+
return SUCCESS;
 } /* }}} */
 
@@ -113,7 +114,7 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
 zend_hash_destroy(PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]);
 zend_hash_destroy(PHPDBG_G(bp)[PHPDBG_BREAK_COND]);
zend_hash_destroy(PHPDBG_G(seek));
-   
+
 if (PHPDBG_G(exec)) {
 efree(PHPDBG_G(exec));
 PHPDBG_G(exec) = NULL;
diff --git a/phpdbg_list.c b/phpdbg_list.c
index dcce374..241983d 100644
--- a/phpdbg_list.c
+++ b/phpdbg_list.c
@@ -153,7 +153,7 @@ void phpdbg_list_file(const char *filename, long count, 
long offset, int highlig
return;
}
 
-   last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+   pos = last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 
0);
end_pos = mem + st.st_size;
 #else
 
@@ -170,7 +170,7 @@ void phpdbg_list_file(const char *filename, long count, 
long offset, int highlig
return;
}
 
-   last_pos = mem = (char*) MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
+   pos = last_pos = mem = (char*) MapViewOfFile(map, FILE_MAP_READ, 0, 0, 
0);
if (mem == NULL) {
phpdbg_error(Failed to map file in memory);
CloseHandle(map);
diff --git a/phpdbg_print.c b/phpdbg_print.c
index 606e091..f3821be 100644
--- a/phpdbg_print.c
+++ b/phpdbg_print.c
@@ -37,7 +37,8 @@ PHPDBG_PRINT(opline) /* {{{ */
return SUCCESS;
 } /* }}} */
 
-static inline void phpdbg_print_function_helper(zend_function *method 
TSRMLS_DC) {
+static inline void phpdbg_print_function_helper(zend_function *method 
TSRMLS_DC) /* {{{ */
+{
 switch (method-type) {
 case ZEND_USER_FUNCTION: {
 zend_op_array* op_array = method-op_array;
@@ -85,7 +86,7 @@ static inline void phpdbg_print_function_helper(zend_function 
*method TSRMLS_DC)
 }
 }
  }
-}
+} /* }}} */
 
 PHPDBG_PRINT(exec) /* {{{ */
 {


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: correction to aliases: phpdbg_help.h

2013-12-21 Thread Bob Weinand
Commit:e02c26d1f502a28103e1b2367547ed188c5ab4c5
Author:krakjoe joe.watk...@live.co.uk Mon, 18 Nov 2013 14:51:08 
+
Parents:   93c5968e72660d281a3869a0746c0c6009bc2b2b
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e02c26d1f502a28103e1b2367547ed188c5ab4c5

Log:
correction to aliases

Changed paths:
  M  phpdbg_help.h


Diff:
diff --git a/phpdbg_help.h b/phpdbg_help.h
index 400d200..89de11b 100644
--- a/phpdbg_help.h
+++ b/phpdbg_help.h
@@ -68,7 +68,7 @@ static const phpdbg_command_t phpdbg_help_commands[] = {
PHPDBG_COMMAND_D_EX(clear,reset breakpoints to execute without 
interruption,   'c', help_clear,   
NULL, 0),
PHPDBG_COMMAND_D_EX(info, quick access to useful information on 
the console,   'i', help_info,NULL, 0),
PHPDBG_COMMAND_D_EX(back, show debug backtrace information during 
execution,   't', help_back,NULL, 0),
-PHPDBG_COMMAND_D_EX(quiet,be quiet during execution, 
  's', help_quiet,   NULL, 0),
+PHPDBG_COMMAND_D_EX(quiet,be quiet during execution, 
  'Q', help_quiet,   NULL, 0),
PHPDBG_COMMAND_D_EX(list, list code gives you quick access to 
code,'l', help_list,   
 NULL, 0),
PHPDBG_COMMAND_D_EX(oplog,keep clutter off the screen by logging 
oplines,  'O', help_oplog,   NULL, 0),
PHPDBG_COMMAND_D_EX(shell,execute system commands with direct 
shell access,
'-', help_shell,   NULL, 0),


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Export conditional breaks: phpdbg_bp.c

2013-12-21 Thread Bob Weinand
Commit:485966252a200f53704e9156fff5f816798ef465
Author:Bob Weinand bobw...@hotmail.com Tue, 26 Nov 2013 09:21:04 
+0100
Parents:   bc7df607ab2d7771a3c2226b46598645e67e053f
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=485966252a200f53704e9156fff5f816798ef465

Log:
Export conditional breaks

Changed paths:
  M  phpdbg_bp.c


Diff:
diff --git a/phpdbg_bp.c b/phpdbg_bp.c
index 40a3a50..3fe4169 100644
--- a/phpdbg_bp.c
+++ b/phpdbg_bp.c
@@ -59,8 +59,8 @@ PHPDBG_API void phpdbg_export_breakpoints(FILE *handle 
TSRMLS_DC) /* {{{ */
zend_hash_move_forward_ex(table, position)) {
 
zend_llist_position lposition;
-phpdbg_breakfile_t *brake;
-   zend_ulong count = zend_llist_count(brakes);
+   phpdbg_breakfile_t *brake;
+   int count = zend_llist_count(brakes);
 
if ((brake = zend_llist_get_first_ex(brakes, 
lposition))) {
phpdbg_notice(
@@ -134,8 +134,22 @@ PHPDBG_API void phpdbg_export_breakpoints(FILE *handle 
TSRMLS_DC) /* {{{ */
}
}
 
-   /* export other types here after resolving errors from source command */
+   if (PHPDBG_G(flags)  PHPDBG_HAS_COND_BP) {
+   phpdbg_breakcond_t *brake;
+
+   table = PHPDBG_G(bp)[PHPDBG_BREAK_COND];
+
+   phpdbg_notice(
+   Exporting conditional breakpoints (%d), 
zend_hash_num_elements(table));
+
+   for (zend_hash_internal_pointer_reset_ex(table, position);
+   zend_hash_get_current_data_ex(table, (void**) brake, 
position) == SUCCESS;
+   zend_hash_move_forward_ex(table, position)) {
 
+   fprintf(
+   handle, break on %s\n, Z_STRVAL(brake-code));
+   }
+   }
 } /* }}} */
 
 PHPDBG_API void phpdbg_set_breakpoint_file(const char *path, long line_num 
TSRMLS_DC) /* {{{ */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: fix eval for new input handling: phpdbg_prompt.c

2013-12-21 Thread Bob Weinand
Commit:e71766273077cff6bb8836a37e0d199f4564c612
Author:krakjoe joe.watk...@live.co.uk Wed, 20 Nov 2013 14:25:15 
+
Parents:   4f5c7a963c2f653e45ed6d8de390ac228c28138d
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e71766273077cff6bb8836a37e0d199f4564c612

Log:
fix eval for new input handling

Changed paths:
  M  phpdbg_prompt.c


Diff:
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 10fb60a..c69c056 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -514,12 +514,26 @@ static PHPDBG_COMMAND(eval) /* {{{ */
case STR_PARAM: {
zend_bool stepping = (PHPDBG_G(flags)  
PHPDBG_IS_STEPPING);
zval retval;
-
+   char *code = NULL;
+   
PHPDBG_G(flags) = ~ PHPDBG_IS_STEPPING;
 
+   if (input  input-start) {
+   code = (char*) input-start;
+   
+   if (memcmp(
+   code, eval, sizeof(eval)-1) == 
SUCCESS) {
+   code += sizeof(eval)-1;
+   } else code += sizeof(E)-1;
+   
+   while (code  isspace(*code)) {
+   code++;
+   }
+   } else code = param-str;
+   
/* disable stepping while eval() in progress */
PHPDBG_G(flags) |= PHPDBG_IN_EVAL;
-   if (zend_eval_stringl(param-str, param-len,
+   if (zend_eval_stringl(code, strlen(code),
retval, eval()'d code TSRMLS_CC) == SUCCESS) 
{
zend_print_zval_r(
retval, 0 TSRMLS_CC);


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: - Fix code: phpdbg_opcode.c

2013-12-21 Thread Bob Weinand
Commit:ac0ecc476c6b5a562b98026acc76390c2597392b
Author:Felipe Pena felipe...@gmail.com Sun, 10 Nov 2013 19:00:58 
-0200
Parents:   52f9c52475bdcdece80e05105ca44779cbcf7607
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=ac0ecc476c6b5a562b98026acc76390c2597392b

Log:
- Fix code

Changed paths:
  M  phpdbg_opcode.c


Diff:
diff --git a/phpdbg_opcode.c b/phpdbg_opcode.c
index 60d4075..5796678 100644
--- a/phpdbg_opcode.c
+++ b/phpdbg_opcode.c
@@ -18,11 +18,12 @@
 */
 
 #include zend_vm_opcodes.h
+#include zend_compile.h
 #include phpdbg_opcode.h
 
 const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */
 {
-#define CASE(s) return #s
+#define CASE(s) case s: return #s
switch (opcode) {
CASE(ZEND_NOP);
CASE(ZEND_ADD);


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Small bug fix on error: phpdbg_bp.c phpdbg_bp.h

2013-12-21 Thread Bob Weinand
Commit:24585722b1a9acd87387285a301a6c5e084d21bc
Author:Bob Weinand bobw...@hotmail.com Thu, 28 Nov 2013 22:03:59 
+0100
Parents:   d7f6e884932423662aaf319bced391c91c76cb48
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=24585722b1a9acd87387285a301a6c5e084d21bc

Log:
Small bug fix on error

Changed paths:
  M  phpdbg_bp.c
  M  phpdbg_bp.h


Diff:
diff --git a/phpdbg_bp.c b/phpdbg_bp.c
index 22d376e..11f2754 100644
--- a/phpdbg_bp.c
+++ b/phpdbg_bp.c
@@ -319,10 +319,11 @@ PHPDBG_API void phpdbg_set_breakpoint_opline(zend_ulong 
opline TSRMLS_DC) /* {{{
}
} while (--i);
 
-   if (!branch ||
+   if (i ||
(zend_ulong)(branch-op_array + branch-op_array-last) = 
opline ||
(opline - (zend_ulong)branch-op_array) % sizeof(zend_op)  
0) {
phpdbg_error(No opline could be found at 0x%lx, 
opline);
+   return;
}
 
opline_break.opline = (opline - (zend_ulong)branch-op_array) / 
sizeof(zend_op);
@@ -379,7 +380,7 @@ PHPDBG_API void phpdbg_set_breakpoint_opline(zend_ulong 
opline TSRMLS_DC) /* {{{
}
 } /* }}} */
 
-PHPDBG_API void phpdbg_resolve_op_array_break(phpdbg_breakopline_t *brake, 
zend_op_array *op_array TSRMLS_DC) {
+PHPDBG_API int phpdbg_resolve_op_array_break(phpdbg_breakopline_t *brake, 
zend_op_array *op_array TSRMLS_DC) {
phpdbg_breakline_t opline_break;
if (op_array-last  brake-opline) {
if (brake-class_name == NULL) {
@@ -387,6 +388,8 @@ PHPDBG_API void 
phpdbg_resolve_op_array_break(phpdbg_breakopline_t *brake, zend_
} else {
phpdbg_error(There are only %d oplines in method 
%s::%s (breaking at opline %d impossible), op_array-last, brake-class_name, 
brake-func_name, brake-opline);
}
+
+   return FAILURE;
}
 
opline_break.id = brake-id;
@@ -396,6 +399,8 @@ PHPDBG_API void 
phpdbg_resolve_op_array_break(phpdbg_breakopline_t *brake, zend_
PHPDBG_G(flags) |= PHPDBG_HAS_OPLINE_BP;
 
zend_hash_index_update(PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 
opline_break.opline, opline_break, sizeof(phpdbg_breakline_t), NULL);
+
+   return SUCCESS;
 }
 
 PHPDBG_API void phpdbg_resolve_op_array_breaks(zend_op_array *op_array 
TSRMLS_DC) {
@@ -416,9 +421,7 @@ PHPDBG_API void 
phpdbg_resolve_op_array_breaks(zend_op_array *op_array TSRMLS_DC
for (zend_hash_internal_pointer_reset_ex(oplines_table, position);
 zend_hash_get_current_data_ex(oplines_table, (void**) brake, 
position) == SUCCESS;
 zend_hash_move_forward_ex(oplines_table, position)) {
-   zend_try {
-   phpdbg_resolve_op_array_break(brake, op_array 
TSRMLS_CC);
-   } zend_end_try();
+   phpdbg_resolve_op_array_break(brake, op_array TSRMLS_CC);
}
 }
 
@@ -447,9 +450,12 @@ PHPDBG_API int 
phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break TSRML
} else {
phpdbg_error(%s::%s is not an user defined method, no 
oplines exist, new_break-class_name, new_break-func_name);
}
+   return 2;
}
 
-   phpdbg_resolve_op_array_break(new_break, func-op_array TSRMLS_CC);
+   if (phpdbg_resolve_op_array_break(new_break, func-op_array TSRMLS_CC) 
== FAILURE) {
+   return 2;
+   }
 
return SUCCESS;
 }
@@ -467,10 +473,17 @@ PHPDBG_API void phpdbg_set_breakpoint_method_opline(const 
char *class, const cha
new_break.opline = opline;
new_break.id = PHPDBG_G(bp_count)++;
 
-   if (phpdbg_resolve_opline_break(new_break TSRMLS_CC) == FAILURE) {
-   phpdbg_notice(Pending breakpoint #%d at %s::%s:%d, 
new_break.id, new_break.class_name, new_break.func_name, opline);
-   } else {
-   phpdbg_notice(Breakpoint #%d added at %s::%s:%d, 
new_break.id, new_break.class_name, new_break.func_name, opline);
+   switch (phpdbg_resolve_opline_break(new_break TSRMLS_CC)) {
+   case FAILURE:
+   phpdbg_notice(Pending breakpoint #%d at %s::%s:%d, 
new_break.id, new_break.class_name, new_break.func_name, opline);
+   break;
+
+   case SUCCESS:
+   phpdbg_notice(Breakpoint #%d added at %s::%s:%d, 
new_break.id, new_break.class_name, new_break.func_name, opline);
+   break;
+
+   case 2:
+   return;
}
 
if (zend_hash_find(PHPDBG_G(bp)[PHPDBG_BREAK_METHOD_OPLINE], 
new_break.class_name, new_break.class_len, (void **)class_table) == FAILURE) {
@@ -512,10 +525,17 @@ PHPDBG_API void 
phpdbg_set_breakpoint_function_opline(const char *function, int
new_break.opline = opline;
new_break.id = PHPDBG_G(bp_count)++;
 
-   if 

[PHP-CVS] com php-src: another tut: tutorials/simples.md

2013-12-21 Thread Bob Weinand
Commit:e0c4f87a897e005f5927baa8a747e6266d052813
Author:krakjoe joe.watk...@live.co.uk Fri, 22 Nov 2013 13:49:35 
+
Parents:   4fd2edbeb42b842d0c7cdb00363c7b09aa89b906
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e0c4f87a897e005f5927baa8a747e6266d052813

Log:
another tut

Changed paths:
  A  tutorials/simples.md


Diff:
diff --git a/tutorials/simples.md b/tutorials/simples.md
new file mode 100644
index 000..d8b53d6
--- /dev/null
+++ b/tutorials/simples.md
@@ -0,0 +1,132 @@
+Simples
+===
+*Everything is simple ...*
+
+It is easy to imagine that debugging a whole web application might be 
difficult, in a console program, in fact this is not the case:
+ 
+A web application is just an instance of the PHP interpreter with some very 
specific super globals set.
+
+With everything in the correct place, your web application has no clue that it 
being served not to a client, but to you, probably in your underwear.
+
+With the facts established, you can use phpdbg to debug anything that is PHP, 
with a bit of cleverness in the right places.
+
+Very Simple
+===
+*A good starting place ...*
+
+``` 
+phpdbg -e/path/to/my/script.php
+```
+
+The command above will result in a phpdbg console that has executed 
*.phpdbginit* (if it exists) and is ready to compile, inspect, step through
+and execute the code contained in */path/to/my/script.php*
+
+The first thing to do upon being presented with the console, is decide what to 
break for ...
+
+Many options exist for choosing (and setting) breakpoints:
+
+```
+phpdbg b phpdbg::isGreat
+phpdbg b phpdbg_is_great
+```
+
+The commands above will be the most common for most developers; that is, 
specifying the entry point of a function or method on which to break execution.
+
+Introspection of code is supported on the console, for anything that is 
compiled, if help is required remembering the name of a particular method then 
issue:
+
+```
+phpdbg compile
+phpdbg print class myClassName
+```
+
+Introspection doesn't only provide you with names, but the addresses of every 
opcode in every statement, which you may use to specify with as much precision 
as 
+is possible where to break execution.
+
+**There is a print command for particular methods, useful if a class is very 
large and your screen is not !**
+
+At this point, break points are set; the next thing to do is issue the run 
command:
+
+```
+phpdbg run
+```
+
+This will cause execution of the context, if a breakpoint is reached, the 
interactive console returns such that more commands can be issued.
+
+When a breakpoint is reached, several options for continuation exist:
+
+ - step through every instruction
+ - run past the end of the stack
+ - run to the end of the stack
+
+*Q: WTF is a stack?*
+
+*A: Generally the current codepath, more precisely: current function, method 
or file*
+
+Just quickly; an explanation of what to and past the end of a stack 
means:
+
+Assuming there is a break set for *my_function_somewhere* in the following 
code:
+
+```
+function my_function_somewhere($input = array()) /* break here on entry to the 
function */
+{  
+   /* ... the stack ... */
+   
+   if (count($input)) 
+   {
+   /* to - */ return $input[1];
+   } 
+   else
+   {
+   /* to - */ return rand(1, 100);
+   }
+}
+
+/* past - */ $result = my_function_somewhere();
+if ($result) 
+{
+   /* and so on */
+   var_dump($result);
+}
+```
+
+The commands *finish* and *leave*, run *past* and *to* the end of the stack 
respecitively.
+
+**Note: the finish command does not automatically break; to break past the end 
of the stack enable stepping before issuing finish, the leave command breaks 
implicitly**
+
+On with execution ...
+=
+*Stepping, slowly, is sometimes the way forward ...*
+
+Should you want to inspect what happens during the execution of the stack, 
enable stepping:
+
+```
+phpdbg step 1
+```
+
+In case it wasn't obvious, the next thing to do is nearly always *next*:
+
+```
+phpdbg next
+```
+
+Which will cause the vm to assume control and continue execution until the 
next break point, or completion.
+
+Stepping through every single instruction is not usually beneficial, issue:
+
+```
+phpdbg step 0
+```
+
+To disable stepping again, and only interrupt execution for breakpoints.
+
+As hard as it gets ...
+==
+*Web Applications*
+
+As mentioned, a web application is only a script executing with some specific 
super globals set; 
+
+**The mocking of any web request just requires that you set the super globals 
of the script accordingly**
+
+We refer to this as bootstrapping, mostly because I have always wanted a 
genuine reason to use that word.
+
+See the example, for help with bootstrapping ...


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: ...: README.md

2013-12-21 Thread Bob Weinand
Commit:a6864679a2866e69a3659e29e9b112353764560d
Author:krakjoe joe.watk...@live.co.uk Sun, 10 Nov 2013 23:38:55 
+
Parents:   4f5096af3ceaf5670050353fc8a41d164b8b058b
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a6864679a2866e69a3659e29e9b112353764560d

Log:
...

Changed paths:
  M  README.md


Diff:
diff --git a/README.md b/README.md
index a15e556..78d811f 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,16 @@ make -j8
 make install-phpdbg
 ```
 
+Command Line Options
+
+
+The following switches are implemented (just like cli SAPI):
+
+ - -n ignore php ini
+ - -c search for php ini in path
+ - -z load zend extension
+ - -d define php ini entry
+
 Screeny
 ===


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: - Fix conflict: phpdbg_prompt.c test.php

2013-12-21 Thread Bob Weinand
Commit:33098232dc27c4f22dd38d17268fd59a64b1d000
Author:Felipe Pena felipe...@gmail.com Sun, 17 Nov 2013 14:13:13 
-0200
Parents:   478446b665acb80411b0c7dee417962e88848842 
02e3718ef907c3d6063ea746e5a1fd1047ded7bc
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=33098232dc27c4f22dd38d17268fd59a64b1d000

Log:
- Fix conflict

Changed paths:
  MM  phpdbg_prompt.c
  MM  test.php


Diff:
diff --cc test.php
index fab577b,d11310b..dc1ecdb
--- a/test.php
+++ b/test.php
@@@ -1,5 -1,7 +1,8 @@@
  ?php
 +
+ if (isset($include))
 -  include (sprintf(%s/web-bootstrap.php, dirname(__FILE__))); 
++  include (sprintf(%s/web-bootstrap.php, dirname(__FILE__)));
+ 
  class phpdbg {
  public function isGreat($greeting = null) {
  printf(


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: debugging new input stuff: phpdbg_cmd.c phpdbg_cmd.h phpdbg_prompt.c

2013-12-21 Thread Bob Weinand
Commit:5af371409cb361dc0ce452212b0b4020a7d36f46
Author:krakjoe joe.watk...@live.co.uk Tue, 19 Nov 2013 20:27:23 
+
Parents:   1a2618b229f03247bb2006a272598d9a7ec66994
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5af371409cb361dc0ce452212b0b4020a7d36f46

Log:
debugging new input stuff

Changed paths:
  M  phpdbg_cmd.c
  M  phpdbg_cmd.h
  M  phpdbg_prompt.c


Diff:
diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c
index 227e659..8eb38d7 100644
--- a/phpdbg_cmd.c
+++ b/phpdbg_cmd.c
@@ -137,7 +137,8 @@ static inline phpdbg_input_t** phpdbg_read_argv(char 
*buffer, int *argc TSRMLS_D
phpdbg_input_t *arg = emalloc(sizeof(phpdbg_input_t));\
 if (arg) {\
b[l]=0;\
-   arg-string = estrndup(b, l);\
+   arg-length = l;\
+   arg-string = estrndup(b, arg-length);\
arg-argv=NULL;\
arg-argc=0;\
argv = (phpdbg_input_t**) erealloc(argv, sizeof(phpdbg_input_t*) * 
((*argc)+1));\
@@ -319,6 +320,52 @@ void phpdbg_destroy_input(phpdbg_input_t **input 
TSRMLS_DC) /*{{{ */
}
 } /* }}} */
 
+int phpdbg_do_cmd_ex(const phpdbg_command_t *command, phpdbg_input_t *input 
TSRMLS_DC) /* {{{ */
+{
+   int rc = FAILURE;
+
+   if (input-argc  0) {
+   while (command  command-name  command-handler) {
+   if (((command-name_len == input-argv[0]-length)  
+   (memcmp(command-name, input-argv[0]-string, 
command-name_len) == SUCCESS)) ||
+   (command-alias 
+   (input-argv[0]-length == 1)  
+   (command-alias == *input-argv[0]-string))) {
+   if (command-subs  input-argc  1) {
+   phpdbg_input_t sub;
+   
+   sub.argc = input-argc-1;
+   sub.argv = input-argv[1];
+   
+   return phpdbg_do_cmd_ex(command-subs, 
sub TSRMLS_CC);
+   }
+   
+   phpdbg_debug(
+   found command %s for %s with %d 
arguments, 
+   command-name, input-argv[0]-string, 
input-argc-1);
+   {
+   int arg;
+   for (arg=1; arginput-argc; arg++) {
+   phpdbg_debug(
+   \t#%d: [%s=%d], 
+   arg, 
+   
input-argv[arg]-string,
+   
input-argv[arg]-length);
+   }
+   }
+   break;
+   }
+   command++;
+   }
+   } else {
+   /* this should NEVER happen */
+   phpdbg_error(
+   No function executed !!);
+   }
+   
+   return rc;
+} /* }}} */
+
 int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t 
cmd_len TSRMLS_DC) /* {{{ */
 {
int rc = FAILURE;
diff --git a/phpdbg_cmd.h b/phpdbg_cmd.h
index a8865ce..47ada44 100644
--- a/phpdbg_cmd.h
+++ b/phpdbg_cmd.h
@@ -88,6 +88,7 @@ struct _phpdbg_command_t {
  * Command Executor
  */
 phpdbg_input_t* phpdbg_read_input(TSRMLS_D);
+int phpdbg_do_cmd_ex(const phpdbg_command_t*, phpdbg_input_t *input TSRMLS_DC);
 int phpdbg_do_cmd(const phpdbg_command_t*, char*, size_t TSRMLS_DC);
 phpdbg_param_type phpdbg_parse_param(const char*, size_t, phpdbg_param_t* 
TSRMLS_DC);
 void phpdbg_clear_param(phpdbg_param_t* TSRMLS_DC);
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index d5b4bda..bb7dc00 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -973,6 +973,8 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */

if (input  input-length  0L) {
do {
+   phpdbg_do_cmd_ex(phpdbg_prompt_commands, input 
TSRMLS_CC);
+   
switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, 
input-string, input-length TSRMLS_CC)) {
case FAILURE:
if (!(PHPDBG_G(flags)  
PHPDBG_IS_QUITTING)) {


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'master' of https://github.com/krakjoe/phpdbg: phpdbg_prompt.c

2013-12-21 Thread Bob Weinand
Commit:403072e488e1b8e6b6faa70e99801edaee2dc3ad
Author:krakjoe joe.watk...@live.co.uk Sat, 16 Nov 2013 11:12:22 
+
Parents:   19ada893cbe55edc148021951413db87ebccfb44 
0629f32afcaaed5f10aa45feb76deca86f0f6135
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=403072e488e1b8e6b6faa70e99801edaee2dc3ad

Log:
Merge branch 'master' of https://github.com/krakjoe/phpdbg

Changed paths:
  MM  phpdbg_prompt.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: - WS changes: phpdbg_help.c

2013-12-21 Thread Bob Weinand
Commit:8532076c6465e73e7b437f43601c43a70560bf85
Author:Felipe Pena felipe...@gmail.com Sun, 10 Nov 2013 14:16:52 
-0200
Parents:   c060093acf5f1732938dc06eae0c76d39d375827
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=8532076c6465e73e7b437f43601c43a70560bf85

Log:
- WS changes

Changed paths:
  M  phpdbg_help.c


Diff:
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 916764d..978f7ae 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -25,12 +25,13 @@
 
 PHPDBG_HELP(exec) /* {{{ */
 {
-  printf(Will attempt execution, if compilation has not yet taken place, it 
occurs now.\n);
-  printf(The execution context must be set before execution can take 
place\n);
-  return SUCCESS;
+   printf(Will attempt execution, if compilation has not yet taken place, 
it occurs now.\n);
+   printf(The execution context must be set before execution can take 
place\n);
+   return SUCCESS;
 } /* }}} */
 
-PHPDBG_HELP(step) { /* {{{ */
+PHPDBG_HELP(step) /* {{{ */
+{
 printf(You can enable and disable stepping at any phpdbg prompt during 
execution\n);
 printf(For example:\n);
 printf(\tphpdbg stepping 1\n);
@@ -39,68 +40,68 @@ PHPDBG_HELP(step) { /* {{{ */
 return SUCCESS;
 } /* }}} */
 
-PHPDBG_HELP(next) { /* {{{ */
-printf(While stepping through execution, use the next command to step 
back into the vm and execute the next opcode);
-return SUCCESS;
+PHPDBG_HELP(next) /* {{{ */
+{
+   printf(While stepping through execution, use the next command to step 
back into the vm and execute the next opcode);
+   return SUCCESS;
 } /* }}} */
 
 PHPDBG_HELP(compile) /* {{{ */
 {
-  printf(Pre-compilation of the execution context provides the opportunity to 
inspect the opcodes before they are executed\n);
-  printf(The execution context must be set for compilation to succeed\n);
-  printf(If errors occur during compilation they must be resolved before 
execution can take place.\n);
-  printf(You do not need to exit phpdbg to retry compilation\n);
-  return SUCCESS;
+   printf(Pre-compilation of the execution context provides the 
opportunity to inspect the opcodes before they are executed\n);
+   printf(The execution context must be set for compilation to 
succeed\n);
+   printf(If errors occur during compilation they must be resolved before 
execution can take place.\n);
+   printf(You do not need to exit phpdbg to retry compilation\n);
+   return SUCCESS;
 } /* }}} */
 
 PHPDBG_HELP(print) /* {{{ */
 {
-printf(By default, print will show information about the current 
execution environment\n);
-printf(To show specific information pass an expression to print, for 
example:\n);
-printf(\tphpdbg print opcodes[0]\n);
-printf(Will show the opline @ 0\n);
-printf(Available print commands:\n);
-printf(\tNone\n);
-
-return SUCCESS;
+   printf(By default, print will show information about the current 
execution environment\n);
+   printf(To show specific information pass an expression to print, for 
example:\n);
+   printf(\tphpdbg print opcodes[0]\n);
+   printf(Will show the opline @ 0\n);
+   printf(Available print commands:\n);
+   printf(\tNone\n);
+   return SUCCESS;
 } /* }}} */
 
-PHPDBG_HELP(run) /* {{{ */ 
+PHPDBG_HELP(run) /* {{{ */
 {
-printf(Run the code inside the debug vm, you should have break points and 
variables set before running\n);
-printf(The execution context must not be set, but not necessarily 
compiled before execution occurs\n);
-return SUCCESS;
+   printf(Run the code inside the debug vm, you should have break points 
and variables set before running\n);
+   printf(The execution context must not be set, but not necessarily 
compiled before execution occurs\n);
+   return SUCCESS;
 } /* }}} */
 
 PHPDBG_HELP(eval) /* {{{ */
 {
-printf(Access to eval() allows you to change the environment during 
execution, careful though !!);
-return SUCCESS;
+   printf(Access to eval() allows you to change the environment during 
execution, careful though !!);
+   return SUCCESS;
 } /* }}} */
 
 PHPDBG_HELP(break) /* {{{ */
 {
-printf(Setting a breakpoint stops execution at a specific stage, the 
syntax is:\n);
-printf(\tfile:line\n);
-printf([more to come]\n);
-printf(For example:\n);
-printf(\tphpdbg break test.php:1\n);
-printf(Will break execution on line 1 of test.php\n);
-  
-return SUCCESS;
+   printf(Setting a breakpoint stops execution at a specific stage, the 
syntax is:\n);
+   printf(\tfile:line\n);
+   printf([more to come]\n);
+   printf(For example:\n);
+   printf(\tphpdbg break test.php:1\n);
+   printf(Will break execution on line 1 of test.php\n);
+   return SUCCESS;
 } /* }}} */
 
 PHPDBG_HELP(cont) /* {{{ */
 {
-printf(Continues execution after a breakpoint is met\n);
-printf([Warnings about using stepping and break points here]\n);
-

[PHP-CVS] com php-src: update image: tutorials/phpdbg.png

2013-12-21 Thread Bob Weinand
Commit:04149df4895ba821a3988a645d2e13a186e419d8
Author:krakjoe joe.watk...@live.co.uk Thu, 14 Nov 2013 21:18:12 
+
Parents:   4c62cc97e49e70f0740b55e67b6d77494d130664
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=04149df4895ba821a3988a645d2e13a186e419d8

Log:
update image

Changed paths:
  M  tutorials/phpdbg.png


Diff:
diff --git a/tutorials/phpdbg.png b/tutorials/phpdbg.png
index 5260d4d..7c41c89 100644
Binary files a/tutorials/phpdbg.png and b/tutorials/phpdbg.png differ


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'master' of https://github.com/krakjoe/phpdbg: phpdbg_prompt.c

2013-12-21 Thread Bob Weinand
Commit:1b41ab2e343467e6373025bdc782e251ea406f3e
Author:krakjoe joe.watk...@live.co.uk Sun, 10 Nov 2013 15:16:54 
+
Parents:   2f9b34d4b639b79a82d75f4ed509bfbc0e72e9de 
a6d573cd895847e42010f55a2e0211a6bd566f1e
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=1b41ab2e343467e6373025bdc782e251ea406f3e

Log:
Merge branch 'master' of https://github.com/krakjoe/phpdbg

Changed paths:
  MM  phpdbg_prompt.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: compress text/tidy up: phpdbg_help.c phpdbg_help.h phpdbg_prompt.c

2013-12-21 Thread Bob Weinand
Commit:8588f5cc84b7b69ad7231b2c987e2626a32e59b1
Author:krakjoe joe.watk...@live.co.uk Mon, 18 Nov 2013 13:23:28 
+
Parents:   a1478217ce6f9c64f40c316500aaf56cf938f431
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=8588f5cc84b7b69ad7231b2c987e2626a32e59b1

Log:
compress text/tidy up

Changed paths:
  M  phpdbg_help.c
  M  phpdbg_help.h
  M  phpdbg_prompt.c


Diff:
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 7bd2e95..75b6cb7 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -103,8 +103,8 @@ PHPDBG_HELP(compile) /* {{{ */
 PHPDBG_HELP(print) /* {{{ */
 {
 phpdbg_help_header();
-   phpdbg_writeln(By default, print will show information about the 
current execution environment);
-   phpdbg_writeln(Other printing commands give access to address, file 
and line information);
+   phpdbg_writeln(By default, print will show information about the 
current execution context);
+   phpdbg_writeln(Other printing commands give access to instruction 
information);
phpdbg_writeln(EMPTY);
phpdbg_writeln(Examples:);
phpdbg_writeln(\t%sprint class \\my\\class, PROMPT);
diff --git a/phpdbg_help.h b/phpdbg_help.h
index a54c43a..400d200 100644
--- a/phpdbg_help.h
+++ b/phpdbg_help.h
@@ -54,23 +54,23 @@ PHPDBG_HELP(shell);
  */
 static const phpdbg_command_t phpdbg_help_commands[] = {
PHPDBG_COMMAND_D_EX(exec, the execution context should be a valid 
path,'e', help_exec,NULL, 0),
-   PHPDBG_COMMAND_D_EX(compile,  pre-compilation allows inspection of 
code before execution,  'c', help_compile, NULL, 0),
+   PHPDBG_COMMAND_D_EX(compile,  allow inspection of code before 
execution,   'c', 
help_compile, NULL, 0),
PHPDBG_COMMAND_D_EX(step, step through execution to break at every 
opcode, 's', 
help_step,NULL, 0),
PHPDBG_COMMAND_D_EX(next, continue executing while stepping or 
after breaking, 'n', help_next,NULL, 0),
PHPDBG_COMMAND_D_EX(run,  execute inside the phpdbg vm,   

 'r', help_run, NULL, 0),
-   PHPDBG_COMMAND_D_EX(eval, access to eval() allows you to affect 
the environment during execution,  'E', help_eval,NULL, 0),
+   PHPDBG_COMMAND_D_EX(eval, access to eval() allows affecting the 
environment,   'E', help_eval,
NULL, 0),
PHPDBG_COMMAND_D_EX(until,continue until the current line is 
executed, 
'u', help_until,   NULL, 0),
PHPDBG_COMMAND_D_EX(finish,   continue until the current function has 
returned,'f', help_finish,  NULL, 0),
PHPDBG_COMMAND_D_EX(leave,continue until the current function is 
returning,'L', help_leave,   NULL, 0),
-   PHPDBG_COMMAND_D_EX(print,printing allows inspection of the 
execution environment, 'p', help_print,   NULL, 0),
+   PHPDBG_COMMAND_D_EX(print,print context information or 
instructions,   'p', 
help_print,   NULL, 0),
PHPDBG_COMMAND_D_EX(break,breakpoints allow execution 
interruption,'b', help_break,   NULL, 
0),
-   PHPDBG_COMMAND_D_EX(clean,resetting the environment is useful 
while debugging and recompiling, 'X', help_clean,   NULL, 0),
-   PHPDBG_COMMAND_D_EX(clear,clearing breakpoints allows you to run 
code without interruption,'c', help_clear,   NULL, 0),
+   PHPDBG_COMMAND_D_EX(clean,resetting the environment is useful 
while debugging, 'X', help_clean,  
 NULL, 0),
+   PHPDBG_COMMAND_D_EX(clear,reset breakpoints to execute without 
interruption,   'c', help_clear,   
NULL, 0),
PHPDBG_COMMAND_D_EX(info, quick access to useful information on 
the console,   'i', help_info,NULL, 0),
PHPDBG_COMMAND_D_EX(back, show debug backtrace information during 
execution,   't', help_back,NULL, 0),
 PHPDBG_COMMAND_D_EX(quiet,be quiet during execution, 
  's', help_quiet,   NULL, 0),
-   PHPDBG_COMMAND_D_EX(list, listing code gives you quick access to 
code while executing, 'l', help_list,NULL, 0),
-   PHPDBG_COMMAND_D_EX(oplog,keep clutter off the screen by sending 
oplogs to a file, 'O', help_oplog,   NULL, 0),
+   

[PHP-CVS] com php-src: Fixed file opline num resolving: phpdbg_bp.c

2013-12-21 Thread Bob Weinand
Commit:3ffb4aaf9ba018192c8eadf3c72ddee619ac9165
Author:Bob Weinand bobw...@hotmail.com Tue, 3 Dec 2013 16:10:57 
+0100
Parents:   76f889569f029c9fe15d87a0b80db07e483b0cf1
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=3ffb4aaf9ba018192c8eadf3c72ddee619ac9165

Log:
Fixed file opline num resolving

Changed paths:
  M  phpdbg_bp.c


Diff:
diff --git a/phpdbg_bp.c b/phpdbg_bp.c
index a7be7eb..4f6b79e 100644
--- a/phpdbg_bp.c
+++ b/phpdbg_bp.c
@@ -445,8 +445,28 @@ PHPDBG_API int 
phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break TSRML
zend_function *func;
 
if (new_break-func_name == NULL) {
-   /* no idea yet ...; currently only settable before including of 
file */
-   return FAILURE;
+   if (EG(current_execute_data) == NULL) {
+   if (PHPDBG_G(ops) != NULL  
!memcmp(PHPDBG_G(ops)-filename, new_break-class_name, new_break-class_len)) {
+   if (phpdbg_resolve_op_array_break(new_break, 
PHPDBG_G(ops) TSRMLS_CC) == SUCCESS) {
+   return SUCCESS;
+   } else {
+   return 2;
+   }
+   }
+   return FAILURE;
+   } else {
+   zend_execute_data *execute_data = 
EG(current_execute_data);
+   do {
+   if (execute_data-op_array-function_name == 
NULL  execute_data-op_array-scope == NULL  
!memcmp(execute_data-op_array-filename, new_break-class_name, 
new_break-class_len)) {
+   if 
(phpdbg_resolve_op_array_break(new_break, execute_data-op_array TSRMLS_CC) == 
SUCCESS) {
+   return SUCCESS;
+   } else {
+   return 2;
+   }
+   }
+   } while ((execute_data = 
execute_data-prev_execute_data) != NULL);
+   return FAILURE;
+   }
}
 
if (new_break-class_name != NULL) {
@@ -624,7 +644,7 @@ PHPDBG_API void phpdbg_set_breakpoint_file_opline(const 
char *file, int opline T
return;
}
 
-   PHPDBG_G(flags) |= PHPDBG_HAS_FUNCTION_OPLINE_BP;
+   PHPDBG_G(flags) |= PHPDBG_HAS_FILE_OPLINE_BP;
 
zend_hash_index_update(file_table, new_break.opline, new_break, 
sizeof(phpdbg_breakopline_t), NULL);
 }


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: ...: tutorials/show-printing.png

2013-12-21 Thread Bob Weinand
Commit:7928d1f9e2bae63a4c8dae282cac100e78e83daa
Author:krakjoe joe.watk...@live.co.uk Wed, 13 Nov 2013 10:16:09 
+
Parents:   ae683043e2a05cedaddd624279559b20e3fe45ed
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=7928d1f9e2bae63a4c8dae282cac100e78e83daa

Log:
...

Changed paths:
  M  tutorials/show-printing.png


Diff:
diff --git a/tutorials/show-printing.png b/tutorials/show-printing.png
index cc409bc..6ea55f3 100644
Binary files a/tutorials/show-printing.png and b/tutorials/show-printing.png 
differ


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Tiny whitespace fix in makefile (aligning with other Installing messages): Makefile.frag

2013-12-21 Thread Bob Weinand
Commit:baceff6ad4bad3f13426be01db2971294dfe703f
Author:Bob Weinand bobw...@hotmail.com Mon, 9 Dec 2013 19:58:19 
+0100
Parents:   2fa3479df5d63236e79abb55ca932c435dfa5291
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=baceff6ad4bad3f13426be01db2971294dfe703f

Log:
Tiny whitespace fix in makefile (aligning with other Installing messages)

Changed paths:
  M  Makefile.frag


Diff:
diff --git a/Makefile.frag b/Makefile.frag
index 8a9528b..5be6d5b 100644
--- a/Makefile.frag
+++ b/Makefile.frag
@@ -9,7 +9,7 @@ $(BUILD_BINARY): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) 
$(PHP_PHPDBG_OBJS)
$(BUILD_PHPDBG)
 
 install-phpdbg: $(BUILD_BINARY)
-   @echo Installing phpdbg binary:$(INSTALL_ROOT)$(bindir)/
+   @echo Installing phpdbg binary: $(INSTALL_ROOT)$(bindir)/
@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
@$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/log
@$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/run


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: change version for release: phpdbg.h

2013-12-21 Thread Bob Weinand
Commit:e7fa292493dbcb251dce2a7463d5f1c80f5232ad
Author:krakjoe joe.watk...@live.co.uk Sat, 23 Nov 2013 18:40:28 
+
Parents:   cafafb0e011983543f03851ba16b2eaf61b95631
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=e7fa292493dbcb251dce2a7463d5f1c80f5232ad

Log:
change version for release

Changed paths:
  M  phpdbg.h


Diff:
diff --git a/phpdbg.h b/phpdbg.h
index 8a1b814..f412f50 100644
--- a/phpdbg.h
+++ b/phpdbg.h
@@ -118,7 +118,7 @@
 
 /* {{{ strings */
 #define PHPDBG_ISSUES http://github.com/krakjoe/phpdbg/issues;
-#define PHPDBG_VERSION 0.1.0-dev /* }}} */
+#define PHPDBG_VERSION 0.1.0 /* }}} */
 
 /* {{{ output descriptors */
 #define PHPDBG_STDIN   0


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'master' of https://github.com/krakjoe/phpdbg: phpdbg_prompt.c

2013-12-21 Thread Bob Weinand
Commit:22d85c6a637f07d6c7866773a6978c9d3906c592
Author:krakjoe joe.watk...@live.co.uk Sun, 10 Nov 2013 16:05:23 
+
Parents:   2f4acda67b9fd7659b8424345789f90061c141a8 
53f4201566c813740e62cf37588b4daa23503f89
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=22d85c6a637f07d6c7866773a6978c9d3906c592

Log:
Merge branch 'master' of https://github.com/krakjoe/phpdbg

Changed paths:
  MM  phpdbg_prompt.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: fix test: tests/commands/0105_clear.test

2013-12-21 Thread Bob Weinand
Commit:cbaf610ee410e05ee2ec3a83007074f17c5c63ae
Author:krakjoe joe.watk...@live.co.uk Mon, 9 Dec 2013 09:43:26 
+
Parents:   64194ef6523ed307ecbf74a39c0cd3e50eb64855
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=cbaf610ee410e05ee2ec3a83007074f17c5c63ae

Log:
fix test

Changed paths:
  M  tests/commands/0105_clear.test


Diff:
diff --git a/tests/commands/0105_clear.test b/tests/commands/0105_clear.test
index 1ac3c3b..b547b0d 100644
--- a/tests/commands/0105_clear.test
+++ b/tests/commands/0105_clear.test
@@ -5,11 +5,14 @@
 # options: -rr
 #
 #[Clearing Breakpoints]
-#File  0
-#Functions 0
-#Methods   0
-#Oplines   0
-#Conditionals  0
+#File%w%d
+#Functions%w%d
+#Methods%w%d
+#Oplines%w%d
+#File oplines%w%d
+#Function oplines%w%d
+#Method oplines%w%d
+#Conditionals%w%d
 #
 clear
 quit


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Added breaking upon fatal-ish error: phpdbg.c

2013-12-21 Thread Bob Weinand
Commit:20318c49606274c87005b89f5f3a52e484cd760e
Author:Bob Weinand bobw...@hotmail.com Sat, 21 Dec 2013 22:42:11 
+0100
Parents:   ef3e0119b8437c855049ee3a67b0317dce055669
Branches:  PHP-5.6

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=20318c49606274c87005b89f5f3a52e484cd760e

Log:
Added breaking upon fatal-ish error

Changed paths:
  M  phpdbg.c


Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 17193ed..4b75ce2 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -438,6 +438,35 @@ static void php_sapi_phpdbg_log_message(char *message 
TSRMLS_DC) /* {{{ */
*/
if (phpdbg_booted) {
phpdbg_error(%s, message);
+
+   switch (PG(last_error_type)) {
+   case E_ERROR:
+   case E_CORE_ERROR:
+   case E_COMPILE_ERROR:
+   case E_USER_ERROR:
+   case E_PARSE:
+   case E_RECOVERABLE_ERROR:
+   if (!(PHPDBG_G(flags)  PHPDBG_IN_EVAL)) {
+   phpdbg_list_file(
+   
zend_get_executed_filename(TSRMLS_C),
+   3,
+   
zend_get_executed_lineno(TSRMLS_C)-1,
+   
zend_get_executed_lineno(TSRMLS_C)
+   TSRMLS_CC
+   );
+   }
+
+   do {
+   switch (phpdbg_interactive(TSRMLS_C)) {
+   case PHPDBG_LEAVE:
+   case PHPDBG_FINISH:
+   case PHPDBG_UNTIL:
+   case PHPDBG_NEXT:
+   return;
+   }
+   } while (!(PHPDBG_G(flags)  
PHPDBG_IS_QUITTING));
+
+   }
} else fprintf(stdout, %s\n, message);
 }
 /* }}} */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php