* hppa{b,h}-nat.c: Warning, not error, if can't access registers.

This commit is contained in:
Jim Kingdon 1993-07-21 19:57:36 +00:00
parent 2c5c299f93
commit 72943ad06a
3 changed files with 36 additions and 49 deletions

View File

@ -1,5 +1,7 @@
Wed Jul 21 11:37:30 1993 Jim Kingdon (kingdon@deneb.cygnus.com)
* hppa{b,h}-nat.c: Warning, not error, if can't access registers.
* config/pa/hppa{b,h}.h: Define ATTACH_DETACH.
Wed Jul 21 03:07:30 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)

View File

@ -169,7 +169,6 @@ fetch_register (regno)
{
register unsigned int regaddr;
char buf[MAX_REGISTER_RAW_SIZE];
char mess[128]; /* For messages */
register int i;
/* Offset of registers within the u area. */
@ -186,11 +185,17 @@ fetch_register (regno)
regaddr += sizeof (int);
if (errno != 0)
{
sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno);
perror_with_name (mess);
/* 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, "reading register %s: %s", reg_names[regno], err);
warning (msg);
goto error_exit;
}
}
supply_register (regno, buf);
error_exit:;
}
/* Fetch all registers, or just one, from the child process. */
@ -215,7 +220,6 @@ store_inferior_registers (regno)
int regno;
{
register unsigned int regaddr;
char buf[80];
extern char registers[];
register int i;
@ -231,8 +235,11 @@ store_inferior_registers (regno)
*(int *) &registers[REGISTER_BYTE (regno) + i]);
if (errno != 0)
{
sprintf (buf, "writing register number %d(%d)", regno, i);
perror_with_name (buf);
char *err = safe_strerror (errno);
char *msg = alloca (strlen (err) + 128);
sprintf (msg, "writing register %s: %s", reg_names[regno], err);
warning (msg);
errors_found = 1;
}
regaddr += sizeof(int);
}
@ -243,19 +250,7 @@ store_inferior_registers (regno)
{
if (CANNOT_STORE_REGISTER (regno))
continue;
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 *) &registers[REGISTER_BYTE (regno) + i]);
if (errno != 0)
{
sprintf (buf, "writing register number %d(%d)", regno, i);
perror_with_name (buf);
}
regaddr += sizeof(int);
}
store_inferior_registers (regno);
}
}
return;

View File

@ -121,6 +121,8 @@ store_inferior_registers (regno)
scratch, 0);
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);
}
@ -133,8 +135,14 @@ store_inferior_registers (regno)
*(int *) &registers[REGISTER_BYTE (regno) + i], 0);
if (errno != 0)
{
sprintf (buf, "writing register number %d(%d)", regno, i);
perror_with_name (buf);
/* 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);
goto error_exit;
}
regaddr += sizeof(int);
}
@ -145,34 +153,10 @@ store_inferior_registers (regno)
{
if (CANNOT_STORE_REGISTER (regno))
continue;
regaddr = register_addr (regno, offset);
errno = 0;
if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
{
scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
scratch, 0);
if (errno != 0)
{
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 *) &registers[REGISTER_BYTE (regno) + i], 0);
if (errno != 0)
{
sprintf (buf, "writing register number %d(%d)", regno, i);
perror_with_name (buf);
}
regaddr += sizeof(int);
}
store_inferior_registers (regno);
}
}
error_exit:
return;
}
@ -201,13 +185,19 @@ fetch_register (regno)
regaddr += sizeof (int);
if (errno != 0)
{
sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno);
perror_with_name (mess);
/* 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, "reading register %s: %s", reg_names[regno], err);
warning (msg);
goto error_exit;
}
}
if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
buf[3] &= ~0x3;
supply_register (regno, buf);
error_exit:;
}
/* Resume execution of the inferior process.