From e6059f4aafa1e617c9f1272f9ce2faa9b1ed7ab1 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 20 Mar 1995 17:11:35 +0000 Subject: [PATCH] * hppab-nat.c (store_inferior_registers): Sync with HPUX version. --- gdb/ChangeLog | 4 ++++ gdb/hppab-nat.c | 64 ++++++++++++++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a54a27ce9..fac4a7080c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +Mon Mar 20 10:09:59 1995 Jeff Law (law@snake.cs.utah.edu) + + * hppab-nat.c (store_inferior_registers): Sync with HPUX version. + Mon Mar 20 07:34:48 1995 Stu Grossman (grossman@cygnus.com) * hppah-nat.c (store_inferior_registers): Move check for diff --git a/gdb/hppab-nat.c b/gdb/hppab-nat.c index 5bc0bb4308..f151a5414e 100644 --- a/gdb/hppab-nat.c +++ b/gdb/hppab-nat.c @@ -105,42 +105,56 @@ store_inferior_registers (regno) int regno; { register unsigned int regaddr; + char buf[80]; extern char registers[]; register int i; - unsigned int offset = U_REGS_OFFSET; + int scratch; if (regno >= 0) { + if (CANNOT_STORE_REGISTER (regno)) + return; regaddr = register_addr (regno, offset); - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) - { - errno = 0; - ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, - *(int *) ®isters[REGISTER_BYTE (regno) + i]); - if (errno != 0) - { - char *err = safe_strerror (errno); - char *msg = alloca (strlen (err) + 128); - sprintf (msg, "writing register %s: %s", reg_names[regno], err); - warning (msg); - } - regaddr += sizeof(int); - } + errno = 0; + if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM) + { + scratch = *(int *) ®isters[REGISTER_BYTE (regno)] | 0x3; + ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, + scratch); + if (errno != 0) + { + /* Error, even if attached. Failing to write these two + registers is pretty serious. */ + sprintf (buf, "writing register number %d", regno); + perror_with_name (buf); + } + } + else + for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int)) + { + errno = 0; + ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, + *(int *) ®isters[REGISTER_BYTE (regno) + i]); + if (errno != 0) + { + /* Warning, not error, in case we are attached; sometimes the + kernel doesn't let us at the registers. */ + char *err = safe_strerror (errno); + char *msg = alloca (strlen (err) + 128); + sprintf (msg, "writing register %s: %s", + reg_names[regno], err); + warning (msg); + return; + } + regaddr += sizeof(int); + } } else - { - for (regno = 0; regno < NUM_REGS; regno++) - { - if (CANNOT_STORE_REGISTER (regno)) - continue; - store_inferior_registers (regno); - } - } - return; + for (regno = 0; regno < NUM_REGS; regno++) + store_inferior_registers (regno); } - /* PT_PROT is specific to the PA BSD kernel and isn't documented anywhere (except here).