|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <!-- Copyright (C) 1988-2020 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." -->
- <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Host I/O Packets (Debugging with GDB)</title>
-
- <meta name="description" content="Host I/O Packets (Debugging with GDB)">
- <meta name="keywords" content="Host I/O Packets (Debugging with GDB)">
- <meta name="resource-type" content="document">
- <meta name="distribution" content="global">
- <meta name="Generator" content="makeinfo">
- <link href="index.html#Top" rel="start" title="Top">
- <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
- <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
- <link href="Remote-Protocol.html#Remote-Protocol" rel="up" title="Remote Protocol">
- <link href="Interrupts.html#Interrupts" rel="next" title="Interrupts">
- <link href="Tracepoint-Packets.html#Tracepoint-Packets" rel="prev" title="Tracepoint Packets">
- <style type="text/css">
- <!--
- a.summary-letter {text-decoration: none}
- blockquote.indentedblock {margin-right: 0em}
- blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
- blockquote.smallquotation {font-size: smaller}
- div.display {margin-left: 3.2em}
- div.example {margin-left: 3.2em}
- div.lisp {margin-left: 3.2em}
- div.smalldisplay {margin-left: 3.2em}
- div.smallexample {margin-left: 3.2em}
- div.smalllisp {margin-left: 3.2em}
- kbd {font-style: oblique}
- pre.display {font-family: inherit}
- pre.format {font-family: inherit}
- pre.menu-comment {font-family: serif}
- pre.menu-preformatted {font-family: serif}
- pre.smalldisplay {font-family: inherit; font-size: smaller}
- pre.smallexample {font-size: smaller}
- pre.smallformat {font-family: inherit; font-size: smaller}
- pre.smalllisp {font-size: smaller}
- span.nolinebreak {white-space: nowrap}
- span.roman {font-family: initial; font-weight: normal}
- span.sansserif {font-family: sans-serif; font-weight: normal}
- ul.no-bullet {list-style: none}
- -->
- </style>
-
-
- </head>
-
- <body lang="en">
- <a name="Host-I_002fO-Packets"></a>
- <div class="header">
- <p>
- Next: <a href="Interrupts.html#Interrupts" accesskey="n" rel="next">Interrupts</a>, Previous: <a href="Tracepoint-Packets.html#Tracepoint-Packets" accesskey="p" rel="prev">Tracepoint Packets</a>, Up: <a href="Remote-Protocol.html#Remote-Protocol" accesskey="u" rel="up">Remote Protocol</a> [<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>
- </div>
- <hr>
- <a name="Host-I_002fO-Packets-1"></a>
- <h3 class="section">E.7 Host I/O Packets</h3>
- <a name="index-Host-I_002fO_002c-remote-protocol"></a>
- <a name="index-file-transfer_002c-remote-protocol"></a>
-
- <p>The <em>Host I/O</em> packets allow <small>GDB</small> to perform I/O
- operations on the far side of a remote link. For example, Host I/O is
- used to upload and download files to a remote target with its own
- filesystem. Host I/O uses the same constant values and data structure
- layout as the target-initiated File-I/O protocol. However, the
- Host I/O packets are structured differently. The target-initiated
- protocol relies on target memory to store parameters and buffers.
- Host I/O requests are initiated by <small>GDB</small>, and the
- target’s memory is not involved. See <a href="File_002dI_002fO-Remote-Protocol-Extension.html#File_002dI_002fO-Remote-Protocol-Extension">File-I/O Remote Protocol Extension</a>, for more details on the target-initiated protocol.
- </p>
- <p>The Host I/O request packets all encode a single operation along with
- its arguments. They have this format:
- </p>
- <dl compact="compact">
- <dt>‘<samp>vFile:<var>operation</var>: <var>parameter</var>…</samp>’</dt>
- <dd><p><var>operation</var> is the name of the particular request; the target
- should compare the entire packet name up to the second colon when checking
- for a supported operation. The format of <var>parameter</var> depends on
- the operation. Numbers are always passed in hexadecimal. Negative
- numbers have an explicit minus sign (i.e. two’s complement is not
- used). Strings (e.g. filenames) are encoded as a series of
- hexadecimal bytes. The last argument to a system call may be a
- buffer of escaped binary data (see <a href="Overview.html#Binary-Data">Binary Data</a>).
- </p>
- </dd>
- </dl>
-
- <p>The valid responses to Host I/O packets are:
- </p>
- <dl compact="compact">
- <dt>‘<samp>F <var>result</var> [, <var>errno</var>] [; <var>attachment</var>]</samp>’</dt>
- <dd><p><var>result</var> is the integer value returned by this operation, usually
- non-negative for success and -1 for errors. If an error has occured,
- <var>errno</var> will be included in the result specifying a
- value defined by the File-I/O protocol (see <a href="Errno-Values.html#Errno-Values">Errno Values</a>). For
- operations which return data, <var>attachment</var> supplies the data as a
- binary buffer. Binary buffers in response packets are escaped in the
- normal way (see <a href="Overview.html#Binary-Data">Binary Data</a>). See the individual packet
- documentation for the interpretation of <var>result</var> and
- <var>attachment</var>.
- </p>
- </dd>
- <dt>‘<samp><!-- /@w --></samp>’</dt>
- <dd><p>An empty response indicates that this operation is not recognized.
- </p>
- </dd>
- </dl>
-
- <p>These are the supported Host I/O operations:
- </p>
- <dl compact="compact">
- <dt>‘<samp>vFile:open: <var>filename</var>, <var>flags</var>, <var>mode</var></samp>’</dt>
- <dd><p>Open a file at <var>filename</var> and return a file descriptor for it, or
- return -1 if an error occurs. The <var>filename</var> is a string,
- <var>flags</var> is an integer indicating a mask of open flags
- (see <a href="Open-Flags.html#Open-Flags">Open Flags</a>), and <var>mode</var> is an integer indicating a mask
- of mode bits to use if the file is created (see <a href="mode_005ft-Values.html#mode_005ft-Values">mode_t Values</a>).
- See <a href="open.html#open">open</a>, for details of the open flags and mode values.
- </p>
- </dd>
- <dt>‘<samp>vFile:close: <var>fd</var></samp>’</dt>
- <dd><p>Close the open file corresponding to <var>fd</var> and return 0, or
- -1 if an error occurs.
- </p>
- </dd>
- <dt>‘<samp>vFile:pread: <var>fd</var>, <var>count</var>, <var>offset</var></samp>’</dt>
- <dd><p>Read data from the open file corresponding to <var>fd</var>. Up to
- <var>count</var> bytes will be read from the file, starting at <var>offset</var>
- relative to the start of the file. The target may read fewer bytes;
- common reasons include packet size limits and an end-of-file
- condition. The number of bytes read is returned. Zero should only be
- returned for a successful read at the end of the file, or if
- <var>count</var> was zero.
- </p>
- <p>The data read should be returned as a binary attachment on success.
- If zero bytes were read, the response should include an empty binary
- attachment (i.e. a trailing semicolon). The return value is the
- number of target bytes read; the binary attachment may be longer if
- some characters were escaped.
- </p>
- </dd>
- <dt>‘<samp>vFile:pwrite: <var>fd</var>, <var>offset</var>, <var>data</var></samp>’</dt>
- <dd><p>Write <var>data</var> (a binary buffer) to the open file corresponding
- to <var>fd</var>. Start the write at <var>offset</var> from the start of the
- file. Unlike many <code>write</code> system calls, there is no
- separate <var>count</var> argument; the length of <var>data</var> in the
- packet is used. ‘<samp>vFile:pwrite</samp>’ returns the number of bytes written,
- which may be shorter than the length of <var>data</var>, or -1 if an
- error occurred.
- </p>
- </dd>
- <dt>‘<samp>vFile:fstat: <var>fd</var></samp>’</dt>
- <dd><p>Get information about the open file corresponding to <var>fd</var>.
- On success the information is returned as a binary attachment
- and the return value is the size of this attachment in bytes.
- If an error occurs the return value is -1. The format of the
- returned binary attachment is as described in <a href="struct-stat.html#struct-stat">struct stat</a>.
- </p>
- </dd>
- <dt>‘<samp>vFile:unlink: <var>filename</var></samp>’</dt>
- <dd><p>Delete the file at <var>filename</var> on the target. Return 0,
- or -1 if an error occurs. The <var>filename</var> is a string.
- </p>
- </dd>
- <dt>‘<samp>vFile:readlink: <var>filename</var></samp>’</dt>
- <dd><p>Read value of symbolic link <var>filename</var> on the target. Return
- the number of bytes read, or -1 if an error occurs.
- </p>
- <p>The data read should be returned as a binary attachment on success.
- If zero bytes were read, the response should include an empty binary
- attachment (i.e. a trailing semicolon). The return value is the
- number of target bytes read; the binary attachment may be longer if
- some characters were escaped.
- </p>
- </dd>
- <dt>‘<samp>vFile:setfs: <var>pid</var></samp>’</dt>
- <dd><p>Select the filesystem on which <code>vFile</code> operations with
- <var>filename</var> arguments will operate. This is required for
- <small>GDB</small> to be able to access files on remote targets where
- the remote stub does not share a common filesystem with the
- inferior(s).
- </p>
- <p>If <var>pid</var> is nonzero, select the filesystem as seen by process
- <var>pid</var>. If <var>pid</var> is zero, select the filesystem as seen by
- the remote stub. Return 0 on success, or -1 if an error occurs.
- If <code>vFile:setfs:</code> indicates success, the selected filesystem
- remains selected until the next successful <code>vFile:setfs:</code>
- operation.
- </p>
- </dd>
- </dl>
-
- <hr>
- <div class="header">
- <p>
- Next: <a href="Interrupts.html#Interrupts" accesskey="n" rel="next">Interrupts</a>, Previous: <a href="Tracepoint-Packets.html#Tracepoint-Packets" accesskey="p" rel="prev">Tracepoint Packets</a>, Up: <a href="Remote-Protocol.html#Remote-Protocol" accesskey="u" rel="up">Remote Protocol</a> [<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>
- </div>
-
-
-
- </body>
- </html>
|