blob: 2f12fc20044b14c623d14bb30b3801ef44634228 [file] [log] [blame]
<html lang="en">
<head>
<title>GDB/MI General Design - 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.html#GDB_002fMI" title="GDB/MI">
<link rel="next" href="GDB_002fMI-Command-Syntax.html#GDB_002fMI-Command-Syntax" title="GDB/MI Command Syntax">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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>
<link rel="stylesheet" type="text/css" href="../cs.css">
</head>
<body>
<div class="node">
<a name="GDB%2fMI-General-Design"></a>
<a name="GDB_002fMI-General-Design"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="GDB_002fMI-Command-Syntax.html#GDB_002fMI-Command-Syntax">GDB/MI Command Syntax</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="GDB_002fMI.html#GDB_002fMI">GDB/MI</a>
<hr>
</div>
<h3 class="section">27.1 <span class="sc">gdb/mi</span> General Design</h3>
<p><a name="index-GDB_002fMI-General-Design-2002"></a>
Interaction of a <span class="sc">GDB/MI</span> frontend with <span class="sc">gdb</span> involves three
parts&mdash;commands sent to <span class="sc">gdb</span>, responses to those commands
and notifications. Each command results in exactly one response,
indicating either successful completion of the command, or an error.
For the commands that do not resume the target, the response contains the
requested information. For the commands that resume the target, the
response only indicates whether the target was successfully resumed.
Notifications is the mechanism for reporting changes in the state of the
target, or in <span class="sc">gdb</span> state, that cannot conveniently be associated with
a command and reported as part of that command response.
<p>The important examples of notifications are:
<ul>
<li>Exec notifications. These are used to report changes in
target state&mdash;when a target is resumed, or stopped. It would not
be feasible to include this information in response of resuming
commands, because one resume commands can result in multiple events in
different threads. Also, quite some time may pass before any event
happens in the target, while a frontend needs to know whether the resuming
command itself was successfully executed.
<li>Console output, and status notifications. Console output
notifications are used to report output of CLI commands, as well as
diagnostics for other commands. Status notifications are used to
report the progress of a long-running operation. Naturally, including
this information in command response would mean no output is produced
until the command is finished, which is undesirable.
<li>General notifications. Commands may have various side effects on
the <span class="sc">gdb</span> or target state beyond their official purpose. For example,
a command may change the selected thread. Although such changes can
be included in command response, using notification allows for more
orthogonal frontend design.
</ul>
<p>There's no guarantee that whenever an MI command reports an error,
<span class="sc">gdb</span> or the target are in any specific state, and especially,
the state is not reverted to the state before the MI command was
processed. Therefore, whenever an MI command results in an error,
we recommend that the frontend refreshes all the information shown in
the user interface.
<ul class="menu">
<li><a accesskey="1" href="Context-management.html#Context-management">Context management</a>
<li><a accesskey="2" href="Asynchronous-and-non_002dstop-modes.html#Asynchronous-and-non_002dstop-modes">Asynchronous and non-stop modes</a>
<li><a accesskey="3" href="Thread-groups.html#Thread-groups">Thread groups</a>
</ul>
</body></html>