On Fri, Mar 24, 2006 at 10:01:16AM -0800, Paul Eggert wrote:
> "Joel E. Denny" <[EMAIL PROTECTED]> writes:
>
> > Sorry for the silence on our part. I think everyone must be very busy.
>
> Yup. I'll have some more time next week, I think.
>
> > On top of that, there seems to be some delay on completing 2.2,
>
> This is more a licensing issue. I guess we'll have to ship 2.2 with
> the old license.
>
> (Personally I'd trust your or Akim's review over mine. :-)
Thanks for the responds everyone. I know these things take time, I just
wanted to make sure I wasn't being swept under the rug.
I do see one problem while testing the parser after the patch. Some of
my actions are not being reached, which makes me think I've corrupted
the parser. Basically, this is the first action that is hit,
opt_oob_record_list: {
$$ = NULL;
};
Any idea what could cause this? I'll do some more digging.
I've attached the bison input grammar and the test file that is
producing this behavior only after my patch is applied. Things work as
expected without my patch. I was hoping someone could glance at it
quickly and tell me if what I am seeing should be possible when bison is
working correctly.
Any tips in the right direction would probably save me hours of work. :)
Bob Rossi
%name-prefix="gdbmi_"
%push-parser
%locations
%error-verbose
%debug
%defines
%{
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "gdbmi_pt.h"
extern char *gdbmi_text;
extern int gdbmi_lex ( void );
void gdbmi_error (const char *s);
extern int gdbmi_lineno;
gdbmi_output_ptr tree;
void gdbmi_error (const char *s) {
fprintf ( stderr, "%s:%d Error %s", __FILE__, __LINE__, s );
if ( strcmp ( gdbmi_text, "\n" ) == 0 ) {
fprintf ( stderr, "%s:%d at end of line %d\n", __FILE__,
__LINE__, gdbmi_lineno );
} else {
fprintf ( stderr, "%s:%d at token(%s), line (%d)\n", __FILE__,
__LINE__, gdbmi_text, gdbmi_lineno );
gdbmi_lex();
fprintf ( stderr, "%s:%d before (%s)\n", __FILE__, __LINE__,
gdbmi_text );
}
}
%}
%token OPEN_BRACE /* { */
%token CLOSED_BRACE /* } */
%token OPEN_PAREN /* ( */
%token CLOSED_PAREN /* ) */
%token ADD_OP /* + */
%token MULT_OP /* * */
%token EQUAL_SIGN /* = */
%token TILDA /* ~ */
%token AT_SYMBOL /* @ */
%token AMPERSAND /* & */
%token OPEN_BRACKET /* [ */
%token CLOSED_BRACKET /* ] */
%token NEWLINE /* \n \r\n \r */
%token INTEGER_LITERAL /* A number 1234 */
%token STRING_LITERAL /* A string literal */
%token CSTRING /* "a string like \" this " */
%token COMMA /* , */
%token CARROT /* ^ */
%union {
struct gdbmi_output *u_output;
struct gdbmi_oob_record *u_oob_record;
struct gdbmi_result_record *u_result_record;
int u_result_class;
int u_async_record_choice;
struct gdbmi_result *u_result;
long u_token;
struct gdbmi_async_record *u_async_record;
struct gdbmi_stream_record *u_stream_record;
int u_async_class;
char *u_variable;
struct gdbmi_value *u_value;
struct gdbmi_tuple *u_tuple;
struct gdbmi_list *u_list;
int u_stream_record_choice;
}
%type <u_output> opt_output_list
%type <u_output> output_list
%type <u_output> output
%type <u_oob_record> oob_record
%type <u_oob_record> opt_oob_record_list
%type <u_result_record> opt_result_record
%type <u_result_record> result_record
%type <u_result_class> result_class
%type <u_async_record_choice> async_record_class
%type <u_result> result_list
%type <u_result> result
%type <u_token> opt_token
%type <u_token> token
%type <u_async_record> async_record
%type <u_stream_record> stream_record
%type <u_async_class> async_class
%type <u_variable> variable
%type <u_value> value
%type <u_value> value_list
%type <u_tuple> tuple
%type <u_list> list
%type <u_stream_record_choice> stream_record_class
%start opt_output_list
%%
opt_output_list: {
tree = NULL;
};
opt_output_list: output_list {
tree = $1;
};
output_list: output {
$$ = $1;
};
output_list: output_list output {
$$ = append_gdbmi_output ( $1, $2 );
};
output: opt_oob_record_list opt_result_record OPEN_PAREN variable CLOSED_PAREN
NEWLINE {
$$ = create_gdbmi_output ();
$$->oob_record = $1;
$$->result_record = $2;
if ( strcmp ( "gdb", $4 ) != 0 )
gdbmi_error ( "Syntax error, expected 'gdb'" );
free ( $4 );
} ;
opt_oob_record_list: {
$$ = NULL;
};
opt_oob_record_list: opt_oob_record_list oob_record NEWLINE {
$$ = append_gdbmi_oob_record ( $1, $2 );
};
opt_result_record: {
$$ = NULL;
};
opt_result_record: result_record NEWLINE {
$$ = $1;
};
result_record: opt_token CARROT result_class {
$$ = create_gdbmi_result_record ();
$$->token = $1;
$$->result_class = $3;
$$->result = NULL;
};
result_record: opt_token CARROT result_class COMMA result_list {
$$ = create_gdbmi_result_record ();
$$->token = $1;
$$->result_class = $3;
$$->result = $5;
};
oob_record: async_record {
$$ = create_gdbmi_oob_record();
$$->record = GDBMI_ASYNC;
$$->option.async_record = $1;
};
oob_record: stream_record {
$$ = create_gdbmi_oob_record();
$$->record = GDBMI_STREAM;
$$->option.stream_record = $1;
};
async_record: opt_token async_record_class async_class {
$$ = create_gdbmi_async_record ();
$$->token = $1;
$$->async_record = $2;
$$->async_class = $3;
};
async_record: opt_token async_record_class async_class COMMA result_list {
$$ = create_gdbmi_async_record ();
$$->token = $1;
$$->async_record = $2;
$$->async_class = $3;
$$->result = $5;
};
async_record_class: MULT_OP {
$$ = GDBMI_EXEC;
};
async_record_class: ADD_OP {
$$ = GDBMI_STATUS;
};
async_record_class: EQUAL_SIGN {
$$ = GDBMI_NOTIFY;
};
result_class: STRING_LITERAL {
if ( strcmp ( "done", gdbmi_text ) == 0 )
$$ = GDBMI_DONE;
else if ( strcmp ( "running", gdbmi_text ) == 0 )
$$ = GDBMI_RUNNING;
else if ( strcmp ( "connected", gdbmi_text ) == 0 )
$$ = GDBMI_CONNECTED;
else if ( strcmp ( "error", gdbmi_text ) == 0 )
$$ = GDBMI_ERROR;
else if ( strcmp ( "exit", gdbmi_text ) == 0 )
$$ = GDBMI_EXIT;
else
gdbmi_error ( "Syntax error, expected
'done|running|connected|error|exit" );
};
async_class: STRING_LITERAL {
if ( strcmp ( "stopped", gdbmi_text ) != 0 )
gdbmi_error ( "Syntax error, expected 'stopped'" );
$$ = GDBMI_STOPPED;
};
result_list: result {
$$ = append_gdbmi_result ( NULL, $1 );
};
result_list: result_list COMMA result {
$$ = append_gdbmi_result ( $1, $3 );
};
result: variable EQUAL_SIGN value {
$$ = create_gdbmi_result ();
$$->variable = $1;
$$->value = $3;
};
variable: STRING_LITERAL {
$$ = strdup ( gdbmi_text );
};
value_list: value {
$$ = append_gdbmi_value ( NULL, $1 );
};
value_list: value_list COMMA value {
$$ = append_gdbmi_value ( $1, $3 );
};
value: CSTRING {
$$ = create_gdbmi_value ();
$$->value_choice = GDBMI_CSTRING;
$$->option.cstring = strdup ( gdbmi_text );
};
value: tuple {
$$ = create_gdbmi_value ();
$$->value_choice = GDBMI_TUPLE;
$$->option.tuple = $1;
};
value: list {
$$ = create_gdbmi_value ();
$$->value_choice = GDBMI_LIST;
$$->option.list = $1;
};
tuple: OPEN_BRACE CLOSED_BRACE {
$$ = NULL;
};
tuple: OPEN_BRACE result_list CLOSED_BRACE {
$$ = create_gdbmi_tuple ();
$$->result = $2;
};
list: OPEN_BRACKET CLOSED_BRACKET {
$$ = NULL;
};
list: OPEN_BRACKET value_list CLOSED_BRACKET {
$$ = create_gdbmi_list ();
$$->list_choice = GDBMI_VALUE;
$$->option.value = $2;
};
list: OPEN_BRACKET result_list CLOSED_BRACKET {
$$ = create_gdbmi_list ();
$$->list_choice = GDBMI_RESULT;
$$->option.result = $2;
};
stream_record: stream_record_class CSTRING {
$$ = create_gdbmi_stream_record ();
$$->stream_record = $1;
$$->cstring = strdup ( gdbmi_text );
};
stream_record_class: TILDA {
$$ = GDBMI_CONSOLE;
};
stream_record_class: AT_SYMBOL {
$$ = GDBMI_TARGET;
};
stream_record_class: AMPERSAND {
$$ = GDBMI_LOG;
};
opt_token: {
$$ = -1;
};
opt_token: token {
$$ = $1;
};
token: INTEGER_LITERAL {
$$ = atol ( gdbmi_text );
};
~"GNU gdb 6.1-debian\n"
~"Copyright 2004 Free Software Foundation, Inc.\n"
~"GDB is free software, covered by the GNU General Public License, and you
are\n"
~"welcome to change it and/or distribute copies of it under certain
conditions.\n"
~"Type \"show copying\" to see the conditions.\n"
~"There is absolutely no warranty for GDB. Type \"show warranty\" for
details.\n"
~"This GDB was configured as \"i386-linux\"..."
~"Using host libthread_db library \"/lib/libthread_db.so.1\".\n"
~"\n"
(gdb)
&"b main\n"
^done
(gdb)
^running
(gdb)
*stopped,reason="breakpoint-hit",bkptno="1",thread-id="0",frame={addr="0x0804844f",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffffcf4"}],file="test.c",line="35"}
(gdb)
&"next\n"
^done,reason="end-stepping-range",thread-id="0",frame={addr="0x08048456",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffffcf4"}],file="test.c",line="36"}
(gdb)
&"step\n"
^done,reason="end-stepping-range",thread-id="0",frame={addr="0x0804845d",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffffcf4"}],file="test.c",line="39"}
(gdb)
&"\n"
^done
(gdb)
&"\n"
^done
(gdb)
&"step\n"
^done,reason="end-stepping-range",thread-id="0",frame={addr="0x08048418",func="long_func",args=[],file="test.c",line="20"}
(gdb)
&"finish\n"
^done,reason="function-finished",thread-id="0",frame={addr="0x08048462",func="main",args=[{name="argc",value="1"},{name="argv",value="0xbffffcf4"}],file="test.c",line="41"}
(gdb)
%option prefix="gdbmi_"
%option outfile="lex.yy.c"
%option yylineno
DIGIT [0-9]
L [a-zA-Z_]
T [0-9a-zA-Z_-]
IDENTIFIER {L}+{T}*
%{
#include <stdio.h>
#include "gdbmi_grammar.tab.h"
%}
%%
"^" { return CARROT; }
"," { return COMMA; }
"+" { return ADD_OP; }
"*" { return MULT_OP; }
"=" { return EQUAL_SIGN; }
"~" { return TILDA; }
"@" { return AT_SYMBOL; }
"&" { return AMPERSAND; }
"[" { return OPEN_BRACKET; }
"]" { return CLOSED_BRACKET; }
"{" { return OPEN_BRACE; }
"}" { return CLOSED_BRACE; }
"(" { return OPEN_PAREN; }
")" { return CLOSED_PAREN; }
\n { return NEWLINE; }
\r\n { return NEWLINE; }
\r { return NEWLINE; }
{DIGIT}+ { return INTEGER_LITERAL; }
[ \t\v\f] {}
{IDENTIFIER} { return STRING_LITERAL; }
\"(\\.|[^\\"])*\" { return CSTRING; }
%%
/*. { return STRING_LITERAL; }*/
int gdbmi_wrap ( void ) {
{
/* Silly impossible function call to stop warning of unused
functions */
if ( 0 ) {
yyunput(0, "");
}
}
return 1;
}