111 lines
5.1 KiB
HTML
111 lines
5.1 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Protocol Basics - 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="File_002dI_002fO-Overview.html#File_002dI_002fO-Overview" title="File-I/O Overview">
|
|
<link rel="next" href="The-F-Request-Packet.html#The-F-Request-Packet" title="The F Request Packet">
|
|
<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="Protocol-Basics"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="The-F-Request-Packet.html#The-F-Request-Packet">The F Request Packet</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="File_002dI_002fO-Overview.html#File_002dI_002fO-Overview">File-I/O Overview</a>,
|
|
Up: <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.2 Protocol Basics</h4>
|
|
|
|
<p><a name="index-protocol-basics_002c-file_002di_002fo-3596"></a>
|
|
The File-I/O protocol uses the <code>F</code> packet as the request as well
|
|
as reply packet. Since a File-I/O system call can only occur when
|
|
<span class="sc">gdb</span> is waiting for a response from the continuing or stepping target,
|
|
the File-I/O request is a reply that <span class="sc">gdb</span> has to expect as a result
|
|
of a previous ‘<samp><span class="samp">C</span></samp>’, ‘<samp><span class="samp">c</span></samp>’, ‘<samp><span class="samp">S</span></samp>’ or ‘<samp><span class="samp">s</span></samp>’ packet.
|
|
This <code>F</code> packet contains all information needed to allow <span class="sc">gdb</span>
|
|
to call the appropriate host system call:
|
|
|
|
<ul>
|
|
<li>A unique identifier for the requested system call.
|
|
|
|
<li>All parameters to the system call. Pointers are given as addresses
|
|
in the target memory address space. Pointers to strings are given as
|
|
pointer/length pair. Numerical values are given as they are.
|
|
Numerical control flags are given in a protocol-specific representation.
|
|
|
|
</ul>
|
|
|
|
<p>At this point, <span class="sc">gdb</span> has to perform the following actions.
|
|
|
|
<ul>
|
|
<li>If the parameters include pointer values to data needed as input to a
|
|
system call, <span class="sc">gdb</span> requests this data from the target with a
|
|
standard <code>m</code> packet request. This additional communication has to be
|
|
expected by the target implementation and is handled as any other <code>m</code>
|
|
packet.
|
|
|
|
<li><span class="sc">gdb</span> translates all value from protocol representation to host
|
|
representation as needed. Datatypes are coerced into the host types.
|
|
|
|
<li><span class="sc">gdb</span> calls the system call.
|
|
|
|
<li>It then coerces datatypes back to protocol representation.
|
|
|
|
<li>If the system call is expected to return data in buffer space specified
|
|
by pointer parameters to the call, the data is transmitted to the
|
|
target using a <code>M</code> or <code>X</code> packet. This packet has to be expected
|
|
by the target implementation and is handled as any other <code>M</code> or <code>X</code>
|
|
packet.
|
|
|
|
</ul>
|
|
|
|
<p>Eventually <span class="sc">gdb</span> replies with another <code>F</code> packet which contains all
|
|
necessary information for the target to continue. This at least contains
|
|
|
|
<ul>
|
|
<li>Return value.
|
|
|
|
<li><code>errno</code>, if has been changed by the system call.
|
|
|
|
<li>“Ctrl-C” flag.
|
|
|
|
</ul>
|
|
|
|
<p>After having done the needed type and value coercion, the target continues
|
|
the latest continue or step action.
|
|
|
|
</body></html>
|
|
|