You copied the Doc URL to your clipboard.


Sets a watchpoint for a data symbol. The debugger stops the target when the memory at the specified address is written.

This command records the ID of the watchpoint in a new debugger variable, $<n>, where <n> is a number. You can use this variable, in a script, to delete or modify the watchpoint behavior. If $<n> is the last or second-to-last debugger variable, then you can also access the ID using $ or $$, respectively.

Watchpoints are only supported on scalar values.

The availability of watchpoints depends on your target. In the case of Linux application debug using gdbserver, the availability of watchpoints also depends on the Linux kernel version and configuration.

The address of the instruction that triggers the watchpoint might not be the address shown in the PC register. This is because of pipelining effects.


watch [-d][-p] [-w <width>] [{filename:]<symbol> | *<address>} [vmid <number>] [if <condition>]



Creates the watchpoint disabled.


Specifies whether or not the resolution of an unrecognized watchpoint location results in a pending watchpoint being created.

-w <width>

Specifies the width to watch at the given address, in bits. Accepted values are: 8, 16, 32, and 64 if supported by the target. This parameter is optional.

The width defaults to:

  • 32 bits for an address.
  • The width corresponding to the type of the symbol or expression, if entered.

Specifies the file.


Specifies a global/static data symbol. For arrays or structs you must specify the element or member.


Specifies the address. This can be either an address or an expression that evaluates to an address.

vmid <number>

Specifies the Virtual Machine ID (VMID) to apply the watchpoint to. This can be either an integer or an expression that evaluates to an integer. Applicable only on targets which support hypervisor / virtual machine debugging.

if <condition>

Specifies the condition which must evaluate to true at the time the watchpoint is triggered for the target to stop. You can create several conditional watchpoints, but when a conditional watchpoint is enabled, no other watchpoints (regardless of whether they are conditional) can be enabled.


watch myVar1                        # Set read/write watchpoint on myVar1
watch *0x80D4                       # Set read/write watchpoint on address 0x80D4
watch myVar1 if myVar1 == 2         # Set read/write watchpoint on myVar1 which
                                    # will only be hit if myVar1 evaluates to 2
watch myVar1 if $LR & 0xFF == 0x12  # Set read/write watchpoint on myVar1 which
                                    # will only be hit if ($LR & 0xFF) evaluates
                                    # to 0x12 when myVar1 is accessed