1<html lang="en"> 2<head> 3<title>Interpreters - Debugging with GDB</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Debugging with GDB"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="Extending-GDB.html#Extending-GDB" title="Extending GDB"> 9<link rel="next" href="TUI.html#TUI" title="TUI"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1988-2013 Free Software Foundation, Inc. 13 14Permission is granted to copy, distribute and/or modify this document 15under the terms of the GNU Free Documentation License, Version 1.3 or 16any later version published by the Free Software Foundation; with the 17Invariant Sections being ``Free Software'' and ``Free Software Needs 18Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' 19and with the Back-Cover Texts as in (a) below. 20 21(a) The FSF's Back-Cover Text is: ``You are free to copy and modify 22this GNU Manual. Buying copies from GNU Press supports the FSF in 23developing GNU and promoting software freedom.'' 24--> 25<meta http-equiv="Content-Style-Type" content="text/css"> 26<style type="text/css"><!-- 27 pre.display { font-family:inherit } 28 pre.format { font-family:inherit } 29 pre.smalldisplay { font-family:inherit; font-size:smaller } 30 pre.smallformat { font-family:inherit; font-size:smaller } 31 pre.smallexample { font-size:smaller } 32 pre.smalllisp { font-size:smaller } 33 span.sc { font-variant:small-caps } 34 span.roman { font-family:serif; font-weight:normal; } 35 span.sansserif { font-family:sans-serif; font-weight:normal; } 36--></style> 37<link rel="stylesheet" type="text/css" href="../cs.css"> 38</head> 39<body> 40<div class="node"> 41<a name="Interpreters"></a> 42<p> 43Next: <a rel="next" accesskey="n" href="TUI.html#TUI">TUI</a>, 44Previous: <a rel="previous" accesskey="p" href="Extending-GDB.html#Extending-GDB">Extending GDB</a>, 45Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 46<hr> 47</div> 48 49<h2 class="chapter">24 Command Interpreters</h2> 50 51<p><a name="index-command-interpreters-2212"></a> 52<span class="sc">gdb</span> supports multiple command interpreters, and some command 53infrastructure to allow users or user interface writers to switch 54between interpreters or run commands in other interpreters. 55 56 <p><span class="sc">gdb</span> currently supports two command interpreters, the console 57interpreter (sometimes called the command-line interpreter or <span class="sc">cli</span>) 58and the machine interface interpreter (or <span class="sc">gdb/mi</span>). This manual 59describes both of these interfaces in great detail. 60 61 <p>By default, <span class="sc">gdb</span> will start with the console interpreter. 62However, the user may choose to start <span class="sc">gdb</span> with another 63interpreter by specifying the <samp><span class="option">-i</span></samp> or <samp><span class="option">--interpreter</span></samp> 64startup options. Defined interpreters include: 65 66 <dl> 67<dt><code>console</code><dd><a name="index-console-interpreter-2213"></a>The traditional console or command-line interpreter. This is the most often 68used interpreter with <span class="sc">gdb</span>. With no interpreter specified at runtime, 69<span class="sc">gdb</span> will use this interpreter. 70 71 <br><dt><code>mi</code><dd><a name="index-mi-interpreter-2214"></a>The newest <span class="sc">gdb/mi</span> interface (currently <code>mi2</code>). Used primarily 72by programs wishing to use <span class="sc">gdb</span> as a backend for a debugger GUI 73or an IDE. For more information, see <a href="GDB_002fMI.html#GDB_002fMI">The <span class="sc">gdb/mi</span> Interface</a>. 74 75 <br><dt><code>mi2</code><dd><a name="index-mi2-interpreter-2215"></a>The current <span class="sc">gdb/mi</span> interface. 76 77 <br><dt><code>mi1</code><dd><a name="index-mi1-interpreter-2216"></a>The <span class="sc">gdb/mi</span> interface included in <span class="sc">gdb</span> 5.1, 5.2, and 5.3. 78 79 </dl> 80 81 <p><a name="index-invoke-another-interpreter-2217"></a>The interpreter being used by <span class="sc">gdb</span> may not be dynamically 82switched at runtime. Although possible, this could lead to a very 83precarious situation. Consider an IDE using <span class="sc">gdb/mi</span>. If a user 84enters the command "interpreter-set console" in a console view, 85<span class="sc">gdb</span> would switch to using the console interpreter, rendering 86the IDE inoperable! 87 88 <p><a name="index-interpreter_002dexec-2218"></a>Although you may only choose a single interpreter at startup, you may execute 89commands in any interpreter from the current interpreter using the appropriate 90command. If you are running the console interpreter, simply use the 91<code>interpreter-exec</code> command: 92 93<pre class="smallexample"> interpreter-exec mi "-data-list-register-names" 94</pre> 95 <p><span class="sc">gdb/mi</span> has a similar command, although it is only available in versions of 96<span class="sc">gdb</span> which support <span class="sc">gdb/mi</span> version 2 (or greater). 97 98 </body></html> 99 100