PowerPC Embedded (Debugging with GDB)

#### 21.3.8 PowerPC Embedded ¶

GDB supports using the DVC (Data Value Compare) register to implement in hardware simple hardware watchpoint conditions of the form:

    (gdb) watch address|variable \
      if  address|variable == constant expression

The DVC register will be automatically used when GDB detects such pattern in a condition expression, and the created watchpoint uses one debug register (either the `exact-watchpoints` option is on and the variable is scalar, or the variable has a length of one byte). This feature is available in native GDB running on a Linux kernel version 2.6.34 or newer.

When running on PowerPC embedded processors, GDB automatically uses ranged hardware watchpoints, unless the `exact-watchpoints` option is on, in which case watchpoints using only one debug register are created when watching variables of scalar types.

You can create an artificial array to watch an arbitrary memory region using one of the following commands (see Expressions):

    (gdb) watch *((char *) address)@length
    (gdb) watch {char[length]} address

PowerPC embedded processors support masked watchpoints. See the discussion about the `mask` argument in Setting Watchpoints.

PowerPC embedded processors support hardware accelerated ranged breakpoints. A ranged breakpoint stops execution of the inferior whenever it executes an instruction at any address within the range it was set at. To set a ranged breakpoint in GDB, use the `break-range` command.

GDB provides the following PowerPC-specific commands:

`break-range start-locspec, end-locspec` ¶

  Set a breakpoint for an address range given by start-locspec and end-locspec, which are location specs. See Location Specifications, for a list of all the possible forms of location specs. GDB resolves both start-locspec and end-locspec, and uses the addresses of the resolved code locations as start and end addresses of the range to break at. The breakpoint will stop execution of the inferior whenever it executes an instruction at any address between the start and end addresses, inclusive. If either start-locspec or end-locspec resolve to multiple code locations in the program, then the command aborts with an error without creating a breakpoint.

`set powerpc soft-float` ¶
`show powerpc soft-float`

  Force GDB to use (or not use) a software floating point calling convention. By default, GDB selects the calling convention based on the selected architecture and the provided executable file.

`set powerpc vector-abi`
`show powerpc vector-abi`

  Force GDB to use the specified calling convention for vector arguments and return values. The valid options are ‘`auto`’; ‘`generic`’, to avoid vector registers even if they are present; ‘`altivec`’, to use AltiVec registers; and ‘`spe`’ to use SPE registers. By default, GDB selects the calling convention based on the selected architecture and the provided executable file.

`set powerpc exact-watchpoints`
`show powerpc exact-watchpoints`

  Allow GDB to use only one debug register when watching a variable of scalar type, thus assuming that the variable is accessed through the address of its first byte.