1995-04-21 21:09:01 +02:00
|
|
|
|
/* Target-dependent code for Hitachi Super-H, for GDB.
|
|
|
|
|
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
1993-04-27 03:17:32 +02:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program 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 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program 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.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
1995-08-02 05:41:12 +02:00
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1993-04-27 03:17:32 +02:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Contributed by Steve Chamberlain
|
|
|
|
|
sac@cygnus.com
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "frame.h"
|
|
|
|
|
#include "obstack.h"
|
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
|
#include "gdbcmd.h"
|
1995-04-21 21:09:01 +02:00
|
|
|
|
#include "gdbcore.h"
|
1993-04-27 03:17:32 +02:00
|
|
|
|
#include "value.h"
|
|
|
|
|
#include "dis-asm.h"
|
1994-11-24 06:59:34 +01:00
|
|
|
|
|
1993-04-27 03:17:32 +02:00
|
|
|
|
/* Prologue looks like
|
|
|
|
|
[mov.l <regs>,@-r15]...
|
|
|
|
|
[sts.l pr,@-r15]
|
|
|
|
|
[mov.l r14,@-r15]
|
|
|
|
|
[mov r15,r14]
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define IS_STS(x) ((x) == 0x4f22)
|
|
|
|
|
#define IS_PUSH(x) (((x) & 0xff0f) == 0x2f06)
|
|
|
|
|
#define GET_PUSHED_REG(x) (((x) >> 4) & 0xf)
|
|
|
|
|
#define IS_MOV_SP_FP(x) ((x) == 0x6ef3)
|
|
|
|
|
#define IS_ADD_SP(x) (((x) & 0xff00) == 0x7f00)
|
1994-09-09 02:35:09 +02:00
|
|
|
|
#define IS_MOV_R3(x) (((x) & 0xff00) == 0x1a00)
|
|
|
|
|
#define IS_SHLL_R3(x) ((x) == 0x4300)
|
|
|
|
|
#define IS_ADD_R3SP(x) ((x) == 0x3f3c)
|
1993-04-27 03:17:32 +02:00
|
|
|
|
|
|
|
|
|
/* Skip any prologue before the guts of a function */
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
sh_skip_prologue (start_pc)
|
|
|
|
|
CORE_ADDR start_pc;
|
|
|
|
|
{
|
|
|
|
|
int w;
|
|
|
|
|
|
|
|
|
|
w = read_memory_integer (start_pc, 2);
|
|
|
|
|
while (IS_STS (w)
|
|
|
|
|
|| IS_PUSH (w)
|
1994-09-09 02:35:09 +02:00
|
|
|
|
|| IS_MOV_SP_FP (w)
|
1994-11-24 06:59:34 +01:00
|
|
|
|
|| IS_MOV_R3 (w)
|
|
|
|
|
|| IS_ADD_R3SP (w)
|
|
|
|
|
|| IS_ADD_SP (w)
|
|
|
|
|
|| IS_SHLL_R3 (w))
|
1993-04-27 03:17:32 +02:00
|
|
|
|
{
|
|
|
|
|
start_pc += 2;
|
|
|
|
|
w = read_memory_integer (start_pc, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return start_pc;
|
|
|
|
|
}
|
|
|
|
|
|
General cleanup and simplication of disassembler interface.
* a29k-pinsn.c, arm-pinsn.c, convex-pinsn.c, gould-pinsn.c,
hppa-pinsn.c, i386-pinsn.c, i960-pinsn.c, m68k-pinsn.c,
m88k-pinsn.c, mips-pinsn.c, ns32k-pinsn.c, pyr-pinsn.c,
rs6000-pinsn.c, sparc-pinsn.c, tahoe-pinsn.c, vax-pinsn.c: Remove.
* gould-tdep.c, ns32k-tdep.c, tahoe-tdep.c, vax-tdep.c: New files,
had been -pinsn.c files.
* Makefile.in (ALLDEPFILES): Remove removed files.
(a29k-pinsn.o, arm-pinsn.o, convex-pinsn.o, gould-pinsn.o,
hppa-pinsn.o, i386-pinsn.o, i960-pinsn.o, m68k-pinsn.o,
m88k-pinsn.o, mips-pinsn.o, ns32k-pinsn.o, pyr-pinsn.o,
rs6000-pinsn.o, sparc-pinsn.o, tahoe-pinsn.o, vax-pinsn.o):
Remove compile actions.
* arm-tdep.o, gould-tdep.o, ns32k-tdep.o, tahoe-tdep.o,
vax-tdep.o: Add compile actions.
* defs.h (tm_print_insn): New global.
* a29k-tdep.c (gdb_print_insn_a29k): New function.
(_initialize_a29k_tdep): Rename from _initialize_29k,
set tm_print_insn.
* alpha-tdep.c (print_insn): Remove.
(_initialize_alpha_tdep): Set tm_print_insn.
* arm-tdep.c (arm_print_insn): New function, was print_insn
in arm-pinsn.c.
* convex-tdep.c (convex_print_insn): New function, was print_insn
in convex-pinsn.c.
* h8300-tdep.c (print_insn): Remove.
(gdb_print_insn_h8300): New function.
(_initialize_h8300_tdep): New function.
* h8500-tdep.c (print_insn): Remove.
(_initialize_h8500_tdep): New function.
* hppa-tdep.c (_initialize_hppa_tdep): Set tm_print_insn.
* i386-tdep.c (_initialize_i386_tdep): New function.
* i960-tdep.c (mem, next_insn): New functions, were in
i960-pinsn.c.
(_initialize_i960_tdep): Set tm_print_insn.
* m68k-tdep.c (_initialize_m68k_tdep): New function.
* m88k-tdep.c (_initialize_m88k_tdep): New function.
* mips-tdep.c (gdb_print_insn_mips): New function.
(_initialize_mips_tdep): Set tm_print_insn.
* pyr-tdep.c (pyr_print_insn): New function, was print_insn
in pyr-pinsn.c.
* rs6000-tdep.c (_initialize_rs6000_tdep): New function.
* sh-tdep.c (print_insn): Remove.
(gdb_print_insn_sh): New function.
(_initialize_sh_tdep): Set tm_print_insn.
* sparc-tdep.c (_initialize_sparc_tdep): New function.
* w65-tdep.c (print_insn): Remove.
(_initialize_w65_tdep): New function.
* z8k-tdep.c (print_insn): Remove.
(gdb_print_insn_z8k): New function.
(_initialize_z8k_tdep): Set tm_print_insn.
* printcmd.c (print_insn): New function, generic disassembler.
* config/*/*.mt (TDEPFILES): Remove refs to *-pinsn.o.
* defs.h (query_hook, error_hook): Fix prototypes.
1995-01-17 05:36:51 +01:00
|
|
|
|
/* Disassemble an instruction. */
|
1993-04-27 03:17:32 +02:00
|
|
|
|
|
|
|
|
|
int
|
General cleanup and simplication of disassembler interface.
* a29k-pinsn.c, arm-pinsn.c, convex-pinsn.c, gould-pinsn.c,
hppa-pinsn.c, i386-pinsn.c, i960-pinsn.c, m68k-pinsn.c,
m88k-pinsn.c, mips-pinsn.c, ns32k-pinsn.c, pyr-pinsn.c,
rs6000-pinsn.c, sparc-pinsn.c, tahoe-pinsn.c, vax-pinsn.c: Remove.
* gould-tdep.c, ns32k-tdep.c, tahoe-tdep.c, vax-tdep.c: New files,
had been -pinsn.c files.
* Makefile.in (ALLDEPFILES): Remove removed files.
(a29k-pinsn.o, arm-pinsn.o, convex-pinsn.o, gould-pinsn.o,
hppa-pinsn.o, i386-pinsn.o, i960-pinsn.o, m68k-pinsn.o,
m88k-pinsn.o, mips-pinsn.o, ns32k-pinsn.o, pyr-pinsn.o,
rs6000-pinsn.o, sparc-pinsn.o, tahoe-pinsn.o, vax-pinsn.o):
Remove compile actions.
* arm-tdep.o, gould-tdep.o, ns32k-tdep.o, tahoe-tdep.o,
vax-tdep.o: Add compile actions.
* defs.h (tm_print_insn): New global.
* a29k-tdep.c (gdb_print_insn_a29k): New function.
(_initialize_a29k_tdep): Rename from _initialize_29k,
set tm_print_insn.
* alpha-tdep.c (print_insn): Remove.
(_initialize_alpha_tdep): Set tm_print_insn.
* arm-tdep.c (arm_print_insn): New function, was print_insn
in arm-pinsn.c.
* convex-tdep.c (convex_print_insn): New function, was print_insn
in convex-pinsn.c.
* h8300-tdep.c (print_insn): Remove.
(gdb_print_insn_h8300): New function.
(_initialize_h8300_tdep): New function.
* h8500-tdep.c (print_insn): Remove.
(_initialize_h8500_tdep): New function.
* hppa-tdep.c (_initialize_hppa_tdep): Set tm_print_insn.
* i386-tdep.c (_initialize_i386_tdep): New function.
* i960-tdep.c (mem, next_insn): New functions, were in
i960-pinsn.c.
(_initialize_i960_tdep): Set tm_print_insn.
* m68k-tdep.c (_initialize_m68k_tdep): New function.
* m88k-tdep.c (_initialize_m88k_tdep): New function.
* mips-tdep.c (gdb_print_insn_mips): New function.
(_initialize_mips_tdep): Set tm_print_insn.
* pyr-tdep.c (pyr_print_insn): New function, was print_insn
in pyr-pinsn.c.
* rs6000-tdep.c (_initialize_rs6000_tdep): New function.
* sh-tdep.c (print_insn): Remove.
(gdb_print_insn_sh): New function.
(_initialize_sh_tdep): Set tm_print_insn.
* sparc-tdep.c (_initialize_sparc_tdep): New function.
* w65-tdep.c (print_insn): Remove.
(_initialize_w65_tdep): New function.
* z8k-tdep.c (print_insn): Remove.
(gdb_print_insn_z8k): New function.
(_initialize_z8k_tdep): Set tm_print_insn.
* printcmd.c (print_insn): New function, generic disassembler.
* config/*/*.mt (TDEPFILES): Remove refs to *-pinsn.o.
* defs.h (query_hook, error_hook): Fix prototypes.
1995-01-17 05:36:51 +01:00
|
|
|
|
gdb_print_insn_sh (memaddr, info)
|
|
|
|
|
bfd_vma memaddr;
|
|
|
|
|
disassemble_info *info;
|
1993-04-27 03:17:32 +02:00
|
|
|
|
{
|
1994-11-24 06:59:34 +01:00
|
|
|
|
if (TARGET_BYTE_ORDER == BIG_ENDIAN)
|
1995-01-19 04:16:42 +01:00
|
|
|
|
return print_insn_sh (memaddr, info);
|
1994-11-24 06:59:34 +01:00
|
|
|
|
else
|
1995-01-19 04:16:42 +01:00
|
|
|
|
return print_insn_shl (memaddr, info);
|
1993-04-27 03:17:32 +02:00
|
|
|
|
}
|
General cleanup and simplication of disassembler interface.
* a29k-pinsn.c, arm-pinsn.c, convex-pinsn.c, gould-pinsn.c,
hppa-pinsn.c, i386-pinsn.c, i960-pinsn.c, m68k-pinsn.c,
m88k-pinsn.c, mips-pinsn.c, ns32k-pinsn.c, pyr-pinsn.c,
rs6000-pinsn.c, sparc-pinsn.c, tahoe-pinsn.c, vax-pinsn.c: Remove.
* gould-tdep.c, ns32k-tdep.c, tahoe-tdep.c, vax-tdep.c: New files,
had been -pinsn.c files.
* Makefile.in (ALLDEPFILES): Remove removed files.
(a29k-pinsn.o, arm-pinsn.o, convex-pinsn.o, gould-pinsn.o,
hppa-pinsn.o, i386-pinsn.o, i960-pinsn.o, m68k-pinsn.o,
m88k-pinsn.o, mips-pinsn.o, ns32k-pinsn.o, pyr-pinsn.o,
rs6000-pinsn.o, sparc-pinsn.o, tahoe-pinsn.o, vax-pinsn.o):
Remove compile actions.
* arm-tdep.o, gould-tdep.o, ns32k-tdep.o, tahoe-tdep.o,
vax-tdep.o: Add compile actions.
* defs.h (tm_print_insn): New global.
* a29k-tdep.c (gdb_print_insn_a29k): New function.
(_initialize_a29k_tdep): Rename from _initialize_29k,
set tm_print_insn.
* alpha-tdep.c (print_insn): Remove.
(_initialize_alpha_tdep): Set tm_print_insn.
* arm-tdep.c (arm_print_insn): New function, was print_insn
in arm-pinsn.c.
* convex-tdep.c (convex_print_insn): New function, was print_insn
in convex-pinsn.c.
* h8300-tdep.c (print_insn): Remove.
(gdb_print_insn_h8300): New function.
(_initialize_h8300_tdep): New function.
* h8500-tdep.c (print_insn): Remove.
(_initialize_h8500_tdep): New function.
* hppa-tdep.c (_initialize_hppa_tdep): Set tm_print_insn.
* i386-tdep.c (_initialize_i386_tdep): New function.
* i960-tdep.c (mem, next_insn): New functions, were in
i960-pinsn.c.
(_initialize_i960_tdep): Set tm_print_insn.
* m68k-tdep.c (_initialize_m68k_tdep): New function.
* m88k-tdep.c (_initialize_m88k_tdep): New function.
* mips-tdep.c (gdb_print_insn_mips): New function.
(_initialize_mips_tdep): Set tm_print_insn.
* pyr-tdep.c (pyr_print_insn): New function, was print_insn
in pyr-pinsn.c.
* rs6000-tdep.c (_initialize_rs6000_tdep): New function.
* sh-tdep.c (print_insn): Remove.
(gdb_print_insn_sh): New function.
(_initialize_sh_tdep): Set tm_print_insn.
* sparc-tdep.c (_initialize_sparc_tdep): New function.
* w65-tdep.c (print_insn): Remove.
(_initialize_w65_tdep): New function.
* z8k-tdep.c (print_insn): Remove.
(gdb_print_insn_z8k): New function.
(_initialize_z8k_tdep): Set tm_print_insn.
* printcmd.c (print_insn): New function, generic disassembler.
* config/*/*.mt (TDEPFILES): Remove refs to *-pinsn.o.
* defs.h (query_hook, error_hook): Fix prototypes.
1995-01-17 05:36:51 +01:00
|
|
|
|
|
1993-04-27 03:17:32 +02:00
|
|
|
|
/* Given a GDB frame, determine the address of the calling function's frame.
|
|
|
|
|
This will be used to create a new GDB frame struct, and then
|
|
|
|
|
INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
|
|
|
|
|
|
|
|
|
|
For us, the frame address is its stack pointer value, so we look up
|
|
|
|
|
the function prologue to determine the caller's sp value, and return it. */
|
|
|
|
|
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 02:19:29 +01:00
|
|
|
|
CORE_ADDR
|
|
|
|
|
sh_frame_chain (frame)
|
|
|
|
|
struct frame_info *frame;
|
1993-04-27 03:17:32 +02:00
|
|
|
|
{
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 02:19:29 +01:00
|
|
|
|
if (!inside_entry_file (frame->pc))
|
|
|
|
|
return read_memory_integer (FRAME_FP (frame) + frame->f_offset, 4);
|
1993-04-27 03:17:32 +02:00
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
1995-04-21 21:09:01 +02:00
|
|
|
|
/* Put here the code to store, into a struct frame_saved_regs, the
|
|
|
|
|
addresses of the saved registers of frame described by FRAME_INFO.
|
1993-04-27 03:17:32 +02:00
|
|
|
|
This includes special registers such as pc and fp saved in special
|
1995-04-21 21:09:01 +02:00
|
|
|
|
ways in the stack frame. sp is even more special: the address we
|
|
|
|
|
return for it IS the sp for the next frame. */
|
1993-04-27 03:17:32 +02:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
frame_find_saved_regs (fi, fsr)
|
|
|
|
|
struct frame_info *fi;
|
|
|
|
|
struct frame_saved_regs *fsr;
|
|
|
|
|
{
|
1993-06-18 00:16:07 +02:00
|
|
|
|
int where[NUM_REGS];
|
1993-04-27 03:17:32 +02:00
|
|
|
|
int rn;
|
|
|
|
|
int have_fp = 0;
|
|
|
|
|
int depth;
|
|
|
|
|
int pc;
|
|
|
|
|
int opc;
|
|
|
|
|
int insn;
|
1994-09-09 02:35:09 +02:00
|
|
|
|
int r3_val = 0;
|
1993-04-27 03:17:32 +02:00
|
|
|
|
|
|
|
|
|
opc = pc = get_pc_function_start (fi->pc);
|
|
|
|
|
|
|
|
|
|
insn = read_memory_integer (pc, 2);
|
|
|
|
|
|
1994-09-09 02:35:09 +02:00
|
|
|
|
fi->leaf_function = 1;
|
|
|
|
|
fi->f_offset = 0;
|
|
|
|
|
|
1993-04-27 03:17:32 +02:00
|
|
|
|
for (rn = 0; rn < NUM_REGS; rn++)
|
|
|
|
|
where[rn] = -1;
|
|
|
|
|
|
|
|
|
|
depth = 0;
|
|
|
|
|
|
|
|
|
|
/* Loop around examining the prologue insns, but give up
|
|
|
|
|
after 15 of them, since we're getting silly then */
|
|
|
|
|
while (pc < opc + 15 * 2)
|
|
|
|
|
{
|
|
|
|
|
/* See where the registers will be saved to */
|
|
|
|
|
if (IS_PUSH (insn))
|
|
|
|
|
{
|
|
|
|
|
pc += 2;
|
|
|
|
|
rn = GET_PUSHED_REG (insn);
|
|
|
|
|
where[rn] = depth;
|
|
|
|
|
insn = read_memory_integer (pc, 2);
|
|
|
|
|
depth += 4;
|
|
|
|
|
}
|
|
|
|
|
else if (IS_STS (insn))
|
|
|
|
|
{
|
|
|
|
|
pc += 2;
|
|
|
|
|
where[PR_REGNUM] = depth;
|
|
|
|
|
insn = read_memory_integer (pc, 2);
|
1994-09-09 02:35:09 +02:00
|
|
|
|
/* If we're storing the pr then this isn't a leaf */
|
|
|
|
|
fi->leaf_function = 0;
|
1993-04-27 03:17:32 +02:00
|
|
|
|
depth += 4;
|
|
|
|
|
}
|
1994-09-09 02:35:09 +02:00
|
|
|
|
else if (IS_MOV_R3 (insn))
|
|
|
|
|
{
|
1994-11-24 06:59:34 +01:00
|
|
|
|
r3_val = (char) (insn & 0xff);
|
|
|
|
|
pc += 2;
|
1994-09-09 02:35:09 +02:00
|
|
|
|
insn = read_memory_integer (pc, 2);
|
|
|
|
|
}
|
|
|
|
|
else if (IS_SHLL_R3 (insn))
|
|
|
|
|
{
|
1994-11-24 06:59:34 +01:00
|
|
|
|
r3_val <<= 1;
|
|
|
|
|
pc += 2;
|
1994-09-09 02:35:09 +02:00
|
|
|
|
insn = read_memory_integer (pc, 2);
|
|
|
|
|
}
|
|
|
|
|
else if (IS_ADD_R3SP (insn))
|
|
|
|
|
{
|
|
|
|
|
depth += -r3_val;
|
1994-11-24 06:59:34 +01:00
|
|
|
|
pc += 2;
|
1994-09-09 02:35:09 +02:00
|
|
|
|
insn = read_memory_integer (pc, 2);
|
|
|
|
|
}
|
1993-04-27 03:17:32 +02:00
|
|
|
|
else if (IS_ADD_SP (insn))
|
|
|
|
|
{
|
|
|
|
|
pc += 2;
|
|
|
|
|
depth += -((char) (insn & 0xff));
|
|
|
|
|
insn = read_memory_integer (pc, 2);
|
|
|
|
|
}
|
1993-06-09 02:47:13 +02:00
|
|
|
|
else
|
|
|
|
|
break;
|
1993-04-27 03:17:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now we know how deep things are, we can work out their addresses */
|
|
|
|
|
|
|
|
|
|
for (rn = 0; rn < NUM_REGS; rn++)
|
|
|
|
|
{
|
|
|
|
|
if (where[rn] >= 0)
|
|
|
|
|
{
|
|
|
|
|
if (rn == FP_REGNUM)
|
|
|
|
|
have_fp = 1;
|
|
|
|
|
|
|
|
|
|
fsr->regs[rn] = fi->frame - where[rn] + depth - 4;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fsr->regs[rn] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (have_fp)
|
|
|
|
|
{
|
|
|
|
|
fsr->regs[SP_REGNUM] = read_memory_integer (fsr->regs[FP_REGNUM], 4);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fsr->regs[SP_REGNUM] = fi->frame - 4;
|
|
|
|
|
}
|
|
|
|
|
|
1994-09-09 02:35:09 +02:00
|
|
|
|
fi->f_offset = depth - where[FP_REGNUM] - 4;
|
1993-04-27 03:17:32 +02:00
|
|
|
|
/* Work out the return pc - either from the saved pr or the pr
|
|
|
|
|
value */
|
1994-11-24 06:59:34 +01:00
|
|
|
|
|
1995-11-15 00:24:10 +01:00
|
|
|
|
if (fsr->regs[PR_REGNUM])
|
|
|
|
|
fi->return_pc = read_memory_integer (fsr->regs[PR_REGNUM], 4);
|
|
|
|
|
else
|
|
|
|
|
fi->return_pc = read_register (PR_REGNUM);
|
1993-04-27 03:17:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* initialize the extra info saved in a FRAME */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
init_extra_frame_info (fromleaf, fi)
|
|
|
|
|
int fromleaf;
|
|
|
|
|
struct frame_info *fi;
|
|
|
|
|
{
|
|
|
|
|
struct frame_saved_regs dummy;
|
1995-04-21 21:09:01 +02:00
|
|
|
|
|
1995-11-15 00:24:10 +01:00
|
|
|
|
if (fi->next)
|
|
|
|
|
fi->pc = fi->next->return_pc;
|
|
|
|
|
|
1993-04-27 03:17:32 +02:00
|
|
|
|
frame_find_saved_regs (fi, &dummy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Discard from the stack the innermost frame,
|
|
|
|
|
restoring all saved registers. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
pop_frame ()
|
|
|
|
|
{
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 02:19:29 +01:00
|
|
|
|
register struct frame_info *frame = get_current_frame ();
|
1993-04-27 03:17:32 +02:00
|
|
|
|
register CORE_ADDR fp;
|
|
|
|
|
register int regnum;
|
|
|
|
|
struct frame_saved_regs fsr;
|
|
|
|
|
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 02:19:29 +01:00
|
|
|
|
fp = FRAME_FP (frame);
|
|
|
|
|
get_frame_saved_regs (frame, &fsr);
|
1993-04-27 03:17:32 +02:00
|
|
|
|
|
|
|
|
|
/* Copy regs from where they were saved in the frame */
|
|
|
|
|
for (regnum = 0; regnum < NUM_REGS; regnum++)
|
|
|
|
|
{
|
|
|
|
|
if (fsr.regs[regnum])
|
|
|
|
|
{
|
|
|
|
|
write_register (regnum, read_memory_integer (fsr.regs[regnum], 4));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1994-11-24 06:59:34 +01:00
|
|
|
|
write_register (PC_REGNUM, frame->return_pc);
|
1993-04-27 03:17:32 +02:00
|
|
|
|
write_register (SP_REGNUM, fp + 4);
|
|
|
|
|
flush_cached_frames ();
|
|
|
|
|
}
|
1994-02-05 01:22:08 +01:00
|
|
|
|
|
|
|
|
|
/* Print the registers in a form similar to the E7000 */
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 02:19:29 +01:00
|
|
|
|
|
1994-02-05 01:22:08 +01:00
|
|
|
|
static void
|
|
|
|
|
show_regs (args, from_tty)
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 02:19:29 +01:00
|
|
|
|
char *args;
|
|
|
|
|
int from_tty;
|
1994-02-05 01:22:08 +01:00
|
|
|
|
{
|
1994-11-24 06:59:34 +01:00
|
|
|
|
printf_filtered ("PC=%08x SR=%08x PR=%08x MACH=%08x MACHL=%08x\n",
|
|
|
|
|
read_register (PC_REGNUM),
|
|
|
|
|
read_register (SR_REGNUM),
|
|
|
|
|
read_register (PR_REGNUM),
|
|
|
|
|
read_register (MACH_REGNUM),
|
|
|
|
|
read_register (MACL_REGNUM));
|
|
|
|
|
|
|
|
|
|
printf_filtered ("R0-R7 %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
|
|
|
read_register (0),
|
|
|
|
|
read_register (1),
|
|
|
|
|
read_register (2),
|
|
|
|
|
read_register (3),
|
|
|
|
|
read_register (4),
|
|
|
|
|
read_register (5),
|
|
|
|
|
read_register (6),
|
|
|
|
|
read_register (7));
|
|
|
|
|
printf_filtered ("R8-R15 %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
|
|
|
|
read_register (8),
|
|
|
|
|
read_register (9),
|
|
|
|
|
read_register (10),
|
|
|
|
|
read_register (11),
|
|
|
|
|
read_register (12),
|
|
|
|
|
read_register (13),
|
|
|
|
|
read_register (14),
|
|
|
|
|
read_register (15));
|
1994-02-05 01:22:08 +01:00
|
|
|
|
}
|
1993-10-22 01:53:32 +01:00
|
|
|
|
|
* Makefile.in (init.c): Generate using the source, not munch. This
cleans up all kinds of hassles (which nm to use in munch, etc). The
new formatting conventions (mostly already followed) are that
the name of the _initialize_* routines must start in column zero,
and must not be inside #if.
* munch: Removed.
* Makefile.in: Remove references to munch.
* serial.c, remote.c, infptrace.c, maint.c, convex-tdep.c,
alpha-tdep.c, hp300ux-nat.c, hppab-nat.c, osfsolib.c, remote-es.c,
procfs.c, remote-udi.c, ser-go32.c, ultra3-xdep.c, sh-tdep.c,
i960-tdep.c, hppa-tdep.c, h8500-tdep.c, dpx2-nat.c, delta68-nat.c,
z8k-tdep.c: Make sure the above conventions are followed. Make
sure they are all declared as returning void. Clean up
miscellaneous comments and such.
1993-10-22 06:55:58 +01:00
|
|
|
|
void
|
1993-06-09 02:47:13 +02:00
|
|
|
|
_initialize_sh_tdep ()
|
|
|
|
|
{
|
General cleanup and simplication of disassembler interface.
* a29k-pinsn.c, arm-pinsn.c, convex-pinsn.c, gould-pinsn.c,
hppa-pinsn.c, i386-pinsn.c, i960-pinsn.c, m68k-pinsn.c,
m88k-pinsn.c, mips-pinsn.c, ns32k-pinsn.c, pyr-pinsn.c,
rs6000-pinsn.c, sparc-pinsn.c, tahoe-pinsn.c, vax-pinsn.c: Remove.
* gould-tdep.c, ns32k-tdep.c, tahoe-tdep.c, vax-tdep.c: New files,
had been -pinsn.c files.
* Makefile.in (ALLDEPFILES): Remove removed files.
(a29k-pinsn.o, arm-pinsn.o, convex-pinsn.o, gould-pinsn.o,
hppa-pinsn.o, i386-pinsn.o, i960-pinsn.o, m68k-pinsn.o,
m88k-pinsn.o, mips-pinsn.o, ns32k-pinsn.o, pyr-pinsn.o,
rs6000-pinsn.o, sparc-pinsn.o, tahoe-pinsn.o, vax-pinsn.o):
Remove compile actions.
* arm-tdep.o, gould-tdep.o, ns32k-tdep.o, tahoe-tdep.o,
vax-tdep.o: Add compile actions.
* defs.h (tm_print_insn): New global.
* a29k-tdep.c (gdb_print_insn_a29k): New function.
(_initialize_a29k_tdep): Rename from _initialize_29k,
set tm_print_insn.
* alpha-tdep.c (print_insn): Remove.
(_initialize_alpha_tdep): Set tm_print_insn.
* arm-tdep.c (arm_print_insn): New function, was print_insn
in arm-pinsn.c.
* convex-tdep.c (convex_print_insn): New function, was print_insn
in convex-pinsn.c.
* h8300-tdep.c (print_insn): Remove.
(gdb_print_insn_h8300): New function.
(_initialize_h8300_tdep): New function.
* h8500-tdep.c (print_insn): Remove.
(_initialize_h8500_tdep): New function.
* hppa-tdep.c (_initialize_hppa_tdep): Set tm_print_insn.
* i386-tdep.c (_initialize_i386_tdep): New function.
* i960-tdep.c (mem, next_insn): New functions, were in
i960-pinsn.c.
(_initialize_i960_tdep): Set tm_print_insn.
* m68k-tdep.c (_initialize_m68k_tdep): New function.
* m88k-tdep.c (_initialize_m88k_tdep): New function.
* mips-tdep.c (gdb_print_insn_mips): New function.
(_initialize_mips_tdep): Set tm_print_insn.
* pyr-tdep.c (pyr_print_insn): New function, was print_insn
in pyr-pinsn.c.
* rs6000-tdep.c (_initialize_rs6000_tdep): New function.
* sh-tdep.c (print_insn): Remove.
(gdb_print_insn_sh): New function.
(_initialize_sh_tdep): Set tm_print_insn.
* sparc-tdep.c (_initialize_sparc_tdep): New function.
* w65-tdep.c (print_insn): Remove.
(_initialize_w65_tdep): New function.
* z8k-tdep.c (print_insn): Remove.
(gdb_print_insn_z8k): New function.
(_initialize_z8k_tdep): Set tm_print_insn.
* printcmd.c (print_insn): New function, generic disassembler.
* config/*/*.mt (TDEPFILES): Remove refs to *-pinsn.o.
* defs.h (query_hook, error_hook): Fix prototypes.
1995-01-17 05:36:51 +01:00
|
|
|
|
tm_print_insn = gdb_print_insn_sh;
|
|
|
|
|
|
1994-11-24 06:59:34 +01:00
|
|
|
|
add_com ("regs", class_vars, show_regs, "Print all registers");
|
1993-06-09 02:47:13 +02:00
|
|
|
|
}
|