public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* GDB/MI Output Syntax
@ 2004-08-25 15:44 Bob Rossi
  2004-08-25 15:57 ` Michael Chastain
  2004-08-26 21:13 ` Andrew Cagney
  0 siblings, 2 replies; 36+ messages in thread
From: Bob Rossi @ 2004-08-25 15:44 UTC (permalink / raw)
  To: gdb

Hi,

Along with the newline changes, there are 2 other changes that I propose
to the grammar. They are,

async-record   ==> exec-async-output | status-async-output | notify-async-output
exec-async-output    ==> [ token ] "*" async-output
status-async-output  ==> [ token ] "+" async-output
notify-async-output  ==> [ token ] "=" async-output]

to 

   async-record ==> [token] async-record-kind async-output
   async-record-kind ==> "*" | "+" | "="

however, if you really would like to keep the *-async-output rules, we
could do

   async-record ==> [token] async-record-kind async-output
   async-record-kind ==> exec-async-output | status-async-output | notify-async-output
   exec-async-output    ==> "*"
   status-async-output  ==> "+"
   notify-async-output  ==> "=" 

The second change is identical but refers to the rules of
   stream-record ==> console-stream-output | target-stream-output | log-stream-output
   console-stream-output ==> "~" c-string
   target-stream-output ==> "@" c-string
   log-stream-output ==> "&" c-string

to
   stream-record => stream-record-kind c-string
   stream-record-kind => "~" | "@" | "&"

The reason it would be helpful to modify the grammar in this way is that
it leads to a more elegant form when trying to build an intermediate
representation. At the parse level of 'stream-record' or 'async-record'
you have all of the information necessary in order to populate a
structure with data. Otherwise, the information is a few levels down
stream.

Does this sound reasonable? and again, should I post a new grammar with
the new lines moved to the 'output' production and with the changes I
have above?

Thanks,
Bob Rossi

^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: GDB/MI Output Syntax
@ 2005-01-06  0:28 Paul Schlie
  2005-01-06  0:32 ` Kip Macy
  2005-01-06  1:10 ` Bob Rossi
  0 siblings, 2 replies; 36+ messages in thread
From: Paul Schlie @ 2005-01-06  0:28 UTC (permalink / raw)
  To: gdb

> Bob Rossi wrote:
>> Michael Chastain wrote:
>> ...
>> It would be much better to use TCL data structures to parse MI rather
>> than regular expressions.  I had a great experience getting away from
>> regular expressions with cp_test_ptype_class.
>> 
>> It's still a dozen host arches (actually, a dozen build arches,
>> TCL runs on build machine).  But we're not debugging a target program
>> with shared libraries, we're just using one as a host.
>> ...
>
> Hey, has anything ever evolved out of this?
> 
> Here is my road map for developing an MI parser for CGDB.
>   
>   1. Create a grammar that is easily translated into LR(1)
>   2. Generate the parser with flex and bison
>   3. Have the parser test the output of the GDB MI testsuite
>      (Don't know how to do this)
>   4. Have the parser verify the semantics of GDB's output.
> ...

Or how about a basic scheme (<keyword> <expression> ...) syntax, can't get
much simpler or more flexible than that, not to mention it's fairly straight
forward easy to read/parse/extend and may realativly easily accomplished by
imbedding an open-source basic scheme interpreter, vs re-inventing the
wheel; nearly eliminating the necessity for steps 1, 2; and longer term
could easily eliminate gdb's present less than flexible command interpreter,
as there's truly no good reason for the two to be distinct. (Not a new
notion; but possibly timely and arguably far more productive than developing
yet another yet another syntax/language/intepreter/etc.)


 


^ permalink raw reply	[flat|nested] 36+ messages in thread
[parent not found: <1093622671.2836.ezmlm@sources.redhat.com>]
* GDB/MI Output Syntax
@ 2004-08-24  3:12 Bob Rossi
  2004-08-24  4:15 ` Michael Chastain
  0 siblings, 1 reply; 36+ messages in thread
From: Bob Rossi @ 2004-08-24  3:12 UTC (permalink / raw)
  To: gdb

Hi,

I am working with the MI grammer. Thanks to Michael Chastain's lexer
hack I now have a working LL(1) grammer. However, I am a little
disappointed in the fact that I need to do this hack. Shouldn't the MI
grammar be unambiguous?

I understand that everyone in this community hates XML, so I know that
is a closed door, however, is it possible to change the MI grammar so
that it is not ambigious? 

Anyways, now that the parser is written, I fired up GDB and sent 
   ~"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\"."
   ~"\n"
   (gdb) 

to my parser. The problem is, it was a parse error. This simple output
from GDB does not adher to the GDB/MI grammar! I have the very simple
patch to the grammar that makes this example work, however, I am scared
that the more I parse, the less will work. Does anyone know first hand
if this is true? If it is true, I propose that we at least make GDB
adher to the grammer.

Once my parser is finalized, I propose we validate the output of GDB
against it somehow in the testsuite. Maybe by making a gdbmi-validator
program that simply invokes GDB, passes all input to GDB and parse's all
output, along with passing output back to caller. This would make a
trasparent validator of everything GDB/MI says. What does anyone think?

As far as the error's are concerned, can the grammar be updated?
Updating the grammar to match the output of GDB is propably OK, since
most parser's somehow don't care that it doesn't match the grammar as it
is. Why is that? (this is one point where XML shines)

Thanks,
Bob Rossi

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2005-01-13  2:23 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-25 15:44 GDB/MI Output Syntax Bob Rossi
2004-08-25 15:57 ` Michael Chastain
2004-08-25 19:37   ` Bob Rossi
2004-08-26 14:01     ` Michael Chastain
2004-08-26 18:31       ` Bob Rossi
2004-08-26 20:44         ` Michael Chastain
2004-08-26 20:52           ` Keith Seitz
2004-08-26 22:16             ` Michael Chastain
2004-08-26 22:03           ` Bob Rossi
2004-08-26 23:06             ` Michael Chastain
2004-08-26 21:13 ` Andrew Cagney
2004-08-26 21:25   ` Bob Rossi
2004-08-26 22:46     ` Michael Chastain
2004-08-27 10:14       ` Eli Zaretskii
2004-08-26 22:41   ` Michael Chastain
  -- strict thread matches above, loose matches on Subject: below --
2005-01-06  0:28 Paul Schlie
2005-01-06  0:32 ` Kip Macy
2005-01-06  0:49   ` Paul Schlie
2005-01-06  1:10 ` Bob Rossi
2005-01-06  1:36   ` Paul Schlie
     [not found] <1093622671.2836.ezmlm@sources.redhat.com>
2004-08-27 17:56 ` Jim Ingham
2004-08-27 19:12   ` Michael Chastain
2005-01-05 23:27     ` Bob Rossi
2005-01-06  4:48       ` Eli Zaretskii
2005-01-06 23:31         ` Bob Rossi
2005-01-07  0:36           ` Jim Ingham
2005-01-07  1:12             ` Bob Rossi
2005-01-07  3:12               ` Russell Shaw
2005-01-11 19:35                 ` Bob Rossi
2005-01-13  2:23                   ` Bob Rossi
2004-08-24  3:12 Bob Rossi
2004-08-24  4:15 ` Michael Chastain
2004-08-24 12:30   ` Bob Rossi
2004-08-24 12:50     ` Michael Chastain
2004-08-24 18:59   ` Andrew Cagney
2004-08-24 19:07     ` Bob Rossi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).