Debugging with GDB: GDB/MI Support Commands

Next: GDB/MI Miscellaneous Commands, Previous: GDB/MI Ada Exceptions Commands, Up: GDB/MI   [Contents][Index]


27.23 GDB/MI Support Commands

Since new commands and features get regularly added to GDB/MI, some commands are available to help front-ends query the debugger about support for these capabilities. Similarly, it is also possible to query GDB about target support of certain features.

The -info-gdb-mi-command Command

Synopsis

 -info-gdb-mi-command cmd_name

Query support for the GDB/MI command named cmd_name.

Note that the dash (-) starting all GDB/MI commands is technically not part of the command name (see GDB/MI Input Syntax), and thus should be omitted in cmd_name. However, for ease of use, this command also accepts the form with the leading dash.

GDB Command

There is no corresponding GDB command.

Result

The result is a tuple. There is currently only one field:

‘exists’

This field is equal to "true" if the GDB/MI command exists, "false" otherwise.

Example

Here is an example where the GDB/MI command does not exist:

-info-gdb-mi-command unsupported-command
^done,command={exists="false"}

And here is an example where the GDB/MI command is known to the debugger:

-info-gdb-mi-command symbol-list-lines
^done,command={exists="true"}

The -list-features Command

Returns a list of particular features of the MI protocol that this version of gdb implements. A feature can be a command, or a new field in an output of some command, or even an important bugfix. While a frontend can sometimes detect presence of a feature at runtime, it is easier to perform detection at debugger startup.

The command returns a list of strings, with each string naming an available feature. Each returned string is just a name, it does not have any internal structure. The list of possible feature names is given below.

Example output:

(gdb) -list-features
^done,result=["feature1","feature2"]

The current list of features is:

‘frozen-varobjs’

Indicates support for the -var-set-frozen command, as well as possible presense of the frozen field in the output of -varobj-create.

‘pending-breakpoints’

Indicates support for the -f option to the -break-insert command.

‘python’

Indicates Python scripting support, Python-based pretty-printing commands, and possible presence of the ‘display_hint’ field in the output of -var-list-children

‘thread-info’

Indicates support for the -thread-info command.

‘data-read-memory-bytes’

Indicates support for the -data-read-memory-bytes and the -data-write-memory-bytes commands.

‘breakpoint-notifications’

Indicates that changes to breakpoints and breakpoints created via the CLI will be announced via async records.

‘ada-task-info’

Indicates support for the -ada-task-info command.

‘language-option’

Indicates that all GDB/MI commands accept the --language option (see Context management).

‘info-gdb-mi-command’

Indicates support for the -info-gdb-mi-command command.

‘undefined-command-error-code’

Indicates support for the "undefined-command" error code in error result records, produced when trying to execute an undefined GDB/MI command (see GDB/MI Result Records).

‘exec-run-start-option’

Indicates that the -exec-run command supports the --start option (see GDB/MI Program Execution).

The -list-target-features Command

Returns a list of particular features that are supported by the target. Those features affect the permitted MI commands, but unlike the features reported by the -list-features command, the features depend on which target GDB is using at the moment. Whenever a target can change, due to commands such as -target-select, -target-attach or -exec-run, the list of target features may change, and the frontend should obtain it again. Example output:

(gdb) -list-target-features
^done,result=["async"]

The current list of features is:

‘async’

Indicates that the target is capable of asynchronous command execution, which means that GDB will accept further commands while the target is running.

‘reverse’

Indicates that the target is capable of reverse execution. See Reverse Execution, for more information.


Next: GDB/MI Miscellaneous Commands, Previous: GDB/MI Ada Exceptions Commands, Up: GDB/MI   [Contents][Index]