]> granicus.if.org Git - php/commitdiff
add highlight param to file listing
authorkrakjoe <joe.watkins@live.co.uk>
Sun, 17 Nov 2013 11:11:09 +0000 (11:11 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Sun, 17 Nov 2013 11:11:09 +0000 (11:11 +0000)
phpdbg_list.c
phpdbg_list.h
phpdbg_prompt.c

index a778f640b15913363585921f65b4a5e2ec24dd61..ba1e31e43e2ca81282abc5ccc01d5ba2a9bc01fa 100644 (file)
@@ -38,8 +38,8 @@ PHPDBG_LIST(lines) /* {{{ */
            case EMPTY_PARAM: {
                if (PHPDBG_G(exec) || zend_is_executing(TSRMLS_C)) {
                    if (param->type == EMPTY_PARAM) {
-                       phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0 TSRMLS_CC);
-                   } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0 TSRMLS_CC);
+                       phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0, 0 TSRMLS_CC);
+                   } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0, 0 TSRMLS_CC);
                } else phpdbg_error("Not executing, and execution context not set");
            } break;
            
@@ -106,7 +106,7 @@ PHPDBG_LIST(class) /* {{{ */
                         phpdbg_list_file(
                             (*ce)->info.user.filename,
                             (*ce)->info.user.line_end - (*ce)->info.user.line_start + 1,
-                            (*ce)->info.user.line_start TSRMLS_CC
+                            (*ce)->info.user.line_start, 0 TSRMLS_CC
                         );
                     } else {
                         phpdbg_error("The source of the requested class (%s) cannot be found", (*ce)->name);
@@ -125,7 +125,7 @@ PHPDBG_LIST(class) /* {{{ */
     return SUCCESS;
 } /* }}} */
 
-void phpdbg_list_file(const char *filename, long count, long offset TSRMLS_DC) /* {{{ */
+void phpdbg_list_file(const char *filename, long count, long offset, int highlight TSRMLS_DC) /* {{{ */
 {
        unsigned char *mem, *pos, *last_pos, *end_pos;
        struct stat st;
@@ -185,7 +185,13 @@ void phpdbg_list_file(const char *filename, long count, long offset TSRMLS_DC) /
 
                if (!offset || offset <= line) {
                        /* Without offset, or offset reached */
-                       phpdbg_writeln("%05u: %.*s", line, (int)(pos - last_pos), last_pos);
+                       if (!highlight) {
+                           phpdbg_writeln("%05u: %.*s", line, (int)(pos - last_pos), last_pos);
+                       } else {
+                           if (highlight != line) {
+                               phpdbg_writeln(" %05u: %.*s", line, (int)(pos - last_pos), last_pos);
+                           } else phpdbg_writeln(">%05u: %.*s", line, (int)(pos - last_pos), last_pos);
+                       }
                        ++displayed;
                }
 
@@ -220,7 +226,7 @@ void phpdbg_list_function(const zend_function *fbc TSRMLS_DC) /* {{{ */
        ops = (zend_op_array*)fbc;
 
        phpdbg_list_file(ops->filename,
-               ops->line_end - ops->line_start + 1, ops->line_start TSRMLS_CC);
+               ops->line_end - ops->line_start + 1, ops->line_start, 0 TSRMLS_CC);
 } /* }}} */
 
 void phpdbg_list_function_byname(const char *str, size_t len TSRMLS_DC)
index 5c7e9885ebfdd81d7e64eea63629929c36da12fa..0d869a94d7c0a2b4733e53c9be60e2de0e4c9b2d 100644 (file)
@@ -41,7 +41,7 @@ PHPDBG_LIST(func);
 
 void phpdbg_list_function_byname(const char *, size_t TSRMLS_DC);
 void phpdbg_list_function(const zend_function* TSRMLS_DC);
-void phpdbg_list_file(const char*, long, long TSRMLS_DC);
+void phpdbg_list_file(const char*, long, long, int TSRMLS_DC);
 
 static const phpdbg_command_t phpdbg_list_commands[] = {
     PHPDBG_LIST_EX_D(lines,     "lists the specified lines", 'l'),
index 0281fd7ec6d8bbf5902280d20690c1b1567b0ec9..d68933be3aaa4969cb7f8ca8a5114365529d5780 100644 (file)
@@ -698,13 +698,13 @@ static PHPDBG_COMMAND(list) /* {{{ */
            case EMPTY_PARAM: {
                if (PHPDBG_G(exec) || zend_is_executing(TSRMLS_C)) {
                    if (param->type == EMPTY_PARAM) {
-                       phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0 TSRMLS_CC);
-                   } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0 TSRMLS_CC);
+                       phpdbg_list_file(phpdbg_current_file(TSRMLS_C), 0, 0, 0 TSRMLS_CC);
+                   } else phpdbg_list_file(phpdbg_current_file(TSRMLS_C), param->num, 0, 0 TSRMLS_CC);
                } else phpdbg_error("Not executing, and execution context not set");
            } break;
            
                case FILE_PARAM:
-                       phpdbg_list_file(param->file.name, param->file.line, 0 TSRMLS_CC);
+                       phpdbg_list_file(param->file.name, param->file.line, 0, 0 TSRMLS_CC);
                        break;
                        
                case STR_PARAM: {
@@ -1013,7 +1013,8 @@ zend_vm_enter:
 #define DO_INTERACTIVE() do {\
     phpdbg_list_file(\
         zend_get_executed_filename(TSRMLS_C), \
-        2, \
+        3, \
+        zend_get_executed_lineno(TSRMLS_C)-1, \
         zend_get_executed_lineno(TSRMLS_C) \
         TSRMLS_CC\
     );\