| <html lang="en"> |
| <head> |
| <title>Interpreters - 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="prev" href="Extending-GDB.html#Extending-GDB" title="Extending GDB"> |
| <link rel="next" href="TUI.html#TUI" title="TUI"> |
| <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="Interpreters"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="TUI.html#TUI">TUI</a>, |
| Previous: <a rel="previous" accesskey="p" href="Extending-GDB.html#Extending-GDB">Extending GDB</a>, |
| Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> |
| <hr> |
| </div> |
| |
| <h2 class="chapter">24 Command Interpreters</h2> |
| |
| <p><a name="index-command-interpreters-1949"></a> |
| <span class="sc">gdb</span> supports multiple command interpreters, and some command |
| infrastructure to allow users or user interface writers to switch |
| between interpreters or run commands in other interpreters. |
| |
| <p><span class="sc">gdb</span> currently supports two command interpreters, the console |
| interpreter (sometimes called the command-line interpreter or <span class="sc">cli</span>) |
| and the machine interface interpreter (or <span class="sc">gdb/mi</span>). This manual |
| describes both of these interfaces in great detail. |
| |
| <p>By default, <span class="sc">gdb</span> will start with the console interpreter. |
| However, the user may choose to start <span class="sc">gdb</span> with another |
| interpreter by specifying the <samp><span class="option">-i</span></samp> or <samp><span class="option">--interpreter</span></samp> |
| startup options. Defined interpreters include: |
| |
| <dl> |
| <dt><code>console</code><dd><a name="index-console-interpreter-1950"></a>The traditional console or command-line interpreter. This is the most often |
| used interpreter with <span class="sc">gdb</span>. With no interpreter specified at runtime, |
| <span class="sc">gdb</span> will use this interpreter. |
| |
| <br><dt><code>mi</code><dd><a name="index-mi-interpreter-1951"></a>The newest <span class="sc">gdb/mi</span> interface (currently <code>mi2</code>). Used primarily |
| by programs wishing to use <span class="sc">gdb</span> as a backend for a debugger GUI |
| or an IDE. For more information, see <a href="GDB_002fMI.html#GDB_002fMI">The <span class="sc">gdb/mi</span> Interface</a>. |
| |
| <br><dt><code>mi2</code><dd><a name="index-mi2-interpreter-1952"></a>The current <span class="sc">gdb/mi</span> interface. |
| |
| <br><dt><code>mi1</code><dd><a name="index-mi1-interpreter-1953"></a>The <span class="sc">gdb/mi</span> interface included in <span class="sc">gdb</span> 5.1, 5.2, and 5.3. |
| |
| </dl> |
| |
| <p><a name="index-invoke-another-interpreter-1954"></a>The interpreter being used by <span class="sc">gdb</span> may not be dynamically |
| switched at runtime. Although possible, this could lead to a very |
| precarious situation. Consider an IDE using <span class="sc">gdb/mi</span>. If a user |
| enters the command "interpreter-set console" in a console view, |
| <span class="sc">gdb</span> would switch to using the console interpreter, rendering |
| the IDE inoperable! |
| |
| <p><a name="index-interpreter_002dexec-1955"></a>Although you may only choose a single interpreter at startup, you may execute |
| commands in any interpreter from the current interpreter using the appropriate |
| command. If you are running the console interpreter, simply use the |
| <code>interpreter-exec</code> command: |
| |
| <pre class="smallexample"> interpreter-exec mi "-data-list-register-names" |
| </pre> |
| <p><span class="sc">gdb/mi</span> has a similar command, although it is only available in versions of |
| <span class="sc">gdb</span> which support <span class="sc">gdb/mi</span> version 2 (or greater). |
| |
| </body></html> |
| |