events
news
The Linux Foundation
 
 
DMI Wiki Content

From The Linux Foundation

Back to Main DMI page (http://freestandards.org/en/DMI)

Contents

[edit] DMI Specification

The content in this section of the wiki contains MI commands from the gdb manual. It will be the basis of the DMI specification.

[edit] Notation

This specification uses the following notation:

  • | separates two alternatives.
  • [ something ] indicates that something is optional: it may or may not be given.
  • ( group )* means that group inside the parentheses may repeat zero or more times.
  • ( group )+ means that group inside the parentheses may repeat one or more times.
  • "string" means a literal string.

[edit] Input Syntax

command ==> 
    cli-command | mi-command
cli-command ==>
    [ token ] cli-command nl, where cli-command is any existing GDB CLI command.
mi-command ==>
    [ token ] "-" operation ( " " option )* [ " --" ] ( " " parameter )* nl
token ==>
    "any sequence of digits"
option ==>
    "-" parameter [ " " parameter ]
parameter ==>
    non-blank-sequence | c-string
operation ==>
    any of the operations described in this chapter
non-blank-sequence ==>
    anything, provided it doesn't contain special characters such as "-", nl, """ and of course " "
c-string ==>
    """ seven-bit-iso-c-string-content """
nl ==>
    CR | CR-LF
Notes
  • The CLI commands are still handled by the MI interpreter; their output is described below.
  • The token, when present, is passed back when the command finishes.
  • Some MI commands accept optional arguments as part of the parameter list. Each option is identified by a leading `-' (dash) and may be followed by an optional argument parameter. Options occur first in the parameter list and can be delimited from normal parameters using `--' (this is useful when some parameters begin with a dash).
Pragmatics
  • We want easy access to the existing CLI syntax (for debugging).
  • We want it to be easy to spot a MI operation.

[edit] Output Syntax

The output from GDB/MI consists of zero or more out-of-band records followed, optionally, by a single result record. This result record is for the most recent command. The sequence of output records is terminated by `(gdb)'.

If an input command was prefixed with a token then the corresponding output for that command will also be prefixed by that same token.

output ==>
    ( out-of-band-record )* [ result-record ] "(gdb)" nl
result-record ==>
    [ token ] "^" result-class ( "," result )* nl
out-of-band-record ==>
    async-record | stream-record
async-record ==>
    exec-async-output | status-async-output | notify-async-output
exec-async-output ==>
    [ token ] "*" async-output
status-async-output ==>
    [ token ] "+" async-output
notify-async-output ==>
    [ token ] "=" async-output
async-output ==>
    async-class ( "," result )* nl
result-class ==>
    "done" | "running" | "connected" | "error" | "exit"
async-class ==>
    "stopped" | others (where others will be added depending on the needs--this is still in development).
result ==>
    variable "=" value
variable ==>
    string
value ==>
    const | tuple | list
const ==>
    c-string
tuple==>
    "{}" | "{" result ( "," result )* "}"
list ==>
    "[]" | "[" value ( "," value )* "]" | "[" result ( "," result )* "]"
stream-record ==>
    console-stream-output | target-stream-output | log-stream-output
console-stream-output ==>
    "~" c-string
target-stream-output ==>
    "@" c-string
log-stream-output ==>
    "&" c-string
nl ==>
    CR | CR-LF
token ==>
    any sequence of digits
Notes
  • All output sequences end in a single line containing a period.
  • The token is from the corresponding request. If an execution command is interrupted by the `-exec-interrupt' command, the token associated with the `*stopped' message is the one of the original execution command, not the one of the interrupt command.
  • status-async-output contains on-going status information about the progress of a slow operation. It can be discarded. All status output is prefixed by `+'.
  • exec-async-output contains asynchronous state change on the target (stopped, started, disappeared). All async output is prefixed by `*'.
  • notify-async-output contains supplementary information that the client should handle (e.g., a new breakpoint information). All notify output is prefixed by `='.
  • console-stream-output is output that should be displayed as is in the console. It is the textual response to a CLI command. All the console output is prefixed by `~'.
  • target-stream-output is the output produced by the target program. All the target output is prefixed by `@'.
  • log-stream-output is output text coming from GDB's internals, for instance messages that should be displayed as part of an error log. All the log output is prefixed by `&'.
  • New GDB/MI commands should only output lists containing values.

See section #Stream Records, for more details about the various output records.

[edit] Compatibility with CLI

To help users familiar with GDB's existing CLI interface, GDB/MI accepts existing CLI commands. As specified by the syntax, such commands can be directly entered into the GDB/MI interface and GDB will respond.

This mechanism is provided as an aid to developers of GDB/MI clients and not as a reliable interface into the CLI. Since the command is being interpreteted in an environment that assumes GDB/MI behaviour, the exact output of such commands is likely to end up being an un-supported hybrid of GDB/MI and CLI output.

[edit] Version Numbers

The application which takes the MI output and presents the state of the program being debugged to the user is called a front end.

Although GDB/MI is still incomplete, it is currently being used by a variety of front ends to GDB. This makes it difficult to introduce new functionality without breaking existing usage. This section tries to minimize the problems by describing how the protocol might change.

Some changes in MI need not break a carefully designed front end, and for these the MI version will remain unchanged. The following is a list of changes that may occur within one level, so front ends should parse MI output in a way that can handle them:

  • New MI commands may be added.
  • New fields may be added to the output of any MI command.

If the changes are likely to break front ends, the MI version level will be increased by one. This will allow the front end to parse the output according to the MI version. Apart from mi0, new versions of GDB will not support old versions of MI and it will be the responsibility of the front end to work with the new one.

[edit] Output Records

[edit] Result Records

In addition to a number of out-of-band notifications, the response to a GDB/MI command includes one of the following result indications:

"^done" [ "," results ]

The synchronous operation was successful, results are the return values.

"^running"

The asynchronous operation was successfully started. The target is running.

"^connected"

GDB has connected to a remote target.

"^error" "," c-string

The operation failed. The c-string contains the corresponding error message.

"^exit"

GDB has terminated.

[edit] Stream Records

GDB internally maintains a number of output streams: the console, the target, and the log. The output intended for each of these streams is funneled through the GDB/MI interface using stream records.

Each stream record begins with a unique prefix character which identifies its stream (see section #Output Syntax). In addition to the prefix, each stream record contains a string-output. This is either raw text (with an implicit new line) or a quoted C string (which does not contain an implicit newline).

"~" string-output

The console output stream contains text that should be displayed in the CLI console window. It contains the textual responses to CLI commands.

"@" string-output

The target output stream contains any textual output from the running target.

"&" string-output

The log stream contains debugging messages being produced by GDB's internals.

[edit] Out-of-band Records

Out-of-band records are used to notify the GDB/MI client of additional changes that have occurred. Those changes can either be a consequence of GDB/MI (e.g., a breakpoint modified) or a result of target activity (e.g., target stopped).

The following is a preliminary list of possible out-of-band records. In particular, the exec-async-output records.

*stopped,reason="reason"

reason can be one of the following:

breakpoint-hit 

A breakpoint was reached.

watchpoint-trigger 

A watchpoint was triggered.

read-watchpoint-trigger 

A read watchpoint was triggered.

access-watchpoint-trigger 

An access watchpoint was triggered.

function-finished 

An -exec-finish or similar CLI command was accomplished.

location-reached 

An -exec-until or similar CLI command was accomplished.

watchpoint-scope 

A watchpoint has gone out of scope.

end-stepping-range 

An -exec-next, -exec-next-instruction, -exec-step, -exec-step-instruction or similar CLI command was accomplished.

exited-signalled 

The inferior exited because of a signal.

exited 

The inferior exited.

exited-normally 

The inferior exited normally.

signal-received 

A signal was received by the inferior.

[edit] Command Description Format

The remaining sections describe blocks of commands. Each block of commands is laid out in a fashion similar to this section.

Note the the line breaks shown in the examples are here only for readability. They don't appear in the real output. Also note that the commands with a non-available example (N.A.) are not yet implemented.

Motivation 

The motivation for this collection of commands.

Introduction 

A brief introduction to this collection of commands as a whole.

Commands 

For each command in the block, the following is described:

Synopsis 

-command args...

Result 

[edit] Breakpoint Table Commands

This section documents GDB/MI commands for manipulating breakpoints.

[edit] -break-after

Synopsis 
-break-after number count

The breakpoint number number is not in effect until it has been hit count times. To see how this is reflected in the output of the `-break-list' command, see the description of the `-break-list' command below.

Result

[edit] -break-condition

Synopsis 
-break-condition number expr

Breakpoint number will stop the program only if the condition in expr is true. The condition becomes part of the `-break-list' output (see the description of the `-break-list' command below).

Result

[edit] -break-delete

Synopsis 
-break-delete ( breakpoint )+

Delete the breakpoint(s) whose number(s) are specified in the argument list. This is obviously reflected in the breakpoint list.

Result

[edit] -break-disable

Synopsis 
-break-disable ( breakpoint )+

Disable the named breakpoint(s). The field `enabled' in the break list is now set to `n' for the named breakpoint(s).

Result

[edit] -break-enable

Synopsis 
-break-enable ( breakpoint )+

Enable (previously disabled) breakpoint(s).

Result

[edit] -break-info

Synopsis 
-break-info breakpoint

Get information about a single breakpoint.

Result

[edit] -break-insert

Synopsis 
-break-insert [ -t ] [ -h ] [ -r ] [ -c condition ] [ -i ignore-count ] [ -p thread ] [ line | addr ]

If specified, line, can be one of:

function
filename:linenum
filename:function
*address

The possible optional parameters of this command are:

`-t'

Insert a temporary breakpoint.

`-h'

Insert a hardware breakpoint.

`-c condition'

Make the breakpoint conditional on condition.

`-i ignore-count'

Initialize the ignore-count.

`-r'

Insert a regular breakpoint in all the functions whose names match the given regular expression. Other flags are not applicable to regular expresson.

Result

The result is in the form:

^done,bkpt={number="number",type="type",disp="del"|"keep",
enabled="y"|"n",addr="hex",func="funcname",file="filename",
fullname="full_filename",line="lineno",times="times"}

where number is the GDB number for this breakpoint, funcname is the name of the function where the breakpoint was inserted, filename is the name of the source file which contains this function, lineno is the source line number within that file and times the number of times that the breakpoint has been hit (always 0 for -break-insert but may be greater for -break-info or -break-list which use the same output).

Note: this format is open to change.

[edit] -break-list

Synopsis
-break-list

Displays the list of inserted breakpoints.

Result

The breakpoint list has the following fields:

`Number'

number of the breakpoint

`Type'

type of the breakpoint: `breakpoint' or `watchpoint'

`Disposition'

should the breakpoint be deleted or disabled when it is hit: `keep' or `nokeep'

`Enabled'

is the breakpoint enabled or no: `y' or `n'

`Address'

memory location at which the breakpoint is set

`What'

logical location of the breakpoint, expressed by function name, file name, line number

`Times'

number of times the breakpoint has been hit

If there are no breakpoints or watchpoints, the BreakpointTable body field is an empty list.

[edit] -break-watch

Synopsis
-break-watch [ -a | -r ]

Create a watchpoint. With the `-a' option it will create an access watchpoint, i.e. a watchpoint that triggers either on a read from or on a write to the memory location. With the `-r' option, the watchpoint created is a read watchpoint, i.e. it will trigger only when the memory location is accessed for reading. Without either of the options, the watchpoint created is a regular watchpoint, i.e. it will trigger when the memory location is accessed for writing. See section #Setting Watchpoints.

Note that `-break-list' will report a single list of watchpoints and breakpoints inserted.

Result

[edit] Program Context Commands

[edit] -exec-arguments

Synopsis 
-exec-arguments args

Set the inferior program arguments, to be used in the next `-exec-run'.

Result

[edit] -exec-show-arguments

Synopsis 
-exec-show-arguments

Print the arguments of the program.

Result

[edit] -environment-cd

Synopsis 
-environment-cd pathdir

Set GDB's working directory.

Result

[edit] -environment-directory

Synopsis 
-environment-directory [ -r ] [ pathdir ]+

Add directories pathdir to beginning of search path for source files. If the `-r' option is used, the search path is reset to the default search path. If directories pathdir are supplied in addition to the `-r' option, the search path is first reset and then addition occurs as normal. Multiple directories may be specified, separated by blanks. Specifying multiple directories in a single command results in the directories added to the beginning of the search path in the same order they were presented in the command. If blanks are needed as part of a directory name, double-quotes should be used around the name. In the command output, the path will show up separated by the system directory-separator character. The directory-seperator character must not be used in any directory name. If no directories are specified, the current search path is displayed.

Result

[edit] -environment-path

Synopsis 
-environment-path [ -r ] [ pathdir ]+

Add directories pathdir to beginning of search path for source files. If the `-r' option is used, the search path is reset to the default search path. If directories pathdir are supplied in addition to the `-r' option, the search path is first reset and then addition occurs as normal. Multiple directories may be specified, separated by blanks. Specifying multiple directories in a single command results in the directories added to the beginning of the search path in the same order they were presented in the command. If blanks are needed as part of a directory name, double-quotes should be used around the name. In the command output, the path will show up separated by the system directory-separator character. The directory-seperator character must not be used in any directory name. If no directories are specified, the current path is displayed.

Result

[edit] -environment-pwd

Synopsis 
-environment-pwd

Show the current working directory.

Result

[edit] Thread Commands

[edit] -thread-info

Synopsis 
-thread-info
Result

[edit] -thread-list-all-threads

Synopsis 
-thread-list-all-threads
Result

[edit] -thread-list-ids

Synopsis 
-thread-list-ids

Produces a list of the currently known GDB thread ids. At the end of the list it also prints the total number of such threads.

Result

[edit] -thread-select

Synopsis 
-thread-select threadnum

Make threadnum the current thread. It prints the number of the new current thread, and the topmost frame for that thread.

Result

[edit] Program Execution Commands

These are the asynchronous commands which generate the out-of-band record `*stopped'. Currently GDB only really executes asynchronously with remote targets and this interaction is mimicked in other cases.

[edit] -exec-continue

Synopsis 
-exec-continue

Resumes the execution of the inferior program until a breakpoint is encountered, or until the inferior exits.

Result

[edit] -exec-finish

Synopsis 
-exec-finish

Resumes the execution of the inferior program until the current function is exited. Displays the results returned by the function.

Result

[edit] -exec-interrupt

Synopsis 
-exec-interrupt

Interrupts the background execution of the target. Note how the token associated with the stop message is the one for the execution command that has been interrupted. The token for the interrupt itself only appears in the `^done' output. If the user is trying to interrupt a non-running program, an error message will be printed.

Result

[edit] -exec-next

Synopsis 
-exec-next

Resumes execution of the inferior program, stopping when the beginning of the next source line is reached.

Result

[edit] -exec-next-instruction

Synopsis 
-exec-next-instruction

Executes one machine instruction. If the instruction is a function call, continues until the function returns. If the program stops at an instruction in the middle of a source line, the address will be printed as well.

Result

[edit] -exec-return

Synopsis 
-exec-return

Makes current function return immediately. Doesn't execute the inferior. Displays the new current frame.

Result

[edit] -exec-run

Synopsis 
-exec-run

Starts execution of the inferior from the beginning. The inferior executes until either a breakpoint is encountered or the program exits. In the latter case the output will include an exit code, if the program has exited exceptionally.

Result

[edit] -exec-step

Synopsis 
-exec-step

Resumes execution of the inferior program, stopping when the beginning of the next source line is reached, if the next source line is not a function call. If it is, stop at the first instruction of the called function.

Result

[edit] -exec-step-instruction

Synopsis 
-exec-step-instruction

Resumes the inferior which executes one machine instruction. The output, once GDB has stopped, will vary depending on whether we have stopped in the middle of a source line or not. In the former case, the address at which the program stopped will be printed as well.

Result

[edit] -exec-until

Synopsis 
-exec-until [ location ]

Executes the inferior until the location specified in the argument is reached. If there is no argument, the inferior executes until a source line greater than the current one is reached. The reason for stopping in this case will be `location-reached'.

Result


[edit] Stack Manipulation Commands

[edit] -stack-info-frame

Synopsis 
-stack-info-frame

Get info on the selected frame.

Result 

[edit] -stack-info-depth

Synopsis 
-stack-info-depth [ max-depth ]

Return the depth of the stack. If the integer argument max-depth is specified, do not count beyond max-depth frames.

Result 

[edit] -stack-list-arguments

Synopsis 
-stack-list-arguments show-values [ low-frame high-frame ]

Display a list of the arguments for the frames between low-frame and high-frame (inclusive). If low-frame and high-frame are not provided, list the arguments for the whole call stack.

The show-values argument must have a value of 0 or 1. A value of 0 means that only the names of the arguments are listed, a value of 1 means that both names and values of the arguments are printed.

Result 

[edit] -stack-list-frames

Synopsis 
-stack-list-frames [ low-frame high-frame ]

List the frames currently on the stack.

Result 

For each frame it displays the following info:

`level

The frame number, 0 being the topmost frame, i.e. the innermost function.

`addr

The $pc value for that frame.

`func

Function name.

`file

File name of the source file where the function lives.

`line

Line number corresponding to the $pc.

If invoked without arguments, this command prints a backtrace for the whole stack. If given two integer arguments, it shows the frames whose levels are between the two arguments (inclusive). If the two arguments are equal, it shows the single frame at the corresponding level.

[edit] -stack-list-locals

Synopsis 
-stack-list-locals print-values

Display the local variable names for the selected frame. If print-values is 0 or --no-values, print only the names of the variables; if it is 1 or --all-values, print also their values; and if it is 2 or --simple-values, print the name, type and value for simple data types and the name and type for arrays, structures and unions. In this last case, a frontend can immediately display the value of simple data types and create variable objects for other data types when the the user wishes to explore their values in more detail.

Result 

[edit] -stack-select-frame

Synopsis 
-stack-select-frame framenum

Change the selected frame. Select a different frame framenum on the stack.

Result 

[edit] Variable Object Commands

Variable objects are provided to support the implementation of a variable debugger window (locals, watched expressions, etc.). The original concept was developed for the Insight debugger.

Note: In addition to the set of operations described here, we expect the GUI implementation of a variable window to require, at least, the following operations:

-gdb-show output-radix
-stack-list-arguments
-stack-list-locals
-stack-select-frame

The basic idea behind variable objects is the creation of a named object to represent a variable, an expression, a memory location or even a CPU register. For each object created, a set of operations is available for examining or changing its properties.

Furthermore, complex data types, such as C structures, are represented in a tree format. For instance, the struct type variable is the root and the children will represent the struct members. If a child is itself of a complex type, it will also have children of its own. Appropriate language differences are handled for C, C++ and Java.

When returning the actual values of the objects, this facility allows for the individual selection of the display format used in the result creation. It can be chosen among: binary, decimal, hexadecimal, octal and natural. Natural refers to a default format automatically chosen based on the variable type (like decimal for an int, hex for pointers, etc.).

[edit] -var-create

Synopsis 
-var-create {name | "-"} {frame-addr | "*"} expression

This operation creates a variable object, which allows the monitoring of a variable, the result of an expression, a memory cell or a CPU register.

The name parameter is the string by which the object can be referenced. It must be unique. If `-' is specified, the varobj system will generate a string "varNNNNNN" automatically. It will be unique provided that one does not specify name on that format. The command fails if a duplicate name is found.

The frame under which the expression should be evaluated can be specified by frame-addr. A `*' indicates that the current frame should be used.

expression is any expression valid on the current language set (must not begin with a `*'), or one of the following:

`*addr'

where addr is the address of a memory cell

`*addr-addr' 

a memory address range (TBD)

`$regname

a CPU register name

Result 

This operation returns the name, number of children and the type of the object created. Type is returned as a string as the ones generated by the GDB CLI:

name="name",numchild="N",type="type"

[edit] -var-delete

Synopsis 
-var-delete name

Deletes a previously created variable object and all of its children.

Result 

Returns an error if the object name is not found.

[edit] -var-set-format

Synopsis 
-var-set-format name format-spec

Sets the output format for the value of the object name to be format-spec.

The syntax for the format-spec is as follows:

format-spec ==> {binary | decimal | hexadecimal | octal | natural}

Result 

[edit] -var-show-format

Synopsis 
-var-show-format name

Returns the format used to display the value of the object name.

Result 
format ==> format-spec

[edit] -var-info-num-children

Synopsis 
-var-info-num-children name

Returns the number of children of a variable object name.

Result 
numchild=n

[edit] -var-list-children

Synopsis 
-var-list-children [ print-values ] name

Return a list of the children of the specified variable object and create variable objects for them, if they do not already exist.

Result 

With a single argument or if print-values has a value for of 0 or --no-values, print only the names of the variables; if print-values is 1 or --all-values, also print their values; and if it is 2 or --simple-values print the name and value for simple data types and just the name for arrays, structures and unions.

[edit] -var-info-type

Synopsis 
-var-info-type name

Returns the type of the specified variable name. The type is returned as a string in the same format as it is output by the GDB CLI.

Result 
type=typename

[edit] -var-info-expression

Synopsis 
-var-info-expression name

Returns what is represented by the variable object name.

Result 
lang=lang-spec,exp=expression

where lang-spec is {"C" | "C++" | "Java"}.

[edit] -var-show-attributes

Synopsis 
-var-show-attributes name

List attributes of the specified variable object name.

Result 
status=attr [ ( ,attr )* ]

where attr is { { editable | noneditable } | TBD }.

Result 

[edit] -var-evaluate-expression

Synopsis 
-var-evaluate-expression name

Evaluates the expression that is represented by the specified variable object and returns its value as a string in the current format specified for the object.

Result 
value=value

Note that one must invoke -var-list-children for a variable before the value of a child variable can be evaluated.

[edit] -var-assign

Synopsis 
-var-assign name expression

Assigns the value of expression to the variable object specified by name. The object must be `editable'. If the variable's value is altered by the assign, the variable will show up in any subsequent -var-update list.

Result 

[edit] -var-update

Synopsis 
-var-update [ print-values ] {name | "*"}

Update the value of the variable object name by evaluating its expression after fetching all the new values from memory or registers. A `*' causes all existing variable objects to be updated. The option print-values determines whether names both and values, or just names are printed in the manner described for -var-list-children (see #-var-list-children).

Result 

[edit] Data Manipulation Commands

This section describes the GDB/MI commands that manipulate data: examine memory and registers, evaluate expressions, etc.

[edit] -data-disassemble

Synopsis 
-data-disassemble [ -s start-addr -e end-addr ] | [ -f filename -l linenum [ -n lines ] ] -- mode

Where:

`start-addr' 

is the beginning address (or $pc)

`end-addr' 

is the end address

`filename' 

is the name of the file to disassemble

`linenum' 

is the line number to disassemble around

`lines' 

is the the number of disassembly lines to be produced. If it is -1, the whole function will be disassembled, in case no end-addr is specified. If end-addr is specified as a non-zero value, and lines is lower than the number of disassembly lines between start-addr and end-addr, only lines lines are displayed; if lines is higher than the number of lines between start-addr and end-addr, only the lines up to end-addr are displayed.

`mode' 

is either 0 (meaning only disassembly) or 1 (meaning mixed source and disassembly).

Result 

The output for each instruction is composed of four fields:

Address
Func-name
Offset
Instruction

Note that whatever included in the instruction field, is not manipulated directely by GDB/MI, i.e. it is not possible to adjust its format.

[edit] -data-evaluate-expression

Synopsis 
-data-evaluate-expression expr

Evaluate expr as an expression. The expression could contain an inferior function call. The function call will execute synchronously. If the expression contains spaces, it must be enclosed in double quotes.

Result 

[edit] -data-list-changed-registers

Synopsis 
-data-list-changed-registers

Display a list of the registers that have changed.

Result 

[edit] -data-list-register-names

Synopsis 
-data-list-register-names [ ( regno )+ ]

Show a list of register names for the current target.

Result 

If no arguments are given, it shows a list of the names of all the registers. If integer numbers are given as arguments, it will print a list of the names of the registers corresponding to the arguments. To ensure consistency between a register name and its number, the output list may include empty register names.

[edit] -data-list-register-values

Synopsis 
-data-list-register-values fmt [ ( regno )*]

Display the registers' contents. fmt is the format according to which the registers' contents are to be returned, followed by an optional list of numbers specifying the registers to display. A missing list of numbers indicates that the contents of all the registers must be returned.

Allowed formats for fmt are:

x 

Hexadecimal

o 

Octal

t 

Binary

d 

Decimal

r 

Raw

N 

Natural

[edit] -data-read-memory

Synopsis 
-data-read-memory [ -o byte-offset ] address word-format word-size nr-rows nr-cols [ aschar ]

where:

`address'

An expression specifying the address of the first memory word to be read. Complex expressions containing embedded white space should be quoted using the C convention.

`word-format

The format to be used to print the memory words. The notation is the same as for GDB's print command (see section #Output formats).

`word-size

The size of each memory word in bytes.

`nr-rows

The number of rows in the output table.

`nr-cols

The number of columns in the output table.

`aschar

If present, indicates that each row should include an ASCII dump. The value of aschar is used as a padding character when a byte is not a member of the printable ASCII character set (printable ASCII characters are those whose code is between 32 and 126, inclusively).

`byte-offset

An offset to add to the address before fetching memory.

Result 

This command displays memory contents as a table of nr-rows by nr-cols words, each word being word-size bytes. In total, nr-rows * nr-cols * word-size bytes are read (returned as `total-bytes'). Should less than the requested number of bytes be returned by the target, the missing words are identified using `N/A'. The number of bytes read from the target is returned in `nr-bytes' and the starting address used to read memory in `addr'.

The address of the next/previous row or page is available in `next-row and `prev-row, `next-page and `prev-page.

[edit] Tracepoint Commands

[edit] Symbol Query Commands

[edit] -symbol-info-address

Synopsis 
-symbol-info-address symbol

Describe where symbol is stored.

Result 

[edit] -symbol-info-file

Synopsis 
-symbol-info-file

Show the file for the symbol.

Result 

[edit] -symbol-info-function

Synopsis 
-symbol-info-function

Show which function the symbol lives in.

Result 

[edit] -symbol-info-line

Synopsis 
-symbol-info-line

Show the core addresses of the code for a source line.

Result 

[edit] -symbol-info-symbol

Synopsis 
-symbol-info-symbol addr

Describe what symbol is at location addr.

Result 

[edit] -symbol-list-functions

Synopsis 
-symbol-list-functions

List the functions in the executable.

Result 

[edit] -symbol-list-lines

Synopsis 
-symbol-list-lines filename

Print the list of lines that contain code and their associated program addresses for the given source filename. The entries are sorted in ascending PC order.

Result 

[edit] -symbol-list-types

Synopsis 
-symbol-list-types

List all the type names.

Result 

[edit] -symbol-list-variables

Synopsis 
-symbol-list-variables

List all the global and static variable names.

Result 

[edit] -symbol-locate

Synopsis 
-symbol-locate
Result 

[edit] -symbol-type

Synopsis 
-symbol-type variable

Show type of variable.

Result 

[edit] File Commands

This section describes the GDB/MI commands to specify executable file names and to read in and obtain symbol table information.

[edit] -file-exec-and-symbols

Synopsis 
-file-exec-and-symbols file

Specify the executable file to be debugged. This file is the one from which the symbol table is also read. If no file is specified, the command clears the executable and symbol information.

Result 

If breakpoints are set when using this command with no arguments, GDB will produce error messages. Otherwise, no output is produced, except a completion notification.

[edit] -file-exec-file

Synopsis 
-file-exec-file file

Specify the executable file to be debugged. Unlike `-file-exec-and-symbols', the symbol table is not read from this file. If used without argument, GDB clears the information about the executable file.

Result 

No output is produced, except a completion notification.

[edit] -file-list-exec-sections

Synopsis 
-file-list-exec-sections

List the sections of the current executable file.

Result 

[edit] -file-list-exec-source-file

Synopsis 
-file-list-exec-source-file

List the line number, the current source file, and the absolute path to the current source file for the current executable.

Result 

[edit] -file-list-exec-source-files

Synopsis 
-file-list-exec-source-files

List the source files for the current executable.

Result 

It will always output the filename, but only when GDB can find the absolute file name of a source file, will it output the fullname.

[edit] -file-list-shared-libraries

Synopsis 
-file-list-shared-libraries

List the shared libraries in the program.

Result 

[edit] -file-list-symbol-files

Synopsis 
-file-list-symbol-files

List symbol files.

Result 

[edit] -file-symbol-file

Synopsis 
-file-symbol-file file

Read symbol table info from the specified file argument. When used without arguments, clears GDB's symbol table info.

Result 

No output is produced, except for a completion notification.

[edit] Target Manipulation Commands

[edit] -target-attach

Synopsis 
-target-attach pid | file

Attach to a process pid or a file file outside of GDB.

Result 

[edit] -target-compare-sections

Synopsis 
-target-compare-sections [ section ]

Compare data of section section on target to the exec file. Without the argument, all sections are compared.

Result 

[edit] -target-detach

Synopsis 
-target-detach

Detach from the remote target which normally resumes its execution. There's no output.

Result 

[edit] -target-disconnect

Synopsis 
-target-disconnect

Disconnect from the remote target. There's no output and the target is generally not resumed.

Result 

[edit] -target-download

Synopsis 
-target-download

Loads the executable onto the remote target.

Result 

It prints out an update message every half second, which includes the fields:

`section' 

The name of the section.

`section-sent' 

The size of what has been sent so far for that section.

`section-size' 

The size of the section.

`total-sent' 

The total size of what was sent so far (the current and the previous sections).

`total-size' 

The size of the overall executable to download.

Each message is sent as status record (see section #Output Syntax).

In addition, it prints the name and size of the sections, as they are downloaded. These messages include the following fields:

`section' 

The name of the section.

`section-size' 

The size of the section.

`total-size' 

The size of the overall executable to download.

At the end, a summary is printed.

[edit] -target-exec-status

Synopsis 
-target-exec-status

Provide information on the state of the target (whether it is running or not, for instance).

Result 

[edit] -target-list-available-targets

Synopsis 
-target-list-available-targets

List the possible targets to connect to.

Result 

[edit] -target-list-current-targets

Synopsis 
-target-list-current-targets

Describe the current target.

Result 

[edit] -target-list-parameters

Synopsis 
-target-list-parameters
Result 

[edit] -target-select

Synopsis 
-target-select type parameters type parameters

Connect GDB to the remote target. This command takes two args:

`type' 

The type of target, for instance `async', `remote', etc.

`parameters'' 

Device names, host names and the like. See section Commands for managing targets, for more details.

Result 

The output is a connection notification, followed by the address at which the target program is, in the following form:

^connected,addr="address",func="function name",args=[arg list]

[edit] Miscellaneous Commands

[edit] -gdb-exit

Synopsis 
-gdb-exit

Exit GDB immediately.

Result 

[edit] -exec-abort

Synopsis 
-exec-abort

Kill the inferior running program.

Result 

[edit] -gdb-set

Synopsis 
-gdb-set

Set an internal GDB variable.

Result 

[edit] -gdb-show

Synopsis 
-gdb-show

Show the current value of a GDB variable.

Result 

[edit] -gdb-version

Synopsis 
-gdb-version

Show version information for GDB. Used mostly in testing.

Result 

[edit] -interpreter-exec

Synopsis 
-interpreter-exec interpreter command

Execute the specified command in the given interpreter.

Result 

[edit] -inferior-tty-set

Synopsis 
-inferior-tty-set device

Set terminal for future runs of the program being debugged.

Result 

[edit] -inferior-tty-show

Synopsis 
-inferior-tty-show

Show terminal for future runs of program being debugged.

Result 

[Article] [Discussion] [Edit] [History]