blob: c48b6a15132e4ae417688c2aa4db2a81a486b002 [file] [log] [blame]
<html lang="en">
<head>
<title>Console I/O - 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="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension" title="File-I/O Remote Protocol Extension">
<link rel="prev" href="The-Ctrl_002dC-Message.html#The-Ctrl_002dC-Message" title="The Ctrl-C Message">
<link rel="next" href="List-of-Supported-Calls.html#List-of-Supported-Calls" title="List of Supported Calls">
<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="Console-I%2fO"></a>
<a name="Console-I_002fO"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="List-of-Supported-Calls.html#List-of-Supported-Calls">List of Supported Calls</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="The-Ctrl_002dC-Message.html#The-Ctrl_002dC-Message">The Ctrl-C Message</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a>
<hr>
</div>
<h4 class="subsection">E.13.6 Console I/O</h4>
<p><a name="index-console-i_002fo-as-part-of-file_002di_002fo-3602"></a>
By default and if not explicitly closed by the target system, the file
descriptors 0, 1 and 2 are connected to the <span class="sc">gdb</span> console. Output
on the <span class="sc">gdb</span> console is handled as any other file output operation
(<code>write(1, ...)</code> or <code>write(2, ...)</code>). Console input is handled
by <span class="sc">gdb</span> so that after the target read request from file descriptor
0 all following typing is buffered until either one of the following
conditions is met:
<ul>
<li>The user types <kbd>Ctrl-c</kbd>. The behaviour is as explained above, and the
<code>read</code>
system call is treated as finished.
<li>The user presses &lt;RET&gt;. This is treated as end of input with a trailing
newline.
<li>The user types <kbd>Ctrl-d</kbd>. This is treated as end of input. No trailing
character (neither newline nor &lsquo;<samp><span class="samp">Ctrl-D</span></samp>&rsquo;) is appended to the input.
</ul>
<p>If the user has typed more characters than fit in the buffer given to
the <code>read</code> call, the trailing characters are buffered in <span class="sc">gdb</span> until
either another <code>read(0, ...)</code> is requested by the target, or debugging
is stopped at the user's request.
</body></html>