PowerPC Embedded - Debugging with GDB
Description: Debugging with GDB

Next: PA, Previous: OpenRISC 1000, Up: Embedded Processors

#### 21.3.7 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 Set 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 specifies. To set a ranged breakpoint in gdb, use the `break-range` command.

gdb provides the following PowerPC-specific commands:

`break-range` start-location`,` end-location
  Set a breakpoint for an address range. start-location and end-location can specify a function name, a line number, an offset of lines from the current line or from the start location, or an address of an instruction (see Specify Location, for a list of all the possible ways to specify a location.) The breakpoint will stop execution of the inferior whenever it executes an instruction at any address within the specified range, (including start-location and end-location.)

`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.

`target dink32` dev
  DINK32 ROM monitor.

`target ppcbug` dev
`target ppcbug1` dev
  PPCBUG ROM monitor for PowerPC.

`target sds` dev
  SDS monitor, running on a PowerPC board (such as Motorola's ADS).

The following commands specific to the SDS protocol are supported by gdb:

`set sdstimeout` nsec
  Set the timeout for SDS protocol reads to be nsec seconds. The default is 2 seconds.
`show sdstimeout`
  Show the current value of the SDS timeout.
`sds` command
  Send the specified command string to the SDS monitor.