This strategy outline the recommended strategy for implementing each of the components.
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:
show ...
info ...
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) ...)
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.
The control interface shall be based on GDB's existing set of run
/ stop
et.al. commands.
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).
The event loop is beyond the scope of this document.
Although the initialization mechanism used by optional client's is still undefined, the below outlines one possible sequence: