Appendix E. The GDB Agent Expression Mechanism
359
ness. The register number is not guaranteed to fall at any particular alignment within the bytecode
stream; thus, on machines where fetching a 16-bit on an unaligned address raises an exception,
you should fetch the register number one byte at a time.
trace
(0x0c):
addr size
=>
Record the contents of the
size
bytes at
addr
in a trace buffer, for later retrieval by GDB.
trace_quick
(0x0d)
size
:
addr
=>
addr
Record the contents of the
size
bytes at
addr
in a trace buffer, for later retrieval by GDB.
size
is a single byte unsigned integer following the
trace
opcode.
This bytecode is equivalent to the sequence
dup const8
size
trace
, but we provide it any-
way to save space in bytecode strings.
trace16
(0x30)
size
:
addr
=>
addr
Identical to trace_quick, except that
size
is a 16-bit big-endian unsigned integer, not a single
byte. This should probably have been named
trace_quick16
, for consistency.
end
(0x27): =>
Stop executing bytecode; the result should be the top element of the stack. If the purpose of the
expression was to compute an lvalue or a range of memory, then the next-to-top of the stack is
the lvalue’s address, and the top of the stack is the lvalue’s size, in bytes.
E.3. Using Agent Expressions
Here is a sketch of a full non-stop debugging cycle, showing how agent expressions fit into the process.
•
The user selects trace points in the program’s code at which GDB should collect data.
•
The user specifies expressions to evaluate at each trace point. These expressions may denote objects
in memory, in which case those objects’ contents are recorded as the program runs, or computed
values, in which case the values themselves are recorded.
•
GDB transmits the tracepoints and their associated expressions to the GDB agent, running on the
debugging target.
•
The agent arranges to be notified when a trace point is hit. Note that, on some systems, the target
operating system is completely responsible for collecting the data; refer to Section E.5
Tracing on
Symmetrix
.
•
When execution on the target reaches a trace point, the agent evaluates the expressions associated
with that trace point, and records the resulting values and memory ranges.
•
Later, when the user selects a given trace event and inspects the objects and expression values
recorded, GDB talks to the agent to retrieve recorded data as necessary to meet the user’s requests.
If the user asks to see an object whose contents have not been recorded, GDB reports an error.
E.4. Varying Target Capabilities
Some targets don’t support floating-point, and some would rather not have to deal with
long long
operations. Also, different targets will have different stack sizes, and different bytecode buffer lengths.
Thus, GDB needs a way to ask the target about itself. We haven’t worked out the details yet, but in
general, GDB should be able to send the target a packet asking it to describe itself. The reply should
be a packet whose length is explicit, so we can add new information to the packet in future revisions
Summary of Contents for ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Page 1: ...Red Hat Enterprise Linux 4 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: ......