]> granicus.if.org Git - php/commitdiff
introduce proper support for file:#opline
authorkrakjoe <joe.watkins@live.co.uk>
Fri, 21 Feb 2014 18:01:50 +0000 (18:01 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Fri, 21 Feb 2014 18:01:50 +0000 (18:01 +0000)
dev/phpdbg_parser.y
phpdbg_break.c
phpdbg_break.h
phpdbg_cmd.c
phpdbg_cmd.h
phpdbg_help.c
phpdbg_parser.c
phpdbg_prompt.c

index 8155f67043047270d2b96596cd7b720e2c0ea436..57184ca91971ca4ffcf11537319fa0ab899b865a 100644 (file)
@@ -86,6 +86,11 @@ parameter
                $$.file.name = $1.str;
                $$.file.line = $3.num;
        }
+       | T_ID T_COLON T_POUND T_DIGITS {
+               $$.type = NUMERIC_FILE_PARAM;
+               $$.file.name = $1.str;
+               $$.file.line = $4.num;
+       }
        | T_ID T_DCOLON T_ID                                    { 
                $$.type = METHOD_PARAM;
                $$.method.class = $1.str;
index b83bdffe3436a157e9f5825cdcaf729c7606de4a..79091d27e67457bda126e8f15e5255abfd63da55 100644 (file)
@@ -35,19 +35,11 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
  * Commands
  */
 const phpdbg_command_t phpdbg_break_commands[] = {
-       PHPDBG_BREAK_COMMAND_D(address,    "specify breakpoint by address",                          'a', break_address, NULL, "f"),
        PHPDBG_BREAK_COMMAND_D(at,         "specify breakpoint by location and condition",           'A', break_at,      NULL, "*c"),
        PHPDBG_BREAK_COMMAND_D(del,        "delete breakpoint by identifier number",                 'd', break_del,     NULL, "n"),
        PHPDBG_END_COMMAND
 };
 
-PHPDBG_BREAK(address) /* {{{ */
-{
-       phpdbg_set_breakpoint_file_opline(param->file.name, param->file.line TSRMLS_CC);
-
-       return SUCCESS;
-} /* }}} */
-
 PHPDBG_BREAK(at) /* {{{ */
 {
        phpdbg_set_breakpoint_at(param TSRMLS_CC);
index 50d855026c96860513d641cc99007042b8261397..dc06da62b7976765f94dde9608b2d5b1ed97e85d 100644 (file)
@@ -29,7 +29,6 @@
 /**
  * Printer Forward Declarations
  */
-PHPDBG_BREAK(address);
 PHPDBG_BREAK(at);
 PHPDBG_BREAK(del);
 
index 69aca21de8876784ec9d686bf11e670062597a6a..88eee42114127a00c8f26923e40f01da14caa6b5 100644 (file)
@@ -418,6 +418,10 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg)
                                fprintf(stderr, "%s ADDR_PARAM(%lu)\n", msg, param->addr);
                        break;
                        
+                       case NUMERIC_FILE_PARAM:
+                               fprintf(stderr, "%s NUMERIC_FILE_PARAM(%s:#%lu)\n", msg, param->file.name, param->file.line);
+                       break;
+                       
                        case FILE_PARAM:
                                fprintf(stderr, "%s FILE_PARAM(%s:%lu)\n", msg, param->file.name, param->file.line);
                        break;
@@ -465,16 +469,25 @@ PHPDBG_API void phpdbg_stack_free(phpdbg_param_t *stack) {
                                next = remove->next;
                        
                        switch (remove->type) {
-                               case STR_PARAM: 
-                                       if (remove->str) {
+                               case NUMERIC_METHOD_PARAM:
+                               case METHOD_PARAM:
+                                       if (remove->method.class)
+                                               free(remove->method.class);
+                                       if (remove->method.name)
+                                               free(remove->method.name);
+                               break;
+
+                               case NUMERIC_FUNCTION_PARAM:
+                               case STR_PARAM:
+                               case OP_PARAM:
+                                       if (remove->str)
                                                free(remove->str);      
-                                       }
                                break;
                                
+                               case NUMERIC_FILE_PARAM:
                                case FILE_PARAM:
-                                       if (remove->file.name) {
+                                       if (remove->file.name)
                                                free(remove->file.name);
-                                       }
                                break;
                                
                                default: {
index 2834ee06d37a676853c8cccb832e5e3ac0fdfe3f..dd82faca50ef85d2718fd6a36c36392fff750f57 100644 (file)
@@ -34,6 +34,7 @@ typedef enum {
        EMPTY_PARAM = 0,
        ADDR_PARAM,
        FILE_PARAM,
+       NUMERIC_FILE_PARAM,
        METHOD_PARAM,
        STR_PARAM,
        NUMERIC_PARAM,
index ae37f9b720bafa73b60101763faa3932421f3c90..993a9c990993b2fc224ad9669288788745c498e5 100644 (file)
@@ -540,9 +540,9 @@ phpdbg_help_text_t phpdbg_help_text[] = {
 "    $P b \\\\my\\\\class::method#2" CR
 "    Break at the opline #2 of the method \\\\my\\\\class::method" CR CR
 
-"    $P break address test.php:3" CR
-"    $P b a test.php:3" CR
-"    Break at the 3rd opline in test.php" CR CR
+"    $P break test.php:#3" CR
+"    $P b test.php:#3" CR
+"    Break at opline #3 in test.php" CR CR
 
 "    $P break if $cnt > 10" CR
 "    $P b if $cnt > 10" CR
index 599758f44f8d23cd69c3269c21850ac480c5de1e..ab7c71895474d9bad75bdee8b21e816d6bc939d5 100644 (file)
@@ -399,16 +399,16 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  20
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   23
+#define YYLAST   25
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  19
 /* YYNNTS -- Number of nonterminals.  */
 #define YYNNTS  4
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  19
+#define YYNRULES  20
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  27
+#define YYNSTATES  29
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
@@ -455,26 +455,28 @@ static const yytype_uint8 yytranslate[] =
    YYRHS.  */
 static const yytype_uint8 yyprhs[] =
 {
-       0,     0,     3,     5,     6,     8,    11,    15,    19,    25,
-      29,    32,    35,    38,    40,    42,    44,    46,    48,    50
+       0,     0,     3,     5,     6,     8,    11,    15,    20,    24,
+      30,    34,    37,    40,    43,    45,    47,    49,    51,    53,
+      55
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int8 yyrhs[] =
 {
       20,     0,    -1,    21,    -1,    -1,    22,    -1,    21,    22,
-      -1,    16,     9,    12,    -1,    16,    10,    16,    -1,    16,
-      10,    16,    11,    12,    -1,    16,    11,    12,    -1,     5,
-      17,    -1,     3,    17,    -1,     4,    17,    -1,    15,    -1,
-      14,    -1,    13,    -1,     6,    -1,     7,    -1,    12,    -1,
-      16,    -1
+      -1,    16,     9,    12,    -1,    16,     9,    11,    12,    -1,
+      16,    10,    16,    -1,    16,    10,    16,    11,    12,    -1,
+      16,    11,    12,    -1,     5,    17,    -1,     3,    17,    -1,
+       4,    17,    -1,    15,    -1,    14,    -1,    13,    -1,     6,
+      -1,     7,    -1,    12,    -1,    16,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    74,    74,    75,    79,    80,    84,    89,    94,   100,
-     106,   111,   116,   121,   122,   123,   124,   125,   126,   127
+       0,    74,    74,    75,    79,    80,    84,    89,    94,    99,
+     105,   111,   116,   121,   126,   127,   128,   129,   130,   131,
+     132
 };
 #endif
 
@@ -509,14 +511,16 @@ static const yytype_uint16 yytoknum[] =
 static const yytype_uint8 yyr1[] =
 {
        0,    19,    20,    20,    21,    21,    22,    22,    22,    22,
-      22,    22,    22,    22,    22,    22,    22,    22,    22,    22
+      22,    22,    22,    22,    22,    22,    22,    22,    22,    22,
+      22
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 static const yytype_uint8 yyr2[] =
 {
-       0,     2,     1,     0,     1,     2,     3,     3,     5,     3,
-       2,     2,     2,     1,     1,     1,     1,     1,     1,     1
+       0,     2,     1,     0,     1,     2,     3,     4,     3,     5,
+       3,     2,     2,     2,     1,     1,     1,     1,     1,     1,
+       1
 };
 
 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
@@ -524,9 +528,9 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       3,     0,     0,     0,    16,    17,    18,    15,    14,    13,
-      19,     0,     2,     4,    11,    12,    10,     0,     0,     0,
-       1,     5,     6,     7,     9,     0,     8
+       3,     0,     0,     0,    17,    18,    19,    16,    15,    14,
+      20,     0,     2,     4,    12,    13,    11,     0,     0,     0,
+       1,     5,     0,     6,     8,    10,     7,     0,     9
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
@@ -540,15 +544,15 @@ static const yytype_int8 yydefgoto[] =
 #define YYPACT_NINF -10
 static const yytype_int8 yypact[] =
 {
-      -3,    -9,    -2,    -1,   -10,   -10,   -10,   -10,   -10,   -10,
-      -4,    14,    -3,   -10,   -10,   -10,   -10,     5,     2,     7,
-     -10,   -10,   -10,     9,   -10,    10,   -10
+      -3,    -9,    -1,     0,   -10,   -10,   -10,   -10,   -10,   -10,
+      -4,    18,    -3,   -10,   -10,   -10,   -10,     3,     4,     7,
+     -10,   -10,     9,   -10,    11,   -10,   -10,    12,   -10
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -10,   -10,   -10,    11
+     -10,   -10,   -10,    13
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -558,8 +562,8 @@ static const yytype_int8 yypgoto[] =
 static const yytype_uint8 yytable[] =
 {
        1,     2,     3,     4,     5,    17,    18,    19,    14,     6,
-       7,     8,     9,    10,    20,    15,    16,    22,    23,    24,
-      25,     0,    26,    21
+       7,     8,     9,    10,    22,    23,    15,    16,    20,    25,
+      24,    26,    27,     0,    28,    21
 };
 
 #define yypact_value_is_default(yystate) \
@@ -571,8 +575,8 @@ static const yytype_uint8 yytable[] =
 static const yytype_int8 yycheck[] =
 {
        3,     4,     5,     6,     7,     9,    10,    11,    17,    12,
-      13,    14,    15,    16,     0,    17,    17,    12,    16,    12,
-      11,    -1,    12,    12
+      13,    14,    15,    16,    11,    12,    17,    17,     0,    12,
+      16,    12,    11,    -1,    12,    12
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -581,7 +585,7 @@ static const yytype_uint8 yystos[] =
 {
        0,     3,     4,     5,     6,     7,    12,    13,    14,    15,
       16,    20,    21,    22,    17,    17,    17,     9,    10,    11,
-       0,    22,    12,    16,    12,    11,    12
+       0,    22,    11,    12,    16,    12,    12,    11,    12
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -1456,6 +1460,17 @@ yyreduce:
 
 /* Line 1806 of yacc.c  */
 #line 89 "sapi/phpdbg/dev/phpdbg_parser.y"
+    {
+               (yyval).type = NUMERIC_FILE_PARAM;
+               (yyval).file.name = (yyvsp[(1) - (4)]).str;
+               (yyval).file.line = (yyvsp[(4) - (4)]).num;
+       }
+    break;
+
+  case 8:
+
+/* Line 1806 of yacc.c  */
+#line 94 "sapi/phpdbg/dev/phpdbg_parser.y"
     { 
                (yyval).type = METHOD_PARAM;
                (yyval).method.class = (yyvsp[(1) - (3)]).str;
@@ -1463,10 +1478,10 @@ yyreduce:
        }
     break;
 
-  case 8:
+  case 9:
 
 /* Line 1806 of yacc.c  */
-#line 94 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 99 "sapi/phpdbg/dev/phpdbg_parser.y"
     { 
                (yyval).type = NUMERIC_METHOD_PARAM;
                (yyval).method.class = (yyvsp[(1) - (5)]).str;
@@ -1475,10 +1490,10 @@ yyreduce:
        }
     break;
 
-  case 9:
+  case 10:
 
 /* Line 1806 of yacc.c  */
-#line 100 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 105 "sapi/phpdbg/dev/phpdbg_parser.y"
     {
                (yyval).type = NUMERIC_FUNCTION_PARAM;
                (yyval).str = (yyvsp[(1) - (3)]).str;
@@ -1487,10 +1502,10 @@ yyreduce:
        }
     break;
 
-  case 10:
+  case 11:
 
 /* Line 1806 of yacc.c  */
-#line 106 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 111 "sapi/phpdbg/dev/phpdbg_parser.y"
     { 
                (yyval).type = COND_PARAM; 
                (yyval).str = (yyvsp[(2) - (2)]).str;
@@ -1498,10 +1513,10 @@ yyreduce:
        }
     break;
 
-  case 11:
+  case 12:
 
 /* Line 1806 of yacc.c  */
-#line 111 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 116 "sapi/phpdbg/dev/phpdbg_parser.y"
     { 
                (yyval).type = EVAL_PARAM; 
                (yyval).str = (yyvsp[(2) - (2)]).str;
@@ -1509,10 +1524,10 @@ yyreduce:
        }
     break;
 
-  case 12:
+  case 13:
 
 /* Line 1806 of yacc.c  */
-#line 116 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 121 "sapi/phpdbg/dev/phpdbg_parser.y"
     {  
                (yyval).type = SHELL_PARAM; 
                (yyval).str = (yyvsp[(2) - (2)]).str;
@@ -1520,59 +1535,59 @@ yyreduce:
        }
     break;
 
-  case 13:
-
-/* Line 1806 of yacc.c  */
-#line 121 "sapi/phpdbg/dev/phpdbg_parser.y"
-    { (yyval) = (yyvsp[(1) - (1)]); }
-    break;
-
   case 14:
 
 /* Line 1806 of yacc.c  */
-#line 122 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 126 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 15:
 
 /* Line 1806 of yacc.c  */
-#line 123 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 127 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 16:
 
 /* Line 1806 of yacc.c  */
-#line 124 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 128 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 17:
 
 /* Line 1806 of yacc.c  */
-#line 125 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 129 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 18:
 
 /* Line 1806 of yacc.c  */
-#line 126 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 130 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 19:
 
 /* Line 1806 of yacc.c  */
-#line 127 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 131 "sapi/phpdbg/dev/phpdbg_parser.y"
+    { (yyval) = (yyvsp[(1) - (1)]); }
+    break;
+
+  case 20:
+
+/* Line 1806 of yacc.c  */
+#line 132 "sapi/phpdbg/dev/phpdbg_parser.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
 
 
 /* Line 1806 of yacc.c  */
-#line 1576 "sapi/phpdbg/phpdbg_parser.c"
+#line 1591 "sapi/phpdbg/phpdbg_parser.c"
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -1803,6 +1818,6 @@ yyreturn:
 
 
 /* Line 2067 of yacc.c  */
-#line 130 "sapi/phpdbg/dev/phpdbg_parser.y"
+#line 135 "sapi/phpdbg/dev/phpdbg_parser.y"
 
 
index 98fbcdf518977564c711af08b1d0491763680cbb..3b147b3a6f626c2d76038e862f055e75be1250be 100644 (file)
@@ -778,6 +778,9 @@ PHPDBG_COMMAND(break) /* {{{ */
                case FILE_PARAM:
                        phpdbg_set_breakpoint_file(param->file.name, param->file.line TSRMLS_CC);
                        break;
+               case NUMERIC_FILE_PARAM:
+                       phpdbg_set_breakpoint_file_opline(param->file.name, param->file.line TSRMLS_CC);
+                       break;
                case COND_PARAM:
                        phpdbg_set_breakpoint_expression(param->str, param->len TSRMLS_CC);
                        break;