gdb.info: File-I/O Examples

Go backward to Constants
Go up to File-I/O remote protocol extension
Go to the top op gdb

File-I/O Examples

Example sequence of a write call, file descriptor 3, buffer is at target
address 0x1234, 6 bytes should be written:
     <- `Fwrite,3,1234,6'
     _request memory read from target_
     -> `m1234,6'
     <- XXXXXX
     _return "6 bytes written"_
     -> `F6'
   Example sequence of a read call, file descriptor 3, buffer is at
target address 0x1234, 6 bytes should be read:
     <- `Fread,3,1234,6'
     _request memory write to target_
     -> `X1234,6:XXXXXX'
     _return "6 bytes read"_
     -> `F6'
   Example sequence of a read call, call fails on the host due to
invalid file descriptor (EBADF):

<- `Fread,3,1234,6' -> `F-1,9'

   Example sequence of a read call, user presses Ctrl-C before syscall
on host is called:

<- `Fread,3,1234,6' -> `F-1,4,C' <- `T02'

   Example sequence of a read call, user presses Ctrl-C after syscall on
host is called:
     <- `Fread,3,1234,6'
     -> `X1234,6:XXXXXX'
     <- `T02'