command Z

Meaning: Insert a type breakpoint or watchpoint starting at address 'address' of kind 'kind'.

Implementation notes: A remote target shall return an empty string for an unrecognized breakpoint or watchpoint packet type. A remote target shall support either both or neither of a given ‘Ztype…’ and ‘ztype…’ packet pair. To avoid potential problems with duplicate packets, the operations should be implemented in an idempotent way.

software breakpoint

Format: ‘Z0,addr,kind[;cond_list…][;cmds:persist,cmd_list…]’

Meaning: Insert a software breakpoint at address addr of type kind.

A software breakpoint is implemented by replacing the instruction at addr with a software breakpoint or trap instruction.

The kind is target-specific and typically indicates the size of the breakpoint in bytes that should be inserted. E.g., the ARM and MIPS can insert either a 2 or 4 byte breakpoint. Some architectures have additional meanings for kind; if no architecture-specific value is being used, it should be ‘0’. kind is hex-encoded.

ARM

kind = 2: 16-bit Thumb mode breakpoint.

kind = 3: 32-bit Thumb mode (Thumb-2) breakpoint.

kind = 4: 32-bit ARM mode breakpoint.

cond_list is an optional list of conditional expressions in bytecode form that should be evaluated on the target’s side. These are the conditions that should be taken into consideration when deciding if the breakpoint trigger should be reported back to GDB.

The cond_list parameter is comprised of a series of expressions, concatenated without separators. Each expression has the following form:

‘X len,expr’

len is the length of the bytecode expression and expr is the actual conditional expression in bytecode form.

The optional cmd_list parameter introduces commands that may be run on the target, rather than being reported back to GDB. The parameter starts with a numeric flag persist; if the flag is nonzero, then the breakpoint may remain active and the commands continue to be run even when GDB disconnects from the target. Following this flag is a series of expressions concatenated with no separators. Each expression has the following form:

‘X len,expr’

len is the length of the bytecode expression and expr is the actual commands expression in bytecode form.

Implementation note: It is possible for a target to copy or move code that contains software breakpoints (e.g., when implementing overlays). The behavior of this packet, in the presence of such a target, is not defined.

Reply:

OK

hardware breakpoint

Format: ‘Z1,addr,kind[;cond_list…][;cmds:persist,cmd_list…]’

Meaning: Insert a hardware breakpoint at address addr.

A hardware breakpoint is implemented using a mechanism that is not dependent on being able to modify the target’s memory.

The kind is target-specific and typically indicates the size of the breakpoint in bytes that should be inserted. E.g., the ARM and MIPS can insert either a 2 or 4 byte breakpoint. Some architectures have additional meanings for kind; if no architecture-specific value is being used, it should be ‘0’. kind is hex-encoded.

ARM

kind = 2: 16-bit Thumb mode breakpoint.

kind = 3: 32-bit Thumb mode (Thumb-2) breakpoint.

kind = 4: 32-bit ARM mode breakpoint.

cond_list is an optional list of conditional expressions in bytecode form that should be evaluated on the target’s side. These are the conditions that should be taken into consideration when deciding if the breakpoint trigger should be reported back to GDB.

The cond_list parameter is comprised of a series of expressions, concatenated without separators. Each expression has the following form:

‘X len,expr’

len is the length of the bytecode expression and expr is the actual conditional expression in bytecode form.

The optional cmd_list parameter introduces commands that may be run on the target, rather than being reported back to GDB. The parameter starts with a numeric flag persist; if the flag is nonzero, then the breakpoint may remain active and the commands continue to be run even when GDB disconnects from the target. Following this flag is a series of expressions concatenated with no separators. Each expression has the following form:

‘X len,expr’

len is the length of the bytecode expression and expr is the actual commands expression in bytecode form.

Implementation note: A hardware breakpoint is not affected by code movement.

Reply:

OK

write watchpoint

Format: ‘Z2,addr,kind’

Meaning: Insert a write watchpoint at addr. The number of bytes to watch is specified by kind.

Reply:

OK

read watchpoint

Format: ‘Z3,addr,kind’

Meaning: Insert a read watchpoint at addr. The number of bytes to watch is specified by kind.

Reply:

OK

access watchpoint

Format: ‘Z4,addr,kind’

Meaning: Insert an access watchpoint at addr. The number of bytes to watch is specified by kind.

Reply:

OK