diff options
Diffstat (limited to 'gdb/hp9k320-dep.c')
-rw-r--r-- | gdb/hp9k320-dep.c | 134 |
1 files changed, 77 insertions, 57 deletions
diff --git a/gdb/hp9k320-dep.c b/gdb/hp9k320-dep.c index 2774303cf20..09876ca1bbc 100644 --- a/gdb/hp9k320-dep.c +++ b/gdb/hp9k320-dep.c @@ -1,22 +1,21 @@ /* Low level interface to ptrace, for GDB when running under Unix. - Copyright (C) 1986, 1987 Free Software Foundation, Inc. + Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc. + +This file is part of GDB. -GDB is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY. No author or distributor accepts responsibility to anyone -for the consequences of using it or for whether it serves any -particular purpose or works at all, unless he says so in writing. -Refer to the GDB General Public License for full details. +GDB is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 1, or (at your option) +any later version. -Everyone is granted permission to copy, modify and redistribute GDB, -but only under the conditions described in the GDB General Public -License. A copy of this license is supposed to have been given to you -along with GDB so you can know your rights and responsibilities. It -should be in a file named COPYING. Among other things, the copyright -notice and this notice must be preserved on all copies. +GDB is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. -In other words, go ahead and share GDB, but don't try to stop -anyone else from sharing it farther. Help stamp out software hoarding! -*/ +You should have received a copy of the GNU General Public License +along with GDB; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "param.h" @@ -46,8 +45,8 @@ extern int errno; It exists so that all calls to ptrace are isolated in this machine-dependent file. */ int -call_ptrace (request, pid, arg3, arg4) - int request, pid, arg3, arg4; + call_ptrace (request, pid, arg3, arg4) +int request, pid, arg3, arg4; { return ptrace (request, pid, arg3, arg4); } @@ -80,9 +79,9 @@ kill_inferior_fast () If SIGNAL is nonzero, give it that signal. */ void -resume (step, signal) - int step; - int signal; + resume (step, signal) +int step; +int signal; { errno = 0; if (remote_debugging) @@ -101,16 +100,16 @@ resume (step, signal) - KERNEL_U_ADDR) static void -fetch_inferior_register (regno, regaddr) - register int regno; - register unsigned int regaddr; + fetch_inferior_register (regno, regaddr) +register int regno; +register unsigned int regaddr; { #ifndef HPUX_VERSION_5 if (regno == PS_REGNUM) { union { int i; short s[2]; } ps_val; int regval; - + ps_val.i = (ptrace (PT_RUAREA, inferior_pid, regaddr, 0)); regval = ps_val.s[0]; supply_register (regno, ®val); @@ -120,7 +119,7 @@ fetch_inferior_register (regno, regaddr) { char buf[MAX_REGISTER_RAW_SIZE]; register int i; - + for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid, regaddr, 0); @@ -132,10 +131,10 @@ fetch_inferior_register (regno, regaddr) } static void -store_inferior_register_1 (regno, regaddr, value) - int regno; - unsigned int regaddr; - int value; + store_inferior_register_1 (regno, regaddr, value) +int regno; +unsigned int regaddr; +int value; { errno = 0; ptrace (PT_WUAREA, inferior_pid, regaddr, value); @@ -145,7 +144,7 @@ store_inferior_register_1 (regno, regaddr, value) if (errno != 0) { char string_buf[64]; - + sprintf (string_buf, "writing register number %d", regno); perror_with_name (string_buf); } @@ -154,15 +153,15 @@ store_inferior_register_1 (regno, regaddr, value) } static void -store_inferior_register (regno, regaddr) - register int regno; - register unsigned int regaddr; + store_inferior_register (regno, regaddr) +register int regno; +register unsigned int regaddr; { #ifndef HPUX_VERSION_5 if (regno == PS_REGNUM) { union { int i; short s[2]; } ps_val; - + ps_val.i = (ptrace (PT_RUAREA, inferior_pid, regaddr, 0)); ps_val.s[0] = (read_register (regno)); store_inferior_register_1 (regno, regaddr, ps_val.i); @@ -173,7 +172,7 @@ store_inferior_register (regno, regaddr) char buf[MAX_REGISTER_RAW_SIZE]; register int i; extern char registers[]; - + for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) { store_inferior_register_1 @@ -186,17 +185,23 @@ store_inferior_register (regno, regaddr) } void -fetch_inferior_registers () + fetch_inferior_registers () { struct user u; register int regno; register unsigned int ar0_offset; - - ar0_offset = (INFERIOR_AR0 (u)); - for (regno = 0; (regno < FP0_REGNUM); regno++) - fetch_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - for (; (regno < NUM_REGS); regno++) - fetch_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); + extern char registers[]; + + if (remote_debugging) + remote_fetch_registers (registers); + else + { + ar0_offset = (INFERIOR_AR0 (u)); + for (regno = 0; (regno < FP0_REGNUM); regno++) + fetch_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); + for (; (regno < NUM_REGS); regno++) + fetch_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); + } } /* Store our register values back into the inferior. @@ -208,24 +213,30 @@ store_inferior_registers (regno) { struct user u; register unsigned int ar0_offset; + extern char registers[]; - if (regno >= FP0_REGNUM) - { - store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); - return; - } - - ar0_offset = (INFERIOR_AR0 (u)); - if (regno >= 0) + if (remote_debugging) + remote_store_registers (registers); + else { - store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - return; + if (regno >= FP0_REGNUM) + { + store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); + return; + } + + ar0_offset = (INFERIOR_AR0 (u)); + if (regno >= 0) + { + store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); + return; + } + + for (regno = 0; (regno < FP0_REGNUM); regno++) + store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); + for (; (regno < NUM_REGS); regno++) + store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); } - - for (regno = 0; (regno < FP0_REGNUM); regno++) - store_inferior_register (regno, (REGISTER_ADDR (ar0_offset, regno))); - for (; (regno < NUM_REGS); regno++) - store_inferior_register (regno, (FP_REGISTER_ADDR (u, regno))); return; } @@ -336,6 +347,7 @@ write_inferior_memory (memaddr, myaddr, len) /* Work with core dump and executable files, for GDB. This code would be in core.c if it weren't machine-dependent. */ +/* This should probably be deleted. */ /* Recognize COFF format systems because a.out.h defines AOUTHDR. */ #ifdef AOUTHDR #define COFF_FORMAT @@ -363,8 +375,10 @@ write_inferior_memory (memaddr, myaddr, len) #endif #ifndef COFF_FORMAT +#ifndef AOUTHDR #define AOUTHDR struct exec #endif +#endif extern char *sys_siglist[]; @@ -468,6 +482,9 @@ core_file_command (filename, from_tty) if (filename) { + filename = tilde_expand (filename); + make_cleanup (free, filename); + if (have_inferior_p ()) error ("To look at a core file, you must kill the inferior with \"kill\"."); corechan = open (filename, O_RDONLY, 0); @@ -571,6 +588,9 @@ exec_file_command (filename, from_tty) if (filename) { + filename = tilde_expand (filename); + make_cleanup (free, filename); + execchan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0, &execfile); if (execchan < 0) |