From 52040263083b1ab748d850d0a614b8b8bd62ffc4 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Tue, 12 Nov 2013 23:54:41 +0000 Subject: [PATCH] housework --- phpdbg.h | 13 ------------- phpdbg_bp.c | 8 ++++---- phpdbg_help.c | 6 ++++++ phpdbg_prompt.c | 6 +++--- phpdbg_utils.h | 5 +++-- 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/phpdbg.h b/phpdbg.h index 9826c8bb94..063cce1f9a 100644 --- a/phpdbg.h +++ b/phpdbg.h @@ -101,17 +101,4 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg) zend_ulong flags; /* phpdbg flags */ ZEND_END_MODULE_GLOBALS(phpdbg) -/* {{{ colourful helpers */ -#define PHPDBG_RED_LINE(TSRMLS_D) \ - ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;31m[" : "[") -#define PHPDBG_BOLD_LINE(TSRMLS_D) \ - ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;64m[" : "[") -#define PHPDBG_END_LINE(TSRMLS_D) \ - ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "]\033[0m" : "]") -#define PHPDBG_PROMPT_LINE(TSRMLS_D) \ - ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;64mphpdbg>\033[0m " : "phpdbg> ") -#define PHPDBG_SEP_LINE(TSRMLS_D) do {\ - printf("%s--------------------------------------%s\n", PHPDBG_BOLD_LINE(TSRMLS_C), PHPDBG_END_LINE(TSRMLS_C));\ - } while(0) /* }}} */ - #endif /* PHPDBG_H */ diff --git a/phpdbg_bp.c b/phpdbg_bp.c index 45ecbc5def..b4defa1e70 100644 --- a/phpdbg_bp.c +++ b/phpdbg_bp.c @@ -286,7 +286,7 @@ void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */ HashPosition position; phpdbg_breaksymbol_t *brake; - PHPDBG_SEP_LINE(TSRMLS_C); + phpdbg_writeln(SEPARATE); phpdbg_writeln("Function Breakpoints:"); for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], &position); zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], (void**) &brake, &position) == SUCCESS; @@ -303,7 +303,7 @@ void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */ zend_uint class_len = 0; zend_ulong class_idx = 0L; - PHPDBG_SEP_LINE(TSRMLS_C); + phpdbg_writeln(SEPARATE); phpdbg_writeln("Method Breakpoints:"); for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], &position[0]); zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], (void**) &class_table, &position[0]) == SUCCESS; @@ -330,7 +330,7 @@ void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */ HashPosition position; zend_llist *points; - PHPDBG_SEP_LINE(TSRMLS_C); + phpdbg_writeln(SEPARATE); phpdbg_writeln("File Breakpoints:"); for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position); zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], (void**) &points, &position) == SUCCESS; @@ -350,7 +350,7 @@ void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */ HashPosition position; phpdbg_breakline_t *brake; - PHPDBG_SEP_LINE(TSRMLS_C); + phpdbg_writeln(SEPARATE); phpdbg_writeln("Opline Breakpoints:"); for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], &position); zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (void**) &brake, &position) == SUCCESS; diff --git a/phpdbg_help.c b/phpdbg_help.c index b49f45ac1e..575061955b 100644 --- a/phpdbg_help.c +++ b/phpdbg_help.c @@ -34,9 +34,11 @@ PHPDBG_HELP(exec) /* {{{ */ PHPDBG_HELP(step) /* {{{ */ { phpdbg_writeln("You can enable and disable stepping at any phpdbg prompt during execution"); + phpdbg_writeln(EMPTY); phpdbg_writeln("For example:"); phpdbg_writeln("\t%sstepping 1", PROMPT); phpdbg_writeln("Will enable stepping"); + phpdbg_writeln(EMPTY); phpdbg_writeln("While stepping is enabled you are presented with a prompt after the execution of each opcode"); return SUCCESS; } /* }}} */ @@ -125,6 +127,7 @@ PHPDBG_HELP(clear) /* {{{ */ PHPDBG_HELP(quiet) /* {{{ */ { phpdbg_writeln("Setting quietness on will stop the OPLINE output during execution"); + phpdbg_writeln(EMPTY); phpdbg_writeln("For example:"); phpdbg_writeln("\t%squiet 1", PROMPT); phpdbg_writeln("Will silence OPLINE output, while"); @@ -136,6 +139,7 @@ PHPDBG_HELP(quiet) /* {{{ */ PHPDBG_HELP(back) /* {{{ */ { phpdbg_writeln("The backtrace is gathered with the default debug_backtrace functionality."); + phpdbg_writeln(EMPTY); phpdbg_writeln("You can set the limit on the trace, for example:"); phpdbg_writeln("\t%sback 5", PROMPT); phpdbg_writeln("Will limit the number of frames to 5, the default is no limit"); @@ -145,12 +149,14 @@ PHPDBG_HELP(back) /* {{{ */ PHPDBG_HELP(list) /* {{{ */ { phpdbg_writeln("The list command displays N line from current context file."); + phpdbg_writeln(EMPTY); phpdbg_writeln("\t%slist 2", PROMPT); phpdbg_writeln("Will print next 2 lines from the current file"); phpdbg_writeln("\t%slist func", PROMPT); phpdbg_writeln("Will print the source of the global function \"func\""); phpdbg_writeln("\t%slist .mine", PROMPT); phpdbg_writeln("Will print the source of the class method \"mine\""); + phpdbg_writeln(EMPTY); phpdbg_writeln("Note: before listing functions you must have a populated function table, try compile !!"); return SUCCESS; } /* }}} */ diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index fe1c326086..f221b581ea 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -214,7 +214,7 @@ static PHPDBG_COMMAND(print) /* {{{ */ return SUCCESS; } - PHPDBG_SEP_LINE(TSRMLS_C); + phpdbg_writeln(SEPARATE); phpdbg_notice("Execution Context Information:"); #ifdef HAVE_LIBREADLINE phpdbg_writeln("Readline\tyes"); @@ -249,7 +249,7 @@ static PHPDBG_COMMAND(print) /* {{{ */ phpdbg_print_breakpoints(PHPDBG_BREAK_METHOD TSRMLS_CC); phpdbg_print_breakpoints(PHPDBG_BREAK_OPLINE TSRMLS_CC); - PHPDBG_SEP_LINE(TSRMLS_C); + phpdbg_writeln(SEPARATE); return SUCCESS; } /* }}} */ @@ -553,7 +553,7 @@ phpdbg_interactive_enter: phpdbg_interactive_enter: while (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { - cmd = readline(PHPDBG_PROMPT_LINE(TSRMLS_C)); + cmd = readline(PROMPT); cmd_len = strlen(cmd); #endif diff --git a/phpdbg_utils.h b/phpdbg_utils.h index e51462c797..7682201493 100644 --- a/phpdbg_utils.h +++ b/phpdbg_utils.h @@ -20,8 +20,6 @@ #ifndef PHPDBG_UTILS_H #define PHPDBG_UTILS_H -#include "TSRM.h" - /** * Input scan functions */ @@ -53,4 +51,7 @@ void phpdbg_print(int TSRMLS_DC, const char*, ...); /* {{{ For prompt lines */ #define PROMPT ((PHPDBG_G(flags) & PHPDBG_IS_COLOURED) ? "\033[1;64mphpdbg>\033[0m " : "phpdbg> ") /* }}} */ +/* {{{ For separation */ +#define SEPARATE "------------------------------------------------" /* }}} */ + #endif /* PHPDBG_UTILS_H */ -- 2.40.0