Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

186 lines
7.9KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Interpreters (Debugging with GDB)</title>
  17. <meta name="description" content="Interpreters (Debugging with GDB)">
  18. <meta name="keywords" content="Interpreters (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="index.html#Top" rel="up" title="Top">
  26. <link href="TUI.html#TUI" rel="next" title="TUI">
  27. <link href="Aliases.html#Aliases" rel="prev" title="Aliases">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Interpreters"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="TUI.html#TUI" accesskey="n" rel="next">TUI</a>, Previous: <a href="Extending-GDB.html#Extending-GDB" accesskey="p" rel="prev">Extending GDB</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Command-Interpreters"></a>
  64. <h2 class="chapter">24 Command Interpreters</h2>
  65. <a name="index-command-interpreters"></a>
  66. <p><small>GDB</small> supports multiple command interpreters, and some command
  67. infrastructure to allow users or user interface writers to switch
  68. between interpreters or run commands in other interpreters.
  69. </p>
  70. <p><small>GDB</small> currently supports two command interpreters, the console
  71. interpreter (sometimes called the command-line interpreter or <small>CLI</small>)
  72. and the machine interface interpreter (or <small>GDB/MI</small>). This manual
  73. describes both of these interfaces in great detail.
  74. </p>
  75. <p>By default, <small>GDB</small> will start with the console interpreter.
  76. However, the user may choose to start <small>GDB</small> with another
  77. interpreter by specifying the <samp>-i</samp> or <samp>--interpreter</samp>
  78. startup options. Defined interpreters include:
  79. </p>
  80. <dl compact="compact">
  81. <dt><code>console</code></dt>
  82. <dd><a name="index-console-interpreter"></a>
  83. <p>The traditional console or command-line interpreter. This is the most often
  84. used interpreter with <small>GDB</small>. With no interpreter specified at runtime,
  85. <small>GDB</small> will use this interpreter.
  86. </p>
  87. </dd>
  88. <dt><code>mi</code></dt>
  89. <dd><a name="index-mi-interpreter"></a>
  90. <p>The newest <small>GDB/MI</small> interface (currently <code>mi3</code>). Used primarily
  91. by programs wishing to use <small>GDB</small> as a backend for a debugger GUI
  92. or an IDE. For more information, see <a href="GDB_002fMI.html#GDB_002fMI">The <small>GDB/MI</small>
  93. Interface</a>.
  94. </p>
  95. </dd>
  96. <dt><code>mi3</code></dt>
  97. <dd><a name="index-mi3-interpreter"></a>
  98. <p>The <small>GDB/MI</small> interface introduced in <small>GDB</small> 9.1.
  99. </p>
  100. </dd>
  101. <dt><code>mi2</code></dt>
  102. <dd><a name="index-mi2-interpreter"></a>
  103. <p>The <small>GDB/MI</small> interface introduced in <small>GDB</small> 6.0.
  104. </p>
  105. </dd>
  106. <dt><code>mi1</code></dt>
  107. <dd><a name="index-mi1-interpreter"></a>
  108. <p>The <small>GDB/MI</small> interface introduced in <small>GDB</small> 5.1.
  109. </p>
  110. </dd>
  111. </dl>
  112. <a name="index-invoke-another-interpreter"></a>
  113. <a name="index-interpreter_002dexec"></a>
  114. <p>You may execute commands in any interpreter from the current
  115. interpreter using the appropriate command. If you are running the
  116. console interpreter, simply use the <code>interpreter-exec</code> command:
  117. </p>
  118. <div class="smallexample">
  119. <pre class="smallexample">interpreter-exec mi &quot;-data-list-register-names&quot;
  120. </pre></div>
  121. <p><small>GDB/MI</small> has a similar command, although it is only available in versions of
  122. <small>GDB</small> which support <small>GDB/MI</small> version 2 (or greater).
  123. </p>
  124. <p>Note that <code>interpreter-exec</code> only changes the interpreter for the
  125. duration of the specified command. It does not change the interpreter
  126. permanently.
  127. </p>
  128. <a name="index-start-a-new-independent-interpreter"></a>
  129. <p>Although you may only choose a single interpreter at startup, it is
  130. possible to run an independent interpreter on a specified input/output
  131. device (usually a tty).
  132. </p>
  133. <p>For example, consider a debugger GUI or IDE that wants to provide a
  134. <small>GDB</small> console view. It may do so by embedding a terminal
  135. emulator widget in its GUI, starting <small>GDB</small> in the traditional
  136. command-line mode with stdin/stdout/stderr redirected to that
  137. terminal, and then creating an MI interpreter running on a specified
  138. input/output device. The console interpreter created by <small>GDB</small>
  139. at startup handles commands the user types in the terminal widget,
  140. while the GUI controls and synchronizes state with <small>GDB</small> using
  141. the separate MI interpreter.
  142. </p>
  143. <p>To start a new secondary <em>user interface</em> running MI, use the
  144. <code>new-ui</code> command:
  145. </p>
  146. <a name="index-new_002dui"></a>
  147. <a name="index-new-user-interface"></a>
  148. <div class="smallexample">
  149. <pre class="smallexample">new-ui <var>interpreter</var> <var>tty</var>
  150. </pre></div>
  151. <p>The <var>interpreter</var> parameter specifies the interpreter to run.
  152. This accepts the same values as the <code>interpreter-exec</code> command.
  153. For example, &lsquo;<samp>console</samp>&rsquo;, &lsquo;<samp>mi</samp>&rsquo;, &lsquo;<samp>mi2</samp>&rsquo;, etc. The
  154. <var>tty</var> parameter specifies the name of the bidirectional file the
  155. interpreter uses for input/output, usually the name of a
  156. pseudoterminal slave on Unix systems. For example:
  157. </p>
  158. <div class="smallexample">
  159. <pre class="smallexample">(gdb) new-ui mi /dev/pts/9
  160. </pre></div>
  161. <p>runs an MI interpreter on <samp>/dev/pts/9</samp>.
  162. </p>
  163. <hr>
  164. <div class="header">
  165. <p>
  166. Next: <a href="TUI.html#TUI" accesskey="n" rel="next">TUI</a>, Previous: <a href="Extending-GDB.html#Extending-GDB" accesskey="p" rel="prev">Extending GDB</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  167. </div>
  168. </body>
  169. </html>