Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Bob Rossi <bob@brasko.net>
To: Russell Shaw <rjshaw@netspace.net.au>, gdb@sources.redhat.com
Subject: Re: GDB/MI Output Syntax
Date: Thu, 13 Jan 2005 02:23:00 -0000	[thread overview]
Message-ID: <20050113022254.GA8043@white> (raw)
In-Reply-To: <20050111193526.GA5699@white>

Hi,

Any feedback? Either everyone's really busy, no one cares, or everyone
love's this approach. At least we're all agreeing. :)

Since I haven't received any feedback, I'm going to write it this way. I
should have something workable within a week. Although, I don't know how
to load this into expect yet. I'm assuming I'll have to recompile expect
and link in tcl as a shared library, along with my extension.

Thanks,
Bob Rossi

On Tue, Jan 11, 2005 at 02:35:26PM -0500, Bob Rossi wrote:
> On Fri, Jan 07, 2005 at 02:16:29PM +1100, Russell Shaw wrote:
> > Bob Rossi wrote:
> > ...
> > >If Tcl is like C (struct, enum's, union's) I could easily put the parse
> > >tree declaration in some common file and generate both the C and the Tcl
> > >data structures. This part could be done in just a few days if I could
> > >get some guidance on how Tcl works.
> > 
> > A very comprehensive book: Pactical Programming in Tcl and Tk.
> > Another book that explains TCL and also Expect (probably of more
> > immediate use): Exploring Expect. Expect also has a large man page.
> > 
> > C and TCL is like comparing chalk and cheese. TCL is interpreted too.
> 
> Thanks for the info, I looked at "Practical Programming" and it helped me
> out a lot!
> 
> So, here is my initial design, can I get any feedback?
> 
> Basically, I have a parser that I generated using flex/bison. That
> parser is capable of parsing an MI output command and putting it into a
> syntax tree. This is all done in C.
> 
> To get the data into Tcl for the testsuite I had to write a Tcl
> extension. The design I chose from the Tcl side is something like this.
> 
> Here is part of the parse tree on the C side,
>    /**
>     * This is the root of a parsed GDB/MI Output command.
>     */
>    struct gdbmi_output {
>        /**
>         * Every output command has a list of optional oob_record's.
>         * This will be the head of the list, otherwise NULL.
>         */
>        gdbmi_oob_record_ptr oob_record;
> 
>        /**
>         * Every output command has an optional result_record.
>         * list, otherwise NULL.
>         */
>        gdbmi_result_record_ptr result_record;
> 
>        /** A pointer to the next output */
>        gdbmi_output_ptr next;
>    };
>    
> This is the Tcl side which understands how to access this data.
> 
> # ------------ 'struct gdbmi_output' documentation
> 
> #   This function will parse an MI output command and return a
> #   reference to the syntax tree created.
> #
> # Arguments:
> #   mi_output_command is the string representing the MI output
> #   command that should be parsed and returned.
> #
> # Results:
> #   The string representing the gdbmi_output record. This in itself
> #   is not very useful, but can be operated on by the gdbmi_* commands.
> #
> proc gdbmi_parse_output_record {mi_output_command}
> 
> #   This function takes in a parse tree and get's the gdbmi_oob_record
> #   from the parse tree context.
> #
> # Arguments:
> #   gdbmi_output is the gdbmi_output command that came from
> #   gdbmi_parse_output_record
> #
> # Results:
> #   A string representing an gdbmi_oob_record record
> #
> proc gdbmi_get_oob_record {gdbmi_output}
> 
> #   This function takes in a parse tree and get's the gdbmi_result_record
> #   from the parse tree context.
> #
> # Arguments:
> #   gdbmi_output is the gdbmi_output command that came from
> #   gdbmi_parse_output_record
> #
> # Results:
> #   A string representing a gdbmi_result_record record
> #
> proc gdbmi_get_result_record {gdbmi_output}
> 
> 
> >From this, I think it would be possible to query the syntax tree in the
> Tcl. This would allow the testsuite to verify the syntax and possible the
> semantics of the gdb/mi output commands.
> 
> This is the approach I'm working towards. Any comments or suggestions?
> 
> In the end, it would also be possible to have the parser parse the
> output command and then write another tcl command that fills in a data
> structure for the specific command under test. This way the scripts do
> not have to deal with the syntax tree directly, but an in memory
> representation of the MI output command. That would look something like
> this,
>    set mi_output_command [gdbmi_parse $mi_output_command]
>    set mi_break_output [gdbmi_get_breakoutput $mi_output_command]
>  
> The downside to this approach is creating in memory representations of
> the specific MI commands, the upside to this is not making the
> testcase's deal with the syntax tree directly. Also, front ends' could
> link to the C parser and get the in memory representation.
> 
> Thanks,
> Bob Rossi


  reply	other threads:[~2005-01-13  2:23 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2005-01-13  2:46                   ` Intrusive GDB Symbol Lookup when debugging remotely David Steven Trollope
2005-01-22  4:25                     ` Dave Trollope
2005-01-24 19:48                       ` Andrew Cagney
2005-01-24 19:54                         ` David Steven Trollope
2005-03-18 16:29                     ` Linux Realtime Scheduling Option David Steven Trollope
2005-03-18 18:12                       ` Daniel Jacobowitz
2005-03-21 19:21                         ` David Steven Trollope
2005-03-21 19:33                           ` Daniel Jacobowitz
2005-03-22  3:04                             ` Dave Trollope
2005-03-22  4:06                               ` Daniel Jacobowitz
2005-01-06  0:28 GDB/MI Output Syntax 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
  -- strict thread matches above, loose matches on Subject: below --
2004-08-25 15:44 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
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050113022254.GA8043@white \
    --to=bob@brasko.net \
    --cc=gdb@sources.redhat.com \
    --cc=rjshaw@netspace.net.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox