blob: eb83f2252478fd5982b3f09683e1bc12cd9fbe14 [file] [log] [blame]
<html lang="en">
<head>
<title>GDB/MI Output Syntax - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="GDB_002fMI-Command-Syntax.html#GDB_002fMI-Command-Syntax" title="GDB/MI Command Syntax">
<link rel="prev" href="GDB_002fMI-Input-Syntax.html#GDB_002fMI-Input-Syntax" title="GDB/MI Input Syntax">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="GDB%2fMI-Output-Syntax"></a>
<a name="GDB_002fMI-Output-Syntax"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="GDB_002fMI-Input-Syntax.html#GDB_002fMI-Input-Syntax">GDB/MI Input Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="GDB_002fMI-Command-Syntax.html#GDB_002fMI-Command-Syntax">GDB/MI Command Syntax</a>
<hr>
</div>
<h4 class="subsection">27.2.2 <span class="sc">gdb/mi</span> Output Syntax</h4>
<p><a name="index-output-syntax-of-_0040sc_007bgdb_002fmi_007d-2955"></a><a name="index-g_t_0040sc_007bgdb_002fmi_007d_002c-output-syntax-2956"></a>The output from <span class="sc">gdb/mi</span> 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 &lsquo;<samp><span class="samp">(gdb)</span></samp>&rsquo;.
<p>If an input command was prefixed with a <var>token</var> then the
corresponding output for that command will also be prefixed by that same
<var>token</var>.
<dl>
<dt><var>output</var><code> ==&gt;</code><dd><code>( </code><var>out-of-band-record</var><code> )* [ </code><var>result-record</var><code> ] "(gdb)" </code><var>nl</var>
<br><dt><var>result-record</var><code> ==&gt;</code><dd><code> [ </code><var>token</var><code> ] "^" </code><var>result-class</var><code> ( "," </code><var>result</var><code> )* </code><var>nl</var>
<br><dt><var>out-of-band-record</var><code> ==&gt;</code><dd><var>async-record</var><code> | </code><var>stream-record</var>
<br><dt><var>async-record</var><code> ==&gt;</code><dd><var>exec-async-output</var><code> | </code><var>status-async-output</var><code> | </code><var>notify-async-output</var>
<br><dt><var>exec-async-output</var><code> ==&gt;</code><dd><code>[ </code><var>token</var><code> ] "*" </code><var>async-output nl</var>
<br><dt><var>status-async-output</var><code> ==&gt;</code><dd><code>[ </code><var>token</var><code> ] "+" </code><var>async-output nl</var>
<br><dt><var>notify-async-output</var><code> ==&gt;</code><dd><code>[ </code><var>token</var><code> ] "=" </code><var>async-output nl</var>
<br><dt><var>async-output</var><code> ==&gt;</code><dd><var>async-class</var><code> ( "," </code><var>result</var><code> )*</code>
<br><dt><var>result-class</var><code> ==&gt;</code><dd><code>"done" | "running" | "connected" | "error" | "exit"</code>
<br><dt><var>async-class</var><code> ==&gt;</code><dd><code>"stopped" | </code><var>others</var> (where <var>others</var> will be added
depending on the needs&mdash;this is still in development).
<br><dt><var>result</var><code> ==&gt;</code><dd> <var>variable</var><code> "=" </code><var>value</var>
<br><dt><var>variable</var><code> ==&gt;</code><dd> <var>string</var>
<br><dt><var>value</var><code> ==&gt;</code><dd> <var>const</var><code> | </code><var>tuple</var><code> | </code><var>list</var>
<br><dt><var>const</var><code> ==&gt;</code><dd><var>c-string</var>
<br><dt><var>tuple</var><code> ==&gt;</code><dd><code> "{}" | "{" </code><var>result</var><code> ( "," </code><var>result</var><code> )* "}" </code>
<br><dt><var>list</var><code> ==&gt;</code><dd><code> "[]" | "[" </code><var>value</var><code> ( "," </code><var>value</var><code> )* "]" | "["
</code><var>result</var><code> ( "," </code><var>result</var><code> )* "]" </code>
<br><dt><var>stream-record</var><code> ==&gt;</code><dd><var>console-stream-output</var><code> | </code><var>target-stream-output</var><code> | </code><var>log-stream-output</var>
<br><dt><var>console-stream-output</var><code> ==&gt;</code><dd><code>"~" </code><var>c-string nl</var>
<br><dt><var>target-stream-output</var><code> ==&gt;</code><dd><code>"@" </code><var>c-string nl</var>
<br><dt><var>log-stream-output</var><code> ==&gt;</code><dd><code>"&amp;" </code><var>c-string nl</var>
<br><dt><var>nl</var><code> ==&gt;</code><dd><code>CR | CR-LF</code>
<br><dt><var>token</var><code> ==&gt;</code><dd><em>any sequence of digits</em>.
</dl>
<p class="noindent">Notes:
<ul>
<li>All output sequences end in a single line containing a period.
<li>The <var>token</var> is from the corresponding request. Note that
for all async output, while the token is allowed by the grammar and
may be output by future versions of <span class="sc">gdb</span> for select async
output messages, it is generally omitted. Frontends should treat
all async output as reporting general changes in the state of the
target and there should be no need to associate async output to any
prior command.
<li><a name="index-status-output-in-_0040sc_007bgdb_002fmi_007d-2957"></a><var>status-async-output</var> contains on-going status information about the
progress of a slow operation. It can be discarded. All status output is
prefixed by &lsquo;<samp><span class="samp">+</span></samp>&rsquo;.
<li><a name="index-async-output-in-_0040sc_007bgdb_002fmi_007d-2958"></a><var>exec-async-output</var> contains asynchronous state change on the target
(stopped, started, disappeared). All async output is prefixed by
&lsquo;<samp><span class="samp">*</span></samp>&rsquo;.
<li><a name="index-notify-output-in-_0040sc_007bgdb_002fmi_007d-2959"></a><var>notify-async-output</var> contains supplementary information that the
client should handle (e.g., a new breakpoint information). All notify
output is prefixed by &lsquo;<samp><span class="samp">=</span></samp>&rsquo;.
<li><a name="index-console-output-in-_0040sc_007bgdb_002fmi_007d-2960"></a><var>console-stream-output</var> 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 &lsquo;<samp><span class="samp">~</span></samp>&rsquo;.
<li><a name="index-target-output-in-_0040sc_007bgdb_002fmi_007d-2961"></a><var>target-stream-output</var> is the output produced by the target program.
All the target output is prefixed by &lsquo;<samp><span class="samp">@</span></samp>&rsquo;.
<li><a name="index-log-output-in-_0040sc_007bgdb_002fmi_007d-2962"></a><var>log-stream-output</var> is output text coming from <span class="sc">gdb</span>'s internals, for
instance messages that should be displayed as part of an error log. All
the log output is prefixed by &lsquo;<samp><span class="samp">&amp;</span></samp>&rsquo;.
<li><a name="index-list-output-in-_0040sc_007bgdb_002fmi_007d-2963"></a>New <span class="sc">gdb/mi</span> commands should only output <var>lists</var> containing
<var>values</var>.
</ul>
<p>See <a href="GDB_002fMI-Stream-Records.html#GDB_002fMI-Stream-Records"><span class="sc">gdb/mi</span> Stream Records</a>, for more
details about the various output records.
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
</body></html>