diff options
Diffstat (limited to 'gdb/lynx-nat.c')
-rw-r--r-- | gdb/lynx-nat.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/gdb/lynx-nat.c b/gdb/lynx-nat.c index 37edc2bcb5c..4be7fb8e1ab 100644 --- a/gdb/lynx-nat.c +++ b/gdb/lynx-nat.c @@ -1,6 +1,7 @@ /* Native-dependent code for LynxOS. - Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2003 Free + Software Foundation, Inc. This file is part of GDB. @@ -27,7 +28,7 @@ #include "regcache.h" #include <sys/ptrace.h> -#include <sys/wait.h> +#Include "gdb_wait.h" #include <sys/fpp.h> static unsigned long registers_addr (int pid); @@ -282,7 +283,7 @@ fetch_inferior_registers (int regno) if (whatregs & WHATREGS_GEN) { struct econtext ec; /* general regs */ - char buf[MAX_REGISTER_RAW_SIZE]; + char *buf = alloca (max_register_size (current_gdbarch)); int retval; int i; @@ -510,29 +511,31 @@ fetch_inferior_registers (int regno) ecp = registers_addr (PIDGET (inferior_ptid)); - for (regno = reglo; regno <= reghi; regno++) - { - char buf[MAX_REGISTER_RAW_SIZE]; - int ptrace_fun = PTRACE_PEEKTHREAD; - + { + char *buf = alloca (max_register_size (current_gdbarch)); + for (regno = reglo; regno <= reghi; regno++) + { + int ptrace_fun = PTRACE_PEEKTHREAD; + #ifdef M68K - ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD; + ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD; #endif - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - unsigned int reg; - - errno = 0; - reg = ptrace (ptrace_fun, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), 0); - if (errno) - perror_with_name ("ptrace(PTRACE_PEEKUSP)"); - - *(int *) &buf[i] = reg; - } - supply_register (regno, buf); - } + + for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) + { + unsigned int reg; + + errno = 0; + reg = ptrace (ptrace_fun, PIDGET (inferior_ptid), + (PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), 0); + if (errno) + perror_with_name ("ptrace(PTRACE_PEEKUSP)"); + + *(int *) &buf[i] = reg; + } + supply_register (regno, buf); + } + } } /* Store our register values back into the inferior. |