1991-09-19 02:40:29 +00:00
|
|
|
|
/* Pyramid target-dependent code for GDB.
|
|
|
|
|
Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc.
|
1991-03-28 16:28:29 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
1991-06-04 07:31:55 +00:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
1991-03-28 16:28:29 +00:00
|
|
|
|
it under the terms of the GNU General Public License as published by
|
1991-06-04 07:31:55 +00:00
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
1991-03-28 16:28:29 +00:00
|
|
|
|
|
1991-06-04 07:31:55 +00:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
1991-03-28 16:28:29 +00:00
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
1991-06-04 07:31:55 +00:00
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
1991-03-28 16:28:29 +00:00
|
|
|
|
|
1991-09-19 02:40:29 +00:00
|
|
|
|
#include "defs.h"
|
|
|
|
|
|
1991-03-28 16:28:29 +00:00
|
|
|
|
/*** Prettier register printing. ***/
|
|
|
|
|
|
|
|
|
|
/* Print registers in the same format as pyramid's dbx, adb, sdb. */
|
|
|
|
|
pyr_print_registers(reg_buf, regnum)
|
|
|
|
|
long *reg_buf[];
|
|
|
|
|
{
|
|
|
|
|
register int regno;
|
|
|
|
|
int usp, ksp;
|
|
|
|
|
struct user u;
|
|
|
|
|
|
|
|
|
|
for (regno = 0; regno < 16; regno++) {
|
1993-11-01 22:25:23 +00:00
|
|
|
|
printf_unfiltered/*_filtered*/ ("%6.6s: %8x %6.6s: %8x %6s: %8x %6s: %8x\n",
|
1991-03-28 16:28:29 +00:00
|
|
|
|
reg_names[regno], reg_buf[regno],
|
|
|
|
|
reg_names[regno+16], reg_buf[regno+16],
|
|
|
|
|
reg_names[regno+32], reg_buf[regno+32],
|
|
|
|
|
reg_names[regno+48], reg_buf[regno+48]);
|
|
|
|
|
}
|
|
|
|
|
usp = ptrace (3, inferior_pid,
|
* Makefile.in (VERSION): Bump to 4.5.6.
* coffread.c (coff_end_symtab): Cast 2nd arg of complain() to
correct type.
* defs.h (NORETURN): Define away for Lucid compiler.
* remote.c (remote_timer, remote_interrupt): Signal handlers
take one int arg.
* ser-termios.c (serial_write, serial_close): Return whatever
value the write/close call returns, rather than falling off end.
* inferior.h (PTRACE_ARG3_TYPE): Third arg to ptrace is int on
more systems than it is "char *". Define PTRACE_ARG3_TYPE to
default to int.
* infptrace.c, hppabsd-xdep.c, hppahpux-xdep.c, i386-xdep.c,
inferior.h (call_ptrace): Use PTRACE_ARG3_TYPE to declare type
of third arg.
* a68v-xdep.c, arm-xdep.c, convex-xdep.c, hp300ux-xdep.c, infrun.c,
m88k-xdep.c, mach386-xdep.c, mips-xdep.c, os68k-xdep.c, pyr-tdep.c,
pyr-xdep.c, rs6000-xdep.c, sparc-xdep.c, sun3-xdep.c, sun386-xdep.c,
symm-xdep.c, ultra3-xdep.c: Use PTRACE_ARG3_TYPE to cast ptrace
argument 3.
* sparc-xdep.c, a68v-xdep.c (fetch_inferior_registers,
store_inferior_registers): Supply missing fourth argument to
ptrace().
1992-06-24 04:49:48 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_usp) -
|
|
|
|
|
((char *)&u), 0);
|
1991-03-28 16:28:29 +00:00
|
|
|
|
ksp = ptrace (3, inferior_pid,
|
* Makefile.in (VERSION): Bump to 4.5.6.
* coffread.c (coff_end_symtab): Cast 2nd arg of complain() to
correct type.
* defs.h (NORETURN): Define away for Lucid compiler.
* remote.c (remote_timer, remote_interrupt): Signal handlers
take one int arg.
* ser-termios.c (serial_write, serial_close): Return whatever
value the write/close call returns, rather than falling off end.
* inferior.h (PTRACE_ARG3_TYPE): Third arg to ptrace is int on
more systems than it is "char *". Define PTRACE_ARG3_TYPE to
default to int.
* infptrace.c, hppabsd-xdep.c, hppahpux-xdep.c, i386-xdep.c,
inferior.h (call_ptrace): Use PTRACE_ARG3_TYPE to declare type
of third arg.
* a68v-xdep.c, arm-xdep.c, convex-xdep.c, hp300ux-xdep.c, infrun.c,
m88k-xdep.c, mach386-xdep.c, mips-xdep.c, os68k-xdep.c, pyr-tdep.c,
pyr-xdep.c, rs6000-xdep.c, sparc-xdep.c, sun3-xdep.c, sun386-xdep.c,
symm-xdep.c, ultra3-xdep.c: Use PTRACE_ARG3_TYPE to cast ptrace
argument 3.
* sparc-xdep.c, a68v-xdep.c (fetch_inferior_registers,
store_inferior_registers): Supply missing fourth argument to
ptrace().
1992-06-24 04:49:48 +00:00
|
|
|
|
(PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_ksp) -
|
|
|
|
|
((char *)&u), 0);
|
1993-11-01 22:25:23 +00:00
|
|
|
|
printf_unfiltered/*_filtered*/ ("\n%6.6s: %8x %6.6s: %8x (%08x) %6.6s %8x\n",
|
1991-03-28 16:28:29 +00:00
|
|
|
|
reg_names[CSP_REGNUM],reg_buf[CSP_REGNUM],
|
|
|
|
|
reg_names[KSP_REGNUM], reg_buf[KSP_REGNUM], ksp,
|
|
|
|
|
"usp", usp);
|
|
|
|
|
}
|
|
|
|
|
|
1991-08-19 20:54:03 +00:00
|
|
|
|
/* Print the register regnum, or all registers if regnum is -1.
|
|
|
|
|
fpregs is currently ignored. */
|
1991-03-28 16:28:29 +00:00
|
|
|
|
|
1991-08-19 20:54:03 +00:00
|
|
|
|
pyr_do_registers_info (regnum, fpregs)
|
1991-03-28 16:28:29 +00:00
|
|
|
|
int regnum;
|
1991-08-19 20:54:03 +00:00
|
|
|
|
int fpregs;
|
1991-03-28 16:28:29 +00:00
|
|
|
|
{
|
|
|
|
|
/* On a pyr, we know a virtual register can always fit in an long.
|
|
|
|
|
Here (and elsewhere) we take advantage of that. Yuk. */
|
|
|
|
|
long raw_regs[MAX_REGISTER_RAW_SIZE*NUM_REGS];
|
|
|
|
|
register int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0 ; i < 64 ; i++) {
|
|
|
|
|
read_relative_register_raw_bytes(i, raw_regs+i);
|
|
|
|
|
}
|
|
|
|
|
if (regnum == -1)
|
|
|
|
|
pyr_print_registers (raw_regs, regnum);
|
|
|
|
|
else
|
|
|
|
|
for (i = 0; i < NUM_REGS; i++)
|
|
|
|
|
if (i == regnum) {
|
|
|
|
|
long val = raw_regs[i];
|
|
|
|
|
|
|
|
|
|
fputs_filtered (reg_names[i], stdout);
|
|
|
|
|
printf_filtered(":");
|
|
|
|
|
print_spaces_filtered (6 - strlen (reg_names[i]), stdout);
|
|
|
|
|
if (val == 0)
|
|
|
|
|
printf_filtered ("0");
|
|
|
|
|
else
|
1991-09-19 02:40:29 +00:00
|
|
|
|
printf_filtered ("%s %d", local_hex_string_custom(val,"08"), val);
|
1991-03-28 16:28:29 +00:00
|
|
|
|
printf_filtered("\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*** Debugging editions of various macros from m-pyr.h ****/
|
|
|
|
|
|
|
|
|
|
CORE_ADDR frame_locals_address (frame)
|
|
|
|
|
FRAME frame;
|
|
|
|
|
{
|
|
|
|
|
register int addr = find_saved_register (frame,CFP_REGNUM);
|
|
|
|
|
register int result = read_memory_integer (addr, 4);
|
|
|
|
|
#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
|
1993-11-01 22:25:23 +00:00
|
|
|
|
fprintf_unfiltered (stderr,
|
1991-03-28 16:28:29 +00:00
|
|
|
|
"\t[[..frame_locals:%8x, %s= %x @%x fcfp= %x foo= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
|
|
|
|
|
frame->frame,
|
|
|
|
|
reg_names[CFP_REGNUM],
|
|
|
|
|
result, addr,
|
|
|
|
|
frame->frame_cfp, (CFP_REGNUM),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
read_register(13), read_register(29), read_register(61),
|
|
|
|
|
find_saved_register(frame, 61));
|
|
|
|
|
#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
|
|
|
|
|
|
|
|
|
|
/* FIXME: I thought read_register (CFP_REGNUM) should be the right answer;
|
|
|
|
|
or at least CFP_REGNUM relative to FRAME (ie, result).
|
|
|
|
|
There seems to be a bug in the way the innermost frame is set up. */
|
|
|
|
|
|
|
|
|
|
return ((frame->next) ? result: frame->frame_cfp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CORE_ADDR frame_args_addr (frame)
|
|
|
|
|
FRAME frame;
|
|
|
|
|
{
|
|
|
|
|
register int addr = find_saved_register (frame,CFP_REGNUM);
|
|
|
|
|
register int result = read_memory_integer (addr, 4);
|
|
|
|
|
|
|
|
|
|
#ifdef PYRAMID_CONTROL_FRAME_DEBUGGING
|
1993-11-01 22:25:23 +00:00
|
|
|
|
fprintf_unfiltered (stderr,
|
1991-03-28 16:28:29 +00:00
|
|
|
|
"\t[[..frame_args:%8x, %s= %x @%x fcfp= %x r_r= %x\n\t gr13=%x pr13=%x tr13=%x @%x]]\n",
|
|
|
|
|
frame->frame,
|
|
|
|
|
reg_names[CFP_REGNUM],
|
|
|
|
|
result, addr,
|
|
|
|
|
frame->frame_cfp, read_register(CFP_REGNUM),
|
|
|
|
|
|
|
|
|
|
read_register(13), read_register(29), read_register(61),
|
|
|
|
|
find_saved_register(frame, 61));
|
|
|
|
|
#endif /* PYRAMID_CONTROL_FRAME_DEBUGGING */
|
|
|
|
|
|
|
|
|
|
/* FIXME: I thought read_register (CFP_REGNUM) should be the right answer;
|
|
|
|
|
or at least CFP_REGNUM relative to FRAME (ie, result).
|
|
|
|
|
There seems to be a bug in the way the innermost frame is set up. */
|
|
|
|
|
return ((frame->next) ? result: frame->frame_cfp);
|
|
|
|
|
}
|