"Fossies" - the Fresh Open Source Software Archive

Member "xxgdb-1.12/gdb_regex.h" (21 Apr 1995, 21957 Bytes) of package /linux/misc/old/xxgdb-1.12.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*****************************************************************************
    2  *
    3  *  xdbx - X Window System interface to the dbx debugger
    4  *
    5  *  Copyright 1989 The University of Texas at Austin
    6  *  Copyright 1990 Microelectronics and Computer Technology Corporation
    7  *
    8  *  Permission to use, copy, modify, and distribute this software and its
    9  *  documentation for any purpose and without fee is hereby granted,
   10  *  provided that the above copyright notice appear in all copies and that
   11  *  both that copyright notice and this permission notice appear in
   12  *  supporting documentation, and that the name of The University of Texas
   13  *  and Microelectronics and Computer Technology Corporation (MCC) not be 
   14  *  used in advertising or publicity pertaining to distribution of
   15  *  the software without specific, written prior permission.  The
   16  *  University of Texas and MCC makes no representations about the 
   17  *  suitability of this software for any purpose.  It is provided "as is" 
   18  *  without express or implied warranty.
   19  *
   20  *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
   21  *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
   22  *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
   23  *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
   24  *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
   25  *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
   26  *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   27  *
   28  *  Author:     Po Cheung
   29  *  Created:    March 10, 1989
   30  *
   31  *****************************************************************************
   32  * 
   33  *  xxgdb - X Window System interface to the gdb debugger
   34  *  
   35  *  Copyright 1990,1993 Thomson Consumer Electronics, Inc.
   36  *  
   37  *  Permission to use, copy, modify, and distribute this software and its
   38  *  documentation for any purpose and without fee is hereby granted,
   39  *  provided that the above copyright notice appear in all copies and that
   40  *  both that copyright notice and this permission notice appear in
   41  *  supporting documentation, and that the name of Thomson Consumer
   42  *  Electronics (TCE) not be used in advertising or publicity pertaining
   43  *  to distribution of the software without specific, written prior
   44  *  permission.  TCE makes no representations about the suitability of
   45  *  this software for any purpose.  It is provided "as is" without express
   46  *  or implied warranty.
   47  *
   48  *  TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   49  *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
   50  *  SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
   51  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   52  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   53  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   54  *  SOFTWARE.
   55  *
   56  *  Adaptation to GDB:  Pierre Willard
   57  *  XXGDB Created:      December, 1990
   58  *
   59  *****************************************************************************/
   60 
   61 /*  
   62  *  gdb_regex.h:
   63  *
   64  *  Regular expression pattern matching for GNU gdb.
   65  *  
   66  *  The reg_token array indicates the register no. for each token type.
   67  *      reg_token[0] : message
   68  *      reg_token[1] : stop number
   69  *      reg_token[2] : function name
   70  *      reg_token[3] : line number
   71  *      reg_token[4] : file name
   72  *      reg_token[5] : display command output
   73  */
   74 
   75 #define TK_MESG     0
   76 #define TK_STOP     1
   77 #define TK_FUNC     2
   78 #define TK_LINE     3
   79 #define TK_FILE     4
   80 #define TK_DISP     5
   81 
   82 #define O_EXEC_MESS_AFTER   0
   83 #define O_EXEC_MESS_BEFORE  1
   84 #define O_EXEC_GDB          2
   85 #define O_DONE              3
   86 #define O_BREAK             4           /* Instead of O_STOPAT & O_STOPIN */
   87 #define O_INFO_DIR          5           /* NEW for GDB */
   88 #define O_FRAME_CURR        6           /* O_FRAME_CURR = O_UPDOWN */
   89 #define O_UPDOWN            6
   90 #define O_BELL              7
   91 #define O_SEARCH            8
   92 #define O_INFO_LINE         9           /* Instead of O_FILE */
   93 #define O_PRINT             10
   94 #define O_DEBUG             11
   95 #define O_DIRECTORY         12          
   96 #define O_LIST              13          /* for dbx, O_LIST = O_SEARCH */
   97 #define O_DISPLAY           14
   98 #define O_DISPLAY_INFO      15
   99 #define O_PWD               16
  100 #define O_CD                16          /* O_PWD = O_CD */
  101 #define O_RECEIVED_SIGNAL   17          /* test program received signal */
  102 #define O_EXEC_DISPLAY      18          /* special for filter_display_info  */
  103 #define O_READING_SYMBOLS   19          /* special for filter_reading_symbols */
  104 #define O_CORE_FILE         20
  105 #define O_UNDEF_SHOW        21          /* test for undefined show command (for gdb 4.0) */
  106 #define O_INFO_SOURCE       22          /* to get compilation directory (for gdb 4.0) */
  107 #define O_UPDOWN_NOSOURCE   23          /* up/down in no source file */
  108 
  109 
  110 #define C_ANY           -1
  111 #define C_EXEC          0
  112 #define C_BREAK         1           /* Instead of C_STOPAT & C_STOPIN */
  113 #define C_INFO_DIR      2           /* NEW for GDB */
  114 #define C_FRAME_CURR    3
  115 #define C_UPDOWN        4
  116 #define C_DELETE        5
  117 #define C_FINISH        6           /* Instead of C_FUNC */
  118 #define C_INFO_LINE     7           /* Instead of C_FILE */
  119 #define C_SYMBOL_FILE   8
  120 #define C_CD            9
  121 #define C_DIRECTORY     10          /* Instead of C_USE */
  122 #define C_PWD           11
  123 #define C_LIST          12
  124 #define C_SEARCH        13
  125 #define C_DISPLAY_INFO  14          /* must be BEFORE C_DISPLAY ! */
  126 #define C_DISPLAY       15
  127 #define C_UNDISPLAY     16
  128 #define C_PRINT         17
  129 #define C_INFO_BREAK    18
  130 #define C_SOURCE        19
  131 #define C_EXEC_FILE     20
  132 #define C_CORE_FILE     21
  133 #define C_DEFINE        22
  134 #define C_DOCUMENT      23
  135 #define C_END           24
  136 #define C_INFO_SOURCE   25          /* new for gdb 4.0 to get compilation directory */
  137 #define C_FILE          26          /* new for gdb 4.0 : file command */
  138 
  139 /*--------------------------------------------------------------------------+
  140 |                                                                           |
  141 |                               DBX                                         |
  142 |                                                                           |
  143 | Reading symbolic information...                                           |
  144 | Read 46 symbols                                                           |
  145 | (dbx)                                                                     |
  146 | (dbx)                                                                     |
  147 | stopped in main at line 5 in file "pw.c"                                  |
  148 |    5           for (i=0; i<100; i++)                                      |
  149 | (dbx) use                                                                 |
  150 | /usr1/gnu_sun4/xdbx/                                                      |
  151 | (dbx) file                                                                |
  152 | pw.c                                                                      |
  153 | (dbx) file                                                                |
  154 | No current source file                                                    |
  155 |                                                                           |
  156 +--------------------------------------------------------------------------*/
  157 /*--------------------------------------------------------------------------+
  158 |                                                                           |
  159 |                               GDB                                         |
  160 |                                                                           |
  161 | Reading symbol data from /usr1/gnu_sun4/xdbx/pw...done.                   |
  162 | Type "help" for a list of commands.                                       |
  163 | (gdb)                                                                     |
  164 | (gdb)                                                                     |
  165 | Bpt 1, main () (pw.c line 5)                                              |
  166 | 5               for (i=0; i<100; i++)                                     |
  167 | (gdb) info directories                                                    |
  168 | Source directories searched: /usr1/gnu_sun4/xdbx:/usr1/toto               |
  169 | (gdb) info line                                                           |
  170 | Line 10 of "pw.c" starts at pc 0x22dc and ends at 0x22e4.                 |
  171 | (gdb) info line                                                           |
  172 | No source file specified.                                                 |
  173 |                                                                           |
  174 +--------------------------------------------------------------------------*/
  175 /*--------------------------------------------------------------------------+
  176 |                                                                           |
  177 |                               GDB -fullname                               |
  178 |                                                                           |
  179 |                                                                           |
  180 |   We use option -fullname (see dbxoptions() in xdbx.c).                   |
  181 |                                                                           |
  182 | GDB prints (see source.c of gdb):                                         |
  183 |                                                                           |
  184 |       "\032\032%s:%d:%d:%s:0x%x\n", s->fullname,                          |
  185 |       line, s->line_charpos[line - 1],                                    |
  186 |       mid_statement ? "middle" : "beg",                                   |
  187 |       get_frame_pc (get_current_frame()));                                |
  188 |                                                                           |
  189 | (gdb) break main                                                          |
  190 | Reading in symbols for pw.c...done.                                       |
  191 | Breakpoint 1 at 0x229c: file pw.c, line 5.                                |
  192 | (gdb) run                                                                 |
  193 | Starting program: /usr1/gnu_sun4/xdbx/pw                                  |
  194 |                                                                           |
  195 | Bpt 1, main () (pw.c line 5)                                              |
  196 | /usr1/gnu_sun4/xdbx/pw.c:5:17:beg:0x229c                                  |
  197 | (gdb) step                                                                |
  198 | /usr1/gnu_sun4/xdbx/pw.c:6:40:beg:0x22b0                                  |
  199 | (gdb)                                                                     |
  200 |                                                                           |
  201 | (gdb) info directories                                                    |
  202 | Source directories searched: /usr1/gnu_sun4/xdbx                          |
  203 | (gdb) info line                                                           |
  204 | Line 10 of "pw.c" starts at pc 0x22dc and ends at 0x22e4.                 |
  205 | (gdb) info line                                                           |
  206 | No source file specified.                                                 |
  207 | (gdb) info line                                                           |
  208 | Line number 34 is out of range for "bug1.c".                              |
  209 |                                                                           |
  210 | (gdb) display i                                                           |
  211 | 3: i = 0                                                                  |
  212 | (gdb) display                                                             |
  213 | 4: i + 1 = 1                                                              |
  214 | 3: i = 0                                                                  |
  215 | (gdb) undisplay 2                                                         |
  216 | (gdb) display                                                             |
  217 | (gdb)                                                                     |
  218 |                                                                           |
  219 | (gdb) up                                                                  |
  220 | #2  0x2314 in main () (pw.c line 35)                                      |
  221 | /usr1/gnu_sun4/xdbx/pw.c:35:158:beg:0x2360                                |
  222 | (gdb) up                                                                  |
  223 | Initial frame selected; you cannot go up.                                 |
  224 | (gdb)                                                                     |
  225 |                                                                           |
  226 | (gdb) down                                                                |
  227 | #0  glop (number=1) (pw2.c line 5)                                        |
  228 | /usr1/gnu_sun4/xdbx/pw2.c:5:33:beg:0x2360                                 |
  229 | (gdb) down                                                                |
  230 | Bottom (i.e., innermost) frame selected; you cannot go down.              |
  231 | (gdb)                                                                     |
  232 |                                                                           |
  233 | (gdb) pwd                                                                 |
  234 | Working directory /usr1/gnu_sun4/xdbx.                                    |
  235 | (gdb) cd ..                                                               |
  236 | Working directory /usr1/gnu_sun4.                                         |
  237 | (gdb) cd xdbx                                                             |
  238 | Working directory /usr1/gnu_sun4/xdbx.                                    |
  239 | (gdb) cd toto                                                             |
  240 | toto: No such file or directory.                                          |
  241 | (gdb)                                                                     |
  242 |                                                                           |
  243 | Program exited with code 01.                                              |
  244 | (gdb)                                                                     |
  245 |                                                                           |
  246 +--------------------------------------------------------------------------*/
  247 /*
  248 
  249         .       --> any character but '\n'
  250         *       --> any character 0 to n times
  251         +       --> any character 1 to n times
  252         ?       --> any character 0 or 1 time
  253         ^       --> begin of line or NOT following character
  254         $       --> end of line or '$'
  255         \\w     --> character '0..9a..zA...Z'
  256         \\W     --> character NOT '0..9a..zA...Z'
  257         \\<     --> word begin (word is composed of 0..9a..zA...Z)
  258         \\>     --> word end (word is composed of 0..9a..zA...Z)
  259         \\b     --> word bound
  260         \\B     --> not word bound
  261         \\|     --> means OR
  262         \\`     --> begin buffer
  263         \\\'    --> end buffer
  264         
  265         
  266 >>  WARNING : be carefull with \\| (OR) : the re_match() function
  267 >>  will NOT correctly update the string for a pattern which is
  268 >>  optional !
  269 >>  --> The number SHOULD NOT point to a patterm which is optional ! 
  270 
  271 */
  272 
  273     /* (PW)5DEC90: I have a problem if we say \\(Bpt.*\n\\)? in exec pattern.
  274         That is why I have two cases : with or without Bpt...
  275         Note that 'exec without Message' includes 'exec with Message'.
  276         We display 'Bpt...' in the message window. */
  277         
  278     /* (PW)14JAN91 (v1.01) : use 
  279         \\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)
  280     instead of
  281         \\(\\([0-9]+:.*\n\\)*\\)
  282     for display pattern.
  283 
  284     (PW)21APR95 :For gdb 4.14 (Sun) :
  285     \032\032/net/tcela/sky/aoutwrap/sun/../aoutwrap.c:714:21758:beg:125f0
  286                                                                     ^^^^^
  287     So change :0.+\n into :.+\n for exec patterns and up/down pattern.
  288     It is now possible that those new patterns works also for NeXT, but I
  289     cannot test so I will leave the ifdef NexT.
  290     */
  291     
  292 
  293 static PatternRec output_pattern[] = {
  294 
  295 #ifndef NeXT  /* if standard GDB */
  296     /* exec with Message after */
  297     {"\\(.*\n\\)*\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):.+\n\\([ ]*[^0-9\n].*\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  298      NULL,
  299      {6, -1, -1, 3, 2, 7}
  300     },
  301     /* exec with Message before */
  302     {"\\(.*\n\\)*\\([ ]*[^ \n].*\n\\)\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):.+\n\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  303      NULL,
  304      {2, -1, -1, 4, 3, 7}   
  305     },
  306     /* exec without Message */
  307     {"\\(.*\n\\)*\032\032\\(\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):.+\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  308      NULL,
  309      {2, -1, -1, 4, 3, 7}
  310     },
  311     
  312 #else  /* NeXT is a special case : same as standard except that ":0x.+" are removed. */
  313     /* exec with Message after */
  314     {"\\(.*\n\\)*\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\([ ]*[^0-9\n].*\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  315      NULL,
  316      {6, -1, -1, 3, 2, 7}
  317     },
  318     /* exec with Message before */
  319     {"\\(.*\n\\)*\\([ ]*[^ \n].*\n\\)\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  320      NULL,
  321      {2, -1, -1, 4, 3, 7}   
  322     },
  323     /* exec without Message */
  324     {"\\(.*\n\\)*\032\032\\(\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n\\)\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)",
  325      NULL,
  326      {2, -1, -1, 4, 3, 7}
  327     },
  328 #endif /* NeXT */
  329 
  330     /* done */
  331     {"\\(.*\n\\)*\n\\(Program terminated with signal \\|Program exited with code 0\\|Program exited normally\\).*\n\\(.*\n\\)*",
  332      NULL,
  333      {-1, -1, -1, -1, -1, -1}
  334     },
  335 #if defined (NeXT) && !defined(NEXTOS_2)
  336 #if defined(NEXTOS_3_0)
  337     /* NeXT 3.0 gdb is special case : uses "file:#" intead of "file, line #" */
  338       /* break */
  339     {"\\(.*\n\\)*Breakpoint \\([0-9]+\\) at [^ \n]+: file \\([^ \n]+\\):\\([0-9]+\\).\n",
  340      NULL,
  341      {-1, 2, -1, 4, 3, -1}
  342     },
  343 #else
  344     /* NeXT 3.X gdb is special case : leaves out "file" label altogether */
  345     /* break */
  346     {"\\(.*\n\\)*Breakpoint \\([0-9]+\\) at [^ \n]+: \\([^ \n]+\\):\\([0-9]+\\).\n",
  347      NULL,
  348      {-1, 2, -1, 4, 3, -1}
  349     },
  350 #endif
  351 #else    /* if standard GDB */
  352     /* break */
  353     {"\\(.*\n\\)*Breakpoint \\([0-9]+\\) at [^ \n]+: file \\([^ \n]+\\), line \\([0-9]+\\).\n",
  354      NULL,
  355      {-1, 2, -1, 4, 3, -1}
  356     },
  357 #endif /* NeXT */
  358     /* info directories */
  359     {"Source directories searched:[ ]*\\([^ \n]+\\)[ ]*\n",
  360      NULL,
  361      { -1, -1, -1, -1, 1, -1}
  362     },
  363     
  364     
  365 #ifndef NeXT  /* if standard GDB */
  366     /* up, down */
  367     {"\\(.*\n\\)*\\(#[0-9]+[ ]+\\(0[^ \n]+[ ]+in[ ]+\\)?\\([^ \n]+\\)[^\032]*\\)\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\):.+\n",
  368      NULL,
  369      {2, -1, 4, 6, 5, -1}   
  370     },
  371 #else  /* NeXT is a special case : same as standard except that ":0x.+" are removed. */
  372     /* up, down */
  373     {"\\(.*\n\\)*\\(#[0-9]+[ ]+\\(0[^ \n]+[ ]+in[ ]+\\)?\\([^ \n]+\\)[^\032]*\\)\032\032\\([^ \n]+\\):\\([0-9]+\\):\\([0-9]+\\):\\([^ \n]+\\)\n",
  374      NULL,
  375      {2, -1, 4, 6, 5, -1}   
  376     },
  377 #endif /* NeXT */
  378 
  379 
  380     /* bell */
  381     {"\\(Undefined command: .*\n\\|Already at the \\(top\\|bottom\\) call level\n\\|\
  382 No active stack frames\n\\|no program to run\n\\|no process to run\n\\|\
  383 program is not active\n\\|can't continue execution\n\\|\
  384 .*\ncan't write to process.*\n\\|\
  385 \\(Top\\|End\\)-of-file; did not find search string:.*\n\\)",
  386      NULL,
  387      {-1, -1, -1, -1, -1, -1}
  388     },
  389     /* search */
  390     {"\\([0-9]+\\).*\n",
  391      NULL,
  392      {-1, -1, -1, 1, -1, -1}
  393     },
  394     /* info line */
  395     {"\\(\\(Line \\(number \\)?[0-9]+ \\(of\\|is out of range for\\) \"\\([^ \n]+\\)\".*\\)\\|\\(No symbol table is loaded.*\\)\\|\\(No source file specified.*\\)\\|\\(No line number.*\\)\\)\n",
  396      NULL,
  397      {-1, -1, -1, -1, 5, -1}
  398     },
  399     /* print */
  400     {"\\(warning: .*\n\\)?\\(\\(.*\\) = .*\n\\(.*\n\\)*\\)",
  401      NULL,
  402      { 3, -1, -1, -1, -1, 2}
  403     },
  404     /* start gdb (debug)  */
  405     {"\\(.*\n\\)*Type \"help\" for a list of commands.\n",
  406      NULL,
  407      { -1, -1, -1, -1, -1, -1}
  408     },
  409     /* directory */
  410     {"\\([^ \n]+ is already in the source path.[ ]*\n\\)*Source directories searched:[ ]*\\([^ \n]+\\)[ ]*\n",
  411      NULL,
  412      { -1, -1, -1, -1, 1, -1}
  413     },
  414     /* list : 22MAY91 put message in Token.mesg (edit again 30MAY91) */
  415     {"\\(\\([^0-9\n]+.*\n\\)*\\)\\(.*\n\\)*\\(\\([0-9]+\\).*\n\\)",
  416      NULL,
  417      { 1, -1, -1, 5, -1, -1}
  418     },
  419 /*    {"\\(\\(.*\n\\)*\\)\\(\\([0-9]+\\).*\n\\)",
  420      NULL,
  421      { 1, -1, -1, 4, -1, -1}
  422     },
  423 */
  424     /* display */
  425     {"\\([0-9]+:.*\n\\)",
  426      NULL,
  427      { -1, -1, -1, -1, -1, 1}
  428     },
  429     /* info display */
  430     {"\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*[ }]*}\n\\)?\\)*\\)\\(\\(.*\n\\)*\\)",
  431      NULL,
  432      {  5, -1, -1, -1, -1, 1}
  433     },
  434 /*    {"\\(\\([0-9]+:.*\n\\(\\( .*\n\\)*}\n\\)?\\)*\\)",
  435      NULL,
  436      { -1, -1, -1, -1, -1, 1}
  437     },
  438 */
  439     /* pwd or cd */
  440 /* 11JUN92: Fix by Michael L. Graham : pb with symbolic link directories */
  441 /*    {"Working directory[ ]+\\([^ \n]+\\).[ ]*\n\\([ ]*(canonically[ ]+\\([^ \n]+\\)).\n\\)?", */
  442 /* (PW)23NOV92 : the patch did not work when directory name includes '.' */
  443 /*    {"Working directory[ ]+\\([^ \n.]+\\)\\.?[ ]*\n\\([ ]*(canonically[ ]+\\([^ \n]+\\)).\n\\)?",*/
  444     {"Working directory[ ]+\\([^ \n]+\\)[ ]*\\(\n[ ]*(canonically[ ]+\\([^ \n]+\\))\\)?.\n",
  445      NULL,
  446      { 1, -1, -1, -1, -1, 3}
  447     },
  448     /* program received signal */
  449     {"\\(.*\n\\)*\n\\(Program received signal \\([-]?[0-9]+\\), [^ \n]+.*\n\\)\\(.*\n\\)*",
  450     NULL,
  451      {  2, 3, -1, -1, -1, -1}
  452     },
  453     /* special for test in filter_display_info() */
  454     {"\\([^0-9\n].*\n\\)*\\([0-9]+:.*\n\\)\\(.*\n\\)*",
  455      NULL,
  456      { -1, -1, -1, -1, -1, 2}
  457     },
  458     /* special for test in filter_reading_symbols() */
  459     {"\\(.*\n\\)*\\(Reading in symbols for .*done.\n\\)\\(.*\n\\)*",
  460      NULL,
  461      { 2, -1, -1, -1, -1, -1}
  462     },
  463     /* core-file */
  464     {"\\(.*\n\\)*\\(Program terminated with signal \\([-]?[0-9]+\\), [^ \n]+.*\n\\)\\(.*\n\\)*",
  465     NULL,
  466      {  2, 3, -1, -1, -1, -1}
  467     },
  468     /* Undefined show command (for test gdb 4.0) */
  469     {"\\(Undefined command: \"show\".\n\\)",
  470      NULL,
  471      {-1, -1, -1, -1, -1, -1}
  472     },
  473     /* info source (for gdb 4.0) */
  474     {"\\(.*\n\\)*Current source file is \\([^ ]+\\)\nCompilation directory is \\([^ ]+\\)\nLocated in \\([^ ]+\\)\n\\(.*\n\\)*",
  475      NULL,
  476      { 3, -1, 2, -1, 4, -1}
  477     },
  478     /* up, down with no source file */
  479     {"\\(.*\n\\)*\\(#[0-9]+[ ]+\\(0[^ \n]+[ ]+in[ ]+\\)?\\([^ \n]+\\).*\\)\n",
  480      NULL,
  481      {2, -1, 4, -1, -1, -1} 
  482     },
  483     {
  484     NULL,   /* last one */
  485     NULL,
  486     {-1, -1, -1, -1, -1, -1}
  487     }
  488 };
  489 
  490 /*
  491 
  492     To simplify the patterns, I used for example :
  493     
  494         "f[rame]*" instead of "frame\\|fram\\|fra||fr".
  495         
  496     This will cause 'frmeame' to be accepted. But this is
  497     no problem because 'Undefined command' output is parsed
  498     before parsing the command line (see parse() in parser.c).
  499 */
  500 
  501 static PatternRec command_pattern[] = {
  502     /* run -r - cont - c - next - n - step - s - nexti - ni - stepi - si - return
  503     jump - until - u */
  504     /* CRL mod 22 4/5/91 GWC - added attach to this list for gdbvx */
  505     /* (PW) - added target to this list for gdb 4.0 */
  506     
  507     {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|nexti\\|stepi\\|ni\\|si\\|ret[urn]*\\|j[ump]*\\|unt[il]*\\|u\\|at[tach]*\\|ta[rget]*\\)\\( .*\\)?\n",
  508                                             NULL, {-1, -1, -1, -1, -1, -1}},
  509     /* break - tbreak */
  510     {"[ ]*\\(t\\)?\\(b\\|br\\|bre\\|brea\\|break\\)\\( .*\\)?\n",
  511                                             NULL, {-1, -1, -1, -1, -1, -1}},
  512     /* (PW)28AUG91 : add show for gdb 4.0 */
  513     {"[ ]*\\(info\\|show\\)[ ]+directories[ ]*\n",      NULL, {-1, -1, -1, -1, -1, -1}},
  514     
  515     /* 'frame' is special case of 'frame n' since it does not change the
  516     current frame. Else 'frame n' is like up or down. */
  517     /* CRL mod 23 4/5/91 GWC - changed fr[ame] to f[rame] */
  518     {"[ ]*f[rame]*[ ]*\n",                  NULL, {-1, -1, -1, -1, -1, -1}},
  519     {"[ ]*\\(up\\|down\\|dow\\|do\\|f[rame]*\\)\\( .*\\)?\n", 
  520                                             NULL, {-1, -1, -1, -1, -1, -1}},
  521                                             
  522     /* delete - d - clear - enable - disable - dis - disa */
  523     /* gdb commands 'delete display' 'enable display' and 'delete environment'
  524     are also found here. This is superfluous, but no problem */
  525     
  526     {"[ ]*\\(del[ete]*\\|d\\|cl[ear]*\\|en[able]*\\|disab[le]*\\|dis\\|disa\\)\\( .*\\)?\n",
  527                                             NULL, {-1, -1, -1, -1, -1, -1}},
  528                                             
  529     /* because of gdb 4.0 use fin[ish] instead of fi[nish] */               
  530     {"[ ]*fin[ish]*[ ]*\n",                 NULL, {-1, -1, -1, -1, -1, -1}},
  531     {"[ ]*info[ ]+line[ ]*\n",              NULL, {-1, -1, -1, -1, -1, -1}},
  532     
  533     /* symbol-file */
  534     {"[ ]*sy.*\n",                          NULL, {-1, -1, -1, -1, -1, -1}},
  535     {"[ ]*cd[ ]*[^ \n]+[ ]*\n",             NULL, {-1, -1, -1, -1, -1, -1}},
  536     
  537     /* directory */
  538     {"[ ]*dir.*\n",                         NULL, {-1, -1, -1, -1, -1, -1}},
  539     
  540     {"[ ]*pwd[ ]*\n",                       NULL, {-1, -1, -1, -1, -1, -1}},
  541     /* list */
  542     {"[ ]*\\(l\\|li\\|lis\\|list\\)\\( .*\\)?\n",   NULL, {-1, -1, -1, -1, -1, -1}},
  543     
  544     /* forward-search or reverse-search or search */
  545     
  546     {"[ ]*\\(fo[rward-search]*\\|rev[erse-search]*\\|sea[rch]*\\)[ ]*",
  547                                             NULL, {-1, -1, -1, -1, -1, -1}},
  548     
  549     /* 'display' is a special case of 'display exp' since it does not
  550     add any expression to be displayed */
  551     {"[ ]*disp[lay]*[ ]*\n",                            NULL, {-1, -1, -1, -1, -1, -1}},
  552     {"[ ]*disp[lay]\\(/[^ \n]+\\)?*[ ]*[^ \n]+[ ]*.*\n",    NULL, {-1, -1, -1, -1, -1, -1}},
  553     
  554     /* undisplay */
  555     {"[ ]*und.*\n",                         NULL, {-1, -1, -1, -1, -1, -1}},
  556     
  557     /* Note that Token.mesg (if any) is updated with print command (see 1) */
  558     
  559     {"[ ]*print[ ]*\\([^ \n]?\\([ ]+[^ \n]+\\)*\\)[ ]*\n",  NULL, { 1, -1, -1, -1, -1, -1}},
  560     {"[ ]*info[ ]+break[ ]*\n",             NULL, {-1, -1, -1, -1, -1, -1}},
  561     
  562     /* source (note that Token.TK_FILE is updated here) */
  563     {"[ ]*so[urce]*[ ]*\\(.*\\)\n",         NULL, {-1, -1, -1, -1,  1, -1}},
  564     
  565     /* exec-file (just used internally) */
  566     {"[ ]*ex[ec-file]*.*\n",                NULL, {-1, -1, -1, -1, -1, -1}},
  567 
  568     /* core-file */
  569     {"[ ]*cor[e-file]*.*\n",                NULL, {-1, -1, -1, -1, -1, -1}},
  570 
  571     /* define */
  572     {"[ ]*def[ine]*[ ]+[^ \n]+\n",          NULL, {-1, -1, -1, -1, -1, -1}},
  573     /* document */
  574     {"[ ]*doc[ument]*[ ]+[^ \n]+\n",        NULL, {-1, -1, -1, -1, -1, -1}},
  575     /* end of define or document */
  576     {"[ ]*end[ ]*.*",                       NULL, {-1, -1, -1, -1, -1, -1}},
  577     
  578     /* info source */
  579     {"[ ]*info[ ]+source[ ]*\n",            NULL, {-1, -1, -1, -1, -1, -1}},
  580 
  581     /* file */
  582     {"[ ]*file .*\n",                       NULL, {-1, -1, -1, -1, -1, -1}},
  583 
  584     {NULL,  /* last one */                  NULL, {-1, -1, -1, -1, -1, -1}}
  585 };