This page was produced by an automated import process, and may have formatting errors; feel free to fix.

Command Interpreter

The command interpreter in GDB is fairly simple. It is designed to allow for the set of commands to be augmented dynamically, and also has a recursive subcommand capability, where the first argument to a command may itself direct a lookup on a different command list.

For instance, the ‘set’ command just starts a lookup on the setlist command list, while ‘set thread’ recurses to the set_thread_cmd_list.

To add commands in general, use add_cmd. add_com adds to the main command list, and should be used for those commands. The usual place to add commands is in the _initialize_''xyz'' routines at the ends of most source files.

To add paired ‘set’ and ‘show’ commands, use add_setshow_cmd or add_setshow_cmd_full. The former is a slightly simpler interface which is useful when you don’t need to further modify the new command structures, while the latter returns the new command structures for manipulation.

Before removing commands from the command set it is a good idea to deprecate them for some time. Use deprecate_cmd on commands or aliases to set the deprecated flag. deprecate_cmd takes a struct cmd_list_element as it’s first argument. You can use the return value from add_com or add_cmd to deprecate the command immediately after it is created.

The first time a command is used the user will be warned and offered a replacement (if one exists). Note that the replacement string passed to deprecate_cmd should be the full name of the command, i.e., the entire string the user should type at the command line. [UI_002dIndependent-Output ]

None: Internals Command-Interpreter (last edited 2013-08-20 23:40:29 by StanShebs)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.