Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21110

Unify turn_parser_debug_on() in sql_yacc.yy and sql_yacc_ora.yy

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.5.0
    • Parser
    • None

    Description

      This code block presents only in sql_yacc.yy and does not present in sql_yacc_ora.yy:

      #ifndef DBUG_OFF
      void turn_parser_debug_on()
      {
        /*
           MYSQLdebug is in sql/sql_yacc.cc, in bison generated code.
           Turning this option on is **VERY** verbose, and should be
           used when investigating a syntax error problem only.
       
           The syntax to run with bison traces is as follows :
           - Starting a server manually :
             mysqld --debug-dbug="d,parser_debug" ...
           - Running a test :
             mysql-test-run.pl --mysqld="--debug-dbug=d,parser_debug" ...
       
           The result will be in the process stderr (var/log/master.err)
         */
       
        extern int yydebug;
        yydebug= 1;
      }
      #endif
      

      The above function is used in mysql_parse() in sql_parse.cc, like this:

        DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on(););
      

      Note, currently this code enables parser debug output in the code generated from sql_yacc.yy, but does not enable debug output in sql_yacc_ora.yy.

      Let's unify this code and put the following block in both sql_yacc.yy and sql_yacc_ora.yy:

      #ifndef DBUG_OFF
      #define __CONCAT_UNDERSCORED(x,y) x ## _ ## y
      #define _CONCAT_UNDERSCORED(x,y) __CONCAT_UNDERSCORED(x,y)
      void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()

      { /* MYSQLdebug is in sql/sql_yacc.cc, in bison generated code. Turning this option on is **VERY** verbose, and should be used when investigating a syntax error problem only. The syntax to run with bison traces is as follows : - Starting a server manually : mysqld --debug-dbug="d,parser_debug" ... - Running a test : mysql-test-run.pl --mysqld="--debug-dbug=d,parser_debug" ... The result will be in the process stderr (var/log/master.err) */ extern int yydebug; yydebug= 1; }

      #endif

      So:

      • sql_yacc.yy provides the function turn_parser_debug_on_MYSQLparse()
      • sql_yacc_ora.yy provides the function turn_parser_debug_on_ORAparse()
      • The code in sql_yacc.yy and sql_yacc_ora.yy look exactly the same.

      The corresponding code in sql_parse.cc will change to:

        DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on_MYSQLparse(););
        DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on_ORAparse(););
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.