Documentation/arch/powerpc/ptrace.rst

Source file repositories/reference/linux-study-clean/Documentation/arch/powerpc/ptrace.rst

File Facts

System
Linux kernel
Corpus path
Documentation/arch/powerpc/ptrace.rst
Extension
.rst
Size
6280 bytes
Lines
158
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ppc_debug_info {
       unit32_t version;
       unit32_t num_instruction_bps;
       unit32_t num_data_bps;
       unit32_t num_condition_regs;
       unit32_t data_bp_alignment;
       unit32_t sizeof_condition; /* size of the DVC register */
       uint64_t features; /* bitmask of the individual flags */
  };

features will have bits indicating whether there is support for::

  #define PPC_DEBUG_FEATURE_INSN_BP_RANGE		0x1
  #define PPC_DEBUG_FEATURE_INSN_BP_MASK		0x2
  #define PPC_DEBUG_FEATURE_DATA_BP_RANGE		0x4
  #define PPC_DEBUG_FEATURE_DATA_BP_MASK		0x8
  #define PPC_DEBUG_FEATURE_DATA_BP_DAWR		0x10
  #define PPC_DEBUG_FEATURE_DATA_BP_ARCH_31		0x20

2. PPC_PTRACE_SETHWDEBUG

Sets a hardware breakpoint or watchpoint, according to the provided structure::

  struct ppc_hw_breakpoint {
        uint32_t version;
  #define PPC_BREAKPOINT_TRIGGER_EXECUTE  0x1
  #define PPC_BREAKPOINT_TRIGGER_READ     0x2
 #define PPC_BREAKPOINT_TRIGGER_WRITE    0x4
        uint32_t trigger_type;       /* only some combinations allowed */
  #define PPC_BREAKPOINT_MODE_EXACT               0x0
  #define PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE     0x1
  #define PPC_BREAKPOINT_MODE_RANGE_EXCLUSIVE     0x2
  #define PPC_BREAKPOINT_MODE_MASK                0x3
        uint32_t addr_mode;          /* address match mode */

  #define PPC_BREAKPOINT_CONDITION_MODE   0x3
  #define PPC_BREAKPOINT_CONDITION_NONE   0x0
  #define PPC_BREAKPOINT_CONDITION_AND    0x1
  #define PPC_BREAKPOINT_CONDITION_EXACT  0x1	/* different name for the same thing as above */
  #define PPC_BREAKPOINT_CONDITION_OR     0x2
  #define PPC_BREAKPOINT_CONDITION_AND_OR 0x3
  #define PPC_BREAKPOINT_CONDITION_BE_ALL 0x00ff0000	/* byte enable bits */
  #define PPC_BREAKPOINT_CONDITION_BE(n)  (1<<((n)+16))
        uint32_t condition_mode;     /* break/watchpoint condition flags */

        uint64_t addr;
        uint64_t addr2;
        uint64_t condition_value;
  };

A request specifies one event, not necessarily just one register to be set.
For instance, if the request is for a watchpoint with a condition, both the
DAC and DVC registers will be set in the same request.

With this GDB can ask for all kinds of hardware breakpoints and watchpoints
that the BookE supports. COMEFROM breakpoints available in server processors
are not contemplated, but that is out of the scope of this work.

ptrace will return an integer (handle) uniquely identifying the breakpoint or
watchpoint just created. This integer will be used in the PPC_PTRACE_DELHWDEBUG
request to ask for its removal. Return -ENOSPC if the requested breakpoint
can't be allocated on the registers.

Some examples of using the structure to:

- set a breakpoint in the first breakpoint register::

    p.version         = PPC_DEBUG_CURRENT_VERSION;
    p.trigger_type    = PPC_BREAKPOINT_TRIGGER_EXECUTE;
    p.addr_mode       = PPC_BREAKPOINT_MODE_EXACT;

Annotation

Implementation Notes