|Debugging with GDB: Using Agent Expressions|
Agent expressions can be used in several different ways by GDB, and the debugger can generate different bytecode sequences as appropriate.
One possibility is to do expression evaluation on the target rather than the host, such as for the conditional of a conditional tracepoint. In such a case, GDB compiles the source expression into a bytecode sequence that simply gets values from registers or memory, does arithmetic, and returns a result.
Another way to use agent expressions is for tracepoint data
collection. GDB generates a different bytecode sequence for
collection; in addition to bytecodes that do the calculation,
trace bytecodes to save the pieces of
memory that were used.