static void store_fp_register (const struct regcache *regcache, int regno) { struct fpreg inferior_fp_registers; int ret; ret = ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &inferior_fp_registers, TIDGET (inferior_ptid)); if (ret < 0) { warning (_("unable to fetch floating-point registers")); return; } switch (regno) { case ARM_FPSCR_REGNUM: regcache_raw_collect (regcache, ARM_FPS_REGNUM, (char *) &inferior_fp_registers.fpr_vfp.vfp_fpscr); break; default: regcache_raw_collect (regcache, regno, (char *) inferior_fp_registers.fpr_vfp.vfp_regs + 8 * (regno - ARM_D0_REGNUM)); break; } ret = ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &inferior_fp_registers, TIDGET (inferior_ptid)); if (ret < 0) warning (_("unable to write register %d to inferior"), regno); }
static void ppcnbsd_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = get_regcache_arch (regcache); if (regnum == -1 || getregs_supplies (gdbarch, regnum)) { struct reg regs; if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't get registers")); ppc_supply_gregset (&ppcnbsd_gregset, regcache, regnum, ®s, sizeof regs); } if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) { struct fpreg fpregs; if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't get FP registers")); ppc_supply_fpregset (&ppcnbsd_fpregset, regcache, regnum, &fpregs, sizeof fpregs); } }
static unsigned long i386_linux_dr_get (ptid_t ptid, int regnum) { int tid; unsigned long value; tid = TIDGET (ptid); if (tid == 0) tid = PIDGET (ptid); /* FIXME: kettenis/2001-03-27: Calling perror_with_name if the ptrace call fails breaks debugging remote targets. The correct way to fix this is to add the hardware breakpoint and watchpoint stuff to the target vector. For now, just return zero if the ptrace call fails. */ errno = 0; value = ptrace (PTRACE_PEEKUSER, tid, offsetof (struct user, u_debugreg[regnum]), 0); if (errno != 0) #if 0 perror_with_name (_("Couldn't read debug register")); #else return 0; #endif return value; }
static void fetch_fp_register (struct regcache *regcache, int regno) { struct fpreg inferior_fp_registers; int ret; ret = ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &inferior_fp_registers, TIDGET (inferior_ptid)); if (ret < 0) { warning (_("unable to fetch floating-point register")); return; } switch (regno) { case ARM_FPS_REGNUM: regcache_raw_supply (regcache, ARM_FPS_REGNUM, (char *) &inferior_fp_registers.fpr_fpsr); break; default: regcache_raw_supply (regcache, regno, (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]); break; } }
void fill_fpregset (const struct regcache *regcache, fpregset_t *fpregs, int regnum) { if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) fpregs, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't get FP registers")); }
static void amd64_linux_fetch_inferior_registers (int regnum) { int tid; /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ if (regnum == -1 || amd64_native_gregset_supplies_p (regnum)) { elf_gregset_t regs; if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0) perror_with_name (_("Couldn't get registers")); amd64_supply_native_gregset (current_regcache, ®s, -1); if (regnum != -1) return; } if (regnum == -1 || !amd64_native_gregset_supplies_p (regnum)) { elf_fpregset_t fpregs; if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0) perror_with_name (_("Couldn't get floating point status")); amd64_supply_fxsave (current_regcache, -1, &fpregs); } }
static void fetch_register (int regno) { int tid; int val; if (CANNOT_FETCH_REGISTER (regno)) { regcache_raw_supply (current_regcache, regno, NULL); return; } /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0); if (errno != 0) error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regno), regno, safe_strerror (errno)); regcache_raw_supply (current_regcache, regno, &val); }
void supply_fpregset (struct regcache *regcache, const fpregset_t *fpregs) { if (ptrace (PT_SETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) fpregs, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't set FP registers")); }
static void fetch_register (struct regcache *regcache, int regno) { int tid; int val; gdb_assert (!have_ptrace_getregs); if (i386_linux_gregset_reg_offset[regno] == -1) { regcache_raw_supply (regcache, regno, NULL); return; } /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, i386_linux_gregset_reg_offset[regno], 0); if (errno != 0) error (_("Couldn't read register %s (#%d): %s."), gdbarch_register_name (get_regcache_arch (regcache), regno), regno, safe_strerror (errno)); regcache_raw_supply (regcache, regno, &val); }
static void fetch_register (struct regcache *regcache, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); long regaddr, val; int i; gdb_byte buf[MAX_REGISTER_SIZE]; int tid; /* Overload thread id onto process id. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* no thread id, just use process id. */ regaddr = 4 * regmap[regno]; for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long)) { errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, regaddr, 0); memcpy (&buf[i], &val, sizeof (long)); regaddr += sizeof (long); if (errno != 0) error (_("Couldn't read register %s (#%d): %s."), gdbarch_register_name (gdbarch, regno), regno, safe_strerror (errno)); } regcache_raw_supply (regcache, regno, buf); }
void supply_gregset (struct regcache *regcache, const gregset_t *gregs) { if (ptrace (PT_SETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) gregs, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't write registers")); }
static void store_register (const struct regcache *regcache, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); long regaddr, val; int i; int tid; gdb_byte buf[MAX_REGISTER_SIZE]; /* Overload thread id onto process id. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* no thread id, just use process id. */ regaddr = 4 * regmap[regno]; /* Put the contents of regno into a local buffer. */ regcache_raw_collect (regcache, regno, buf); /* Store the local buffer into the inferior a chunk at the time. */ for (i = 0; i < register_size (gdbarch, regno); i += sizeof (long)) { errno = 0; memcpy (&val, &buf[i], sizeof (long)); ptrace (PTRACE_POKEUSER, tid, regaddr, val); regaddr += sizeof (long); if (errno != 0) error (_("Couldn't write register %s (#%d): %s."), gdbarch_register_name (gdbarch, regno), regno, safe_strerror (errno)); } }
static void fetch_register (struct regcache *regcache, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); int tid; int val; if (gdbarch_cannot_fetch_register (gdbarch, regno)) { regcache_raw_supply (regcache, regno, NULL); return; } /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ errno = 0; val = ptrace (PTRACE_PEEKUSER, tid, hppa_linux_register_addr (regno, 0), 0); if (errno != 0) error (_("Couldn't read register %s (#%d): %s."), gdbarch_register_name (gdbarch, regno), regno, safe_strerror (errno)); regcache_raw_supply (regcache, regno, &val); }
/* Set a watchpoint of type TYPE at address ADDR. */ static int ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw) { int tid; long dabr_value; ptid_t ptid = inferior_ptid; dabr_value = addr & ~7; switch (rw) { case hw_read: /* Set read and translate bits. */ dabr_value |= 5; break; case hw_write: /* Set write and translate bits. */ dabr_value |= 6; break; case hw_access: /* Set read, write and translate bits. */ dabr_value |= 7; break; } tid = TIDGET (ptid); if (tid == 0) tid = PIDGET (ptid); return ptrace (PTRACE_SET_DEBUGREG, tid, 0, dabr_value); }
static void i386bsd_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { if (regnum == -1 || GETREGS_SUPPLIES (regnum)) { struct reg regs; if (ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) ®s, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't get registers")); i386bsd_supply_gregset (regcache, ®s); if (regnum != -1) return; } if (regnum == -1 || regnum >= I386_ST0_REGNUM) { struct fpreg fpregs; #ifdef HAVE_PT_GETXMMREGS char xmmregs[512]; if (have_ptrace_xmmregs != 0 && ptrace(PT_GETXMMREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) xmmregs, TIDGET (inferior_ptid)) == 0) { have_ptrace_xmmregs = 1; i387_supply_fxsave (regcache, -1, xmmregs); } else { if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't get floating point status")); i387_supply_fsave (regcache, -1, &fpregs); } #else if (ptrace (PT_GETFPREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &fpregs, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't get floating point status")); i387_supply_fsave (regcache, -1, &fpregs); #endif } }
int get_thread_id (ptid_t ptid) { int tid = TIDGET (ptid); if (0 == tid) tid = PIDGET (ptid); return tid; }
/* Store register REGNO back into the child process. If REGNO is -1, do this for all registers (including the floating point and SSE registers). */ static void i386_linux_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) { int tid; /* Use the old method of poking around in `struct user' if the SETREGS request isn't available. */ if (!have_ptrace_getregs) { int i; for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++) if (regno == -1 || regno == i) store_register (regcache, i); return; } /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ /* Use the PTRACE_SETFPXREGS requests whenever possible, since it transfers more registers in one system call. But remember that store_fpxregs can fail, and return zero. */ if (regno == -1) { store_regs (regcache, tid, regno); if (store_fpxregs (regcache, tid, regno)) return; store_fpregs (regcache, tid, regno); return; } if (GETREGS_SUPPLIES (regno)) { store_regs (regcache, tid, regno); return; } if (GETFPXREGS_SUPPLIES (regno)) { if (store_fpxregs (regcache, tid, regno)) return; /* Either our processor or our kernel doesn't support the SSE registers, so just write the FP registers in the traditional way. */ store_fpregs (regcache, tid, regno); return; } internal_error (__FILE__, __LINE__, _("Got request to store bad register number %d."), regno); }
char * child_pid_to_str (ptid_t ptid) { static char buf[40]; sprintf (buf, "process %d thread %d", PIDGET (ptid), TIDGET (ptid)); return buf; }
/* Find the TID for the current inferior thread to use with ptrace. */ static int s390_inferior_tid (void) { /* GNU/Linux LWP ID's are process ID's. */ int tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ return tid; }
void sparc_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = get_regcache_arch (regcache); int pid; /* NOTE: cagney/2002-12-03: This code assumes that the currently selected light weight processes' registers can be written directly into the selected thread's register cache. This works fine when given an 1:1 LWP:thread model (such as found on GNU/Linux) but will, likely, have problems when used on an N:1 (userland threads) or N:M (userland multiple LWP) model. In the case of the latter two, the LWP's registers do not necessarily belong to the selected thread (the LWP could be in the middle of executing the thread switch code). These functions should instead be paramaterized with an explicit object (struct regcache, struct thread_info?) into which the LWPs registers can be written. */ pid = TIDGET (inferior_ptid); if (pid == 0) pid = PIDGET (inferior_ptid); if (regnum == SPARC_G0_REGNUM) { gdb_byte zero[8] = { 0 }; regcache_raw_supply (regcache, SPARC_G0_REGNUM, &zero); return; } if (regnum == -1 || sparc_gregset_supplies_p (gdbarch, regnum)) { gregset_t regs; if (ptrace (PTRACE_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); sparc_supply_gregset (sparc_gregset, regcache, -1, ®s); if (regnum != -1) return; } if (regnum == -1 || sparc_fpregset_supplies_p (gdbarch, regnum)) { fpregset_t fpregs; if (ptrace (PTRACE_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) perror_with_name (_("Couldn't get floating point status")); sparc_supply_fpregset (regcache, -1, &fpregs); } }
static void store_debug_register (ptid_t ptid, int idx, long val) { int tid; tid = TIDGET (ptid); if (tid == 0) tid = PIDGET (ptid); (void) ptrace (PT_WRITE_U, tid, (PTRACE_TYPE_ARG3) (PT_DBR + 8 * idx), val); }
static const struct target_desc * i386_linux_read_description (struct target_ops *ops) { int tid; static uint64_t xcr0; /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ #ifdef HAVE_PTRACE_GETFPXREGS if (have_ptrace_getfpxregs == -1) { elf_fpxregset_t fpxregs; if (ptrace (PTRACE_GETFPXREGS, tid, 0, (int) &fpxregs) < 0) { have_ptrace_getfpxregs = 0; have_ptrace_getregset = 0; return tdesc_i386_mmx_linux; } } #endif if (have_ptrace_getregset == -1) { uint64_t xstateregs[(I386_XSTATE_SSE_SIZE / sizeof (uint64_t))]; struct iovec iov; iov.iov_base = xstateregs; iov.iov_len = sizeof (xstateregs); /* Check if PTRACE_GETREGSET works. */ if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, &iov) < 0) have_ptrace_getregset = 0; else { have_ptrace_getregset = 1; /* Get XCR0 from XSAVE extended state. */ xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET / sizeof (long long))]; } } /* Check the native XCR0 only if PTRACE_GETREGSET is available. */ if (have_ptrace_getregset && (xcr0 & I386_XSTATE_AVX_MASK) == I386_XSTATE_AVX_MASK) return tdesc_i386_avx_linux; else return tdesc_i386_linux; }
LONGEST sparc_xfer_wcookie (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { unsigned long wcookie = 0; char *buf = (char *)&wcookie; gdb_assert (object == TARGET_OBJECT_WCOOKIE); gdb_assert (readbuf && writebuf == NULL); if (offset == sizeof (unsigned long)) return 0; /* Signal EOF. */ if (offset > sizeof (unsigned long)) return -1; #ifdef PT_WCOOKIE /* If PT_WCOOKIE is defined (by <sys/ptrace.h>), assume we're running on an OpenBSD release that uses StackGhost (3.1 or later). Since release 3.6, OpenBSD uses a fully randomized cookie. */ { int pid; pid = TIDGET (inferior_ptid); if (pid == 0) pid = PIDGET (inferior_ptid); /* Sanity check. The proper type for a cookie is register_t, but we can't assume that this type exists on all systems supported by the code in this file. */ gdb_assert (sizeof (wcookie) == sizeof (register_t)); /* Fetch the cookie. */ if (ptrace (PT_WCOOKIE, pid, (PTRACE_TYPE_ARG3) &wcookie, 0) == -1) { if (errno != EINVAL) perror_with_name (_("Couldn't get StackGhost cookie")); /* Although PT_WCOOKIE is defined on OpenBSD 3.1 and later, the request wasn't implemented until after OpenBSD 3.4. If the kernel doesn't support the PT_WCOOKIE request, assume we're running on a kernel that uses non-randomized cookies. */ wcookie = 0x3; } } #endif /* PT_WCOOKIE */ if (len > sizeof (unsigned long) - offset) len = sizeof (unsigned long) - offset; memcpy (readbuf, buf + offset, len); return len; }
static void i386bsd_dr_set (int regnum, unsigned int value) { struct dbreg dbregs; if (ptrace (PT_GETDBREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &dbregs, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't get debug registers")); /* For some mysterious reason, some of the reserved bits in the debug control register get set. Mask these off, otherwise the ptrace call below will fail. */ DBREG_DRX ((&dbregs), 7) &= ~(0x0000fc00); DBREG_DRX ((&dbregs), regnum) = value; if (ptrace (PT_SETDBREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &dbregs, TIDGET (inferior_ptid)) == -1) perror_with_name (_("Couldn't write debug registers")); }
static void m68k_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno) { int tid; /* Use the old method of peeking around in `struct user' if the GETREGS request isn't available. */ if (! have_ptrace_getregs) { old_fetch_inferior_registers (regcache, regno); return; } /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ /* Use the PTRACE_GETFPXREGS request whenever possible, since it transfers more registers in one system call, and we'll cache the results. But remember that fetch_fpxregs can fail, and return zero. */ if (regno == -1) { fetch_regs (regcache, tid); /* The call above might reset `have_ptrace_getregs'. */ if (! have_ptrace_getregs) { old_fetch_inferior_registers (regcache, -1); return; } fetch_fpregs (regcache, tid); return; } if (getregs_supplies (regno)) { fetch_regs (regcache, tid); return; } if (getfpregs_supplies (regno)) { fetch_fpregs (regcache, tid); return; } internal_error (__FILE__, __LINE__, _("Got request for bad register number %d."), regno); }
static int ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw) { int tid; ptid_t ptid = inferior_ptid; tid = TIDGET (ptid); if (tid == 0) tid = PIDGET (ptid); return ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0); }
static int ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw) { struct lwp_info *lp; ptid_t ptid; long dabr_value = 0; saved_dabr_value = 0; ALL_LWPS (lp, ptid) if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0, saved_dabr_value) < 0) return -1; return 0; }
static void fetch_register (struct regcache *regcache, int regno) { struct reg inferior_registers; int ret; ret = ptrace (PT_GETREGS, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) &inferior_registers, TIDGET (inferior_ptid)); if (ret < 0) { warning (_("unable to fetch general register")); return; } switch (regno) { case ARM_SP_REGNUM: regcache_raw_supply (regcache, ARM_SP_REGNUM, (char *) &inferior_registers.r_sp); break; case ARM_LR_REGNUM: regcache_raw_supply (regcache, ARM_LR_REGNUM, (char *) &inferior_registers.r_lr); break; case ARM_PC_REGNUM: /* This is ok: we're running native... */ inferior_registers.r_pc = gdbarch_addr_bits_remove (get_regcache_arch (regcache), inferior_registers.r_pc); regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &inferior_registers.r_pc); break; case ARM_PS_REGNUM: if (arm_apcs_32) regcache_raw_supply (regcache, ARM_PS_REGNUM, (char *) &inferior_registers.r_cpsr); else regcache_raw_supply (regcache, ARM_PS_REGNUM, (char *) &inferior_registers.r_pc); break; default: regcache_raw_supply (regcache, regno, (char *) &inferior_registers.r[regno]); break; } }
static void amd64_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regnum) { struct gdbarch *gdbarch = get_regcache_arch (regcache); int tid; /* GNU/Linux LWP ID's are process ID's. */ tid = TIDGET (inferior_ptid); if (tid == 0) tid = PIDGET (inferior_ptid); /* Not a threaded program. */ if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) { elf_gregset_t regs; if (ptrace (PTRACE_GETREGS, tid, 0, (long) ®s) < 0) perror_with_name (_("Couldn't get registers")); amd64_supply_native_gregset (regcache, ®s, -1); if (regnum != -1) return; } if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum)) { elf_fpregset_t fpregs; if (have_ptrace_getregset) { char xstateregs[I386_XSTATE_MAX_SIZE]; struct iovec iov; iov.iov_base = xstateregs; iov.iov_len = sizeof (xstateregs); if (ptrace (PTRACE_GETREGSET, tid, (unsigned int) NT_X86_XSTATE, (long) &iov) < 0) perror_with_name (_("Couldn't get extended state status")); amd64_supply_xsave (regcache, -1, xstateregs); } else { if (ptrace (PTRACE_GETFPREGS, tid, 0, (long) &fpregs) < 0) perror_with_name (_("Couldn't get floating point status")); amd64_supply_fxsave (regcache, -1, &fpregs); } } }
static void i386_linux_dr_set (ptid_t ptid, int regnum, unsigned long value) { int tid; tid = TIDGET (ptid); if (tid == 0) tid = PIDGET (ptid); errno = 0; ptrace (PTRACE_POKEUSER, tid, offsetof (struct user, u_debugreg[regnum]), value); if (errno != 0) perror_with_name (_("Couldn't write debug register")); }