[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


Implementation

This strategy outline the recommended strategy for implementing each of the components.

Query

The set of possible requests, and their behavour will initially be based on a subset of the existing CLI command set. In particular the commands:

would be used as a starting point.

Rather than clone those commands, the query methods would be implemented by modifying the existing code base so that it "builds" each result. The existing CLI would call the code with a simple text builder (`cli-out.[hc]'?); GUILE would make the same call but with its own complicated builder (`guile-out.[hc]'?).

As an example of the change required, the function breakpoint_1() in `breakpoint.c' would be modified from:

annotate_breakpoint (bs->breakpoint_at->number);
printf_filtered ("\nBreakpoint %d, ", bs->breakpoint_at->number);

to:

annotate_breakpoint (bs->breakpoint_at->number);
ui_out_text (uiout, "\nBreakpoint ");
ui_out_field_int (uiout, "bkptno", bs->breakpoint_at->number);
ui_out_text (uiout, ", ");

A GUILE builder would construct the internal structure:

(..... (bkptno 1) ...)

Notify

The notify mechanism is based on the hook system already provided to GDBtk. The mechanism would need to be formalized (`gdb-hooks.[hc]') (say).

The set of notify hooks would be expected to evolve over time as the needs of the clients are better understood.

Operations

The control interface shall be based on GDB's existing set of run / stop et.al. commands.

ui-stream / gdb-file

The mechanism for capturing output directed to various streams (such as output from the remote target) is the gdb_file. Apart from a number of minor refinements, that mechanism is already in place.

In the near term, gdb-file should be broken out of `utils.c' and moved to a new file `ui-stream.[hc]' (say).

event-loop

The event loop is beyond the scope of this document.

Start up

Although the initialization mechanism used by optional client's is still undefined, the below outlines one possible sequence:

  1. The alternative client is linked in with GDB. The top-level code contained in `XXX-top.c'. This file includes a standard __initialize_XXX function.
  2. When GDB is started --ui=NAME is passed as an argument. GDB saves NAME in a global variable.
  3. Eventually control reaches __initialize_XXX. That function checks to see if it matches NAME and if it does, registers its custom version of the main event loop.
  4. GDB continues initialization and then, eventually calls XXX's custom event loop.


[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]