This page was produced by an automated import process, and may have formatting errors; feel free to fix.
At present GDB’s CLI is very much entangled in with the core of libgdb. Consequently, a client wishing to include the CLI in their interface needs to carefully co-ordinate its own and the CLI’s requirements.
It is suggested that the client set libgdb up to be bi-modal (alternate between CLI and client query modes). The notes below sketch out the theory:
The client registers itself as an observer of libgdb.
The client create and install cli-out builder using its own versions of the ui-file gdb_stderr, gdb_stdtarg and gdb_stdout streams.
The client creates a separate custom ui-out builder that is only used while making direct queries to libgdb.
When the client receives input intended for the CLI, it simply passes it along. Since the cli-out builder is installed by default, all the CLI output in response to that command is routed (pronounced rooted) through to the client controlled gdb_stdout et. al. streams. At the same time, the client is kept abreast of internal changes by virtue of being a libgdb observer.
The only restriction on the client is that it must wait until libgdb becomes idle before initiating any queries (using the client’s custom builder).