Appendix D. gdb Remote Serial Protocol
337
D.7.4. The
F
reply packet
The
F
reply packet has the following format:
Fretcode,errno,Ctrl-C flag;call specific attachment
retcode
is the return code of the system call as hexadecimal value.
errno
is the errno set by the
call, in protocol specific representation. This parameter can be omitted if the call was successful.
Ctrl-C flag
is only send if the user requested a break. In this case,
errno
must be send as
well, even if the call was successful. The
Ctrl-C flag
itself consists of the character ’C’:
F0,0,C
or, if the call was interupted before the host call has been performed:
F-1,4,C
assuming 4 is the protocol specific representation of
EINTR
.
D.7.5. Memory transfer
Structured data which is transferred using a memory read or write as e.g. a
struct stat
is expected
to be in a protocol specific format with all scalar multibyte datatypes being big endian. This should
be done by the target before the
F
packet is sent resp. by gdb before it transfers memory to the target.
Transferred pointers to structured data should point to the already coerced data at any time.
D.7.6. The Ctrl-C message
A special case is, if the
Ctrl-C flag
is set in the gdb reply packet. In this case the target should
behave, as if it had gotten a break message. The meaning for the target is "system call interupted by
SIGINT
". Consequentially, the target should actually stop (as with a break message) and return to gdb
with a
T02
packet. In this case, it’s important for the target to know, in which state the system call
was interrupted. Since this action is by design not an atomic operation, we have to differ between two
cases:
•
The system call hasn’t been performed on the host yet.
•
The system call on the host has been finished.
These two states can be distinguished by the target by the value of the returned
errno
. If it’s the
protocol representation of
EINTR
, the system call hasn’t been performed. This is equivalent to the
EINTR
handling on POSIX systems. In any other case, the target may presume that the system call
has been finished -- successful or not -- and should behave as if the break message arrived right after
the system call.
gdb must behave reliable. If the system call has not been called yet, gdb may send the
F
reply imme-
diately, setting
EINTR
as
errno
in the packet. If the system call on the host has been finished before
the user requests a break, the full action must be finshed by gdb. This requires sending
M
or
X
packets
as they fit. The
F
packet may only be send when either nothing has happened or the full action has
been completed.
D.7.7. Console I/O
By default and if not explicitely closed by the target system, the file descriptors 0, 1 and 2 are con-
nected to the gdb console. Output on the gdb console is handled as any other file output operation
(
write(1, ...)
or
write(2, ...)
). Console input is handled by gdb so that after the target read
request from file descriptor 0 all following typing is buffered until either one of the following condi-
tions is met:
Summary of Contents for ENTERPRISE LINUX 3 - SECURITY GUIDE
Page 1: ...Red Hat Enterprise Linux 3 Debugging with gdb ...
Page 12: ...2 Chapter 1 Debugging with gdb ...
Page 28: ...18 Chapter 4 Getting In and Out of gdb ...
Page 34: ...24 Chapter 5 gdb Commands ...
Page 44: ...34 Chapter 6 Running Programs Under gdb ...
Page 68: ...58 Chapter 8 Examining the Stack ...
Page 98: ...88 Chapter 10 Examining Data ...
Page 112: ...102 Chapter 12 Tracepoints ...
Page 118: ...108 Chapter 13 Debugging Programs That Use Overlays ...
Page 138: ...128 Chapter 14 Using gdb with Different Languages ...
Page 144: ...134 Chapter 15 Examining the Symbol Table ...
Page 170: ...160 Chapter 19 Debugging remote programs ...
Page 198: ...188 Chapter 21 Controlling gdb ...
Page 204: ...194 Chapter 22 Canned Sequences of Commands ...
Page 206: ...196 Chapter 23 Command Interpreters ...
Page 216: ...206 Chapter 25 Using gdb under gnu Emacs ...
Page 296: ...286 Chapter 27 gdb Annotations ...
Page 300: ...290 Chapter 28 Reporting Bugs in gdb ...
Page 322: ...312 Chapter 30 Using History Interactively ...
Page 362: ...352 Appendix D gdb Remote Serial Protocol ...
Page 380: ...370 Appendix F GNU GENERAL PUBLIC LICENSE ...
Page 386: ...376 Appendix G GNU Free Documentation License ...
Page 410: ......