gdb.info: File-I/O Overview
Go forward to Protocol basics
Go up to File-I/O remote protocol extension
Go to the top op gdb
The File I/O remote protocol extension (short: File-I/O) allows the
target to use the hosts file system and console I/O when calling various
system calls. System calls on the target system are translated into a
remote protocol packet to the host system which then performs the needed
actions and returns with an adequate response packet to the target
system. This simulates file system operations even on targets that
lack file systems.
The protocol is defined host- and target-system independent. It uses
it's own independent representation of datatypes and values. Both, GDB
and the target's GDB stub are responsible for translating the system
dependent values into the unified protocol values when data is
The communication is synchronous. A system call is possible only
when GDB is waiting for the `C', `c', `S' or `s' packets. While GDB
handles the request for a system call, the target is stopped to allow
deterministic access to the target's memory. Therefore File-I/O is not
interuptible by target signals. It is possible to interrupt File-I/O
by a user interrupt (Ctrl-C), though.
The target's request to perform a host system call does not finish
the latest `C', `c', `S' or `s' action. That means, after finishing
the system call, the target returns to continuing the previous activity
(continue, step). No additional continue or step request from GDB is
<- target requests 'system call X'
target is stopped, GDB executes system call
-> GDB returns result
... target continues, GDB returns to wait for the target
<- target hits breakpoint and sends a Txx packet
The protocol is only used for files on the host file system and for
I/O on the console. Character or block special devices, pipes, named
pipes or sockets or any other communication method on the host system
are not supported by this protocol.
Created Mon Nov 8 17:42:41 2004 on tillpc with info_to_html version 0.9.6.