1999-04-16 01:35:26 +00:00
|
|
|
/* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger.
|
2002-04-12 18:18:59 +00:00
|
|
|
|
2004-01-17 18:45:25 +00:00
|
|
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
|
|
|
|
Software Foundation, Inc.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
This file is part of GDB.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
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.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
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.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "frame.h"
|
|
|
|
#include "inferior.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "value.h"
|
|
|
|
#include "bfd.h"
|
|
|
|
#include "gdb_string.h"
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include "symfile.h"
|
2001-03-01 01:39:22 +00:00
|
|
|
#include "regcache.h"
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
#include "arch-utils.h"
|
2003-06-07 18:08:25 +00:00
|
|
|
#include "gdb_assert.h"
|
2003-09-04 Andrew Cagney <cagney@redhat.com>
* avr-tdep.c: Include "dis-asm.h".
* cris-tdep.c: Include "dis-asm.h".
(cris_delayed_get_disassembler): Use "struct disassemble_info"
instead of corresponding typedef.
* h8300-tdep.c: Include "dis-asm.h".
* ia64-tdep.c: Include "dis-asm.h".
* i386-tdep.c: Include "dis-asm.h".
(i386_print_insn): Use "struct disassemble_info" instead of
corresponding typedef.
* m68k-tdep.c: Include "dis-asm.h".
* mcore-tdep.c: Include "dis-asm.h".
* mips-tdep.c: Include "dis-asm.h".
(gdb_print_insn_mips): Make static, use "struct disassemble_info"
instead of corresponding typedef.
* ns32k-tdep.c: Include "dis-asm.h".
* s390-tdep.c: Include "dis-asm.h".
* sparc-tdep.c: Include "dis-asm.h".
* vax-tdep.c: Include "dis-asm.h".
* v850-tdep.c: Include "dis-asm.h".
* mn10300-tdep.c: Include "dis-asm.h".
* rs6000-tdep.c: Include "dis-asm.h".
* xstormy16-tdep.c: Include "dis-asm.h".
(_initialize_xstormy16_tdep): Delete "extern" declaration of
print_insn_xstormy16.
* Makefile.in (v850-tdep.o): Update dependencies.
(vax-tdep.o, sparc-tdep.o, s390-tdep.o): Ditto.
(ns32k-tdep.o, mips-tdep.o, mcore-tdep.o): Ditto.
(m68k-tdep.o, ia64-tdep.o, i386-tdep.o): Ditto.
(h8300-tdep.o, cris-tdep.o, avr-tdep.o): Ditto.
(mn10300-tdep.o, xstormy16-tdep.o, disasm.o): Ditto.
(gdbarch_h): Remove $(dis_asm_h).
* disasm.c: Include "dis-asm.h".
(dis_asm_read_memory): Use "struct disassemble_info" instead of
corresponding typedef.
(dis_asm_memory_error, dump_insns, do_assembly_only): Ditto.
(gdb_disassemble_info, gdb_disassembly, gdb_print_insn): Ditto.
* gdbarch.sh: Do not include "dis-asm.h".
(struct disassemble_info): Declare opaque.
(TARGET_PRINT_INSN): Update declaration.
* gdbarch.h, gdbarch.c: Re-generate.
2003-09-09 04:41:32 +00:00
|
|
|
#include "dis-asm.h"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-08-12 03:39:11 +00:00
|
|
|
#define D0_REGNUM 0
|
|
|
|
#define D2_REGNUM 2
|
|
|
|
#define D3_REGNUM 3
|
|
|
|
#define A0_REGNUM 4
|
|
|
|
#define A2_REGNUM 6
|
|
|
|
#define A3_REGNUM 7
|
|
|
|
#define MDR_REGNUM 10
|
|
|
|
#define PSW_REGNUM 11
|
|
|
|
#define LIR_REGNUM 12
|
|
|
|
#define LAR_REGNUM 13
|
|
|
|
#define MDRQ_REGNUM 14
|
|
|
|
#define E0_REGNUM 15
|
|
|
|
#define MCRH_REGNUM 26
|
|
|
|
#define MCRL_REGNUM 27
|
|
|
|
#define MCVF_REGNUM 28
|
|
|
|
|
|
|
|
enum movm_register_bits {
|
|
|
|
movm_exother_bit = 0x01,
|
|
|
|
movm_exreg1_bit = 0x02,
|
|
|
|
movm_exreg0_bit = 0x04,
|
|
|
|
movm_other_bit = 0x08,
|
|
|
|
movm_a3_bit = 0x10,
|
|
|
|
movm_a2_bit = 0x20,
|
|
|
|
movm_d3_bit = 0x40,
|
|
|
|
movm_d2_bit = 0x80
|
|
|
|
};
|
|
|
|
|
1999-09-22 03:28:34 +00:00
|
|
|
extern void _initialize_mn10300_tdep (void);
|
2000-05-28 01:12:42 +00:00
|
|
|
static CORE_ADDR mn10300_analyze_prologue (struct frame_info *fi,
|
|
|
|
CORE_ADDR pc);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
/* mn10300 private data */
|
|
|
|
struct gdbarch_tdep
|
|
|
|
{
|
|
|
|
int am33_mode;
|
|
|
|
#define AM33_MODE (gdbarch_tdep (current_gdbarch)->am33_mode)
|
|
|
|
};
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
/* Additional info used by the frame */
|
|
|
|
|
|
|
|
struct frame_extra_info
|
1999-07-07 20:19:36 +00:00
|
|
|
{
|
|
|
|
int status;
|
|
|
|
int stack_size;
|
|
|
|
};
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-06-14 18:08:47 +00:00
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
static char *
|
|
|
|
register_name (int reg, char **regs, long sizeof_regs)
|
1999-12-07 03:56:43 +00:00
|
|
|
{
|
2000-08-11 07:54:49 +00:00
|
|
|
if (reg < 0 || reg >= sizeof_regs / sizeof (regs[0]))
|
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return regs[reg];
|
|
|
|
}
|
|
|
|
|
2002-06-17 23:32:36 +00:00
|
|
|
static const char *
|
2000-08-11 07:54:49 +00:00
|
|
|
mn10300_generic_register_name (int reg)
|
1999-06-14 18:08:47 +00:00
|
|
|
{
|
2000-08-11 07:54:49 +00:00
|
|
|
static char *regs[] =
|
|
|
|
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
|
|
|
|
"sp", "pc", "mdr", "psw", "lir", "lar", "", "",
|
|
|
|
"", "", "", "", "", "", "", "",
|
|
|
|
"", "", "", "", "", "", "", "fp"
|
|
|
|
};
|
|
|
|
return register_name (reg, regs, sizeof regs);
|
1999-06-14 18:08:47 +00:00
|
|
|
}
|
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
|
2002-06-17 23:32:36 +00:00
|
|
|
static const char *
|
2000-08-11 07:54:49 +00:00
|
|
|
am33_register_name (int reg)
|
|
|
|
{
|
|
|
|
static char *regs[] =
|
|
|
|
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
|
|
|
|
"sp", "pc", "mdr", "psw", "lir", "lar", "",
|
|
|
|
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
|
|
"ssp", "msp", "usp", "mcrh", "mcrl", "mcvf", "", "", ""
|
|
|
|
};
|
|
|
|
return register_name (reg, regs, sizeof regs);
|
|
|
|
}
|
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_saved_pc_after_call (struct frame_info *fi)
|
1999-06-14 18:08:47 +00:00
|
|
|
{
|
|
|
|
return read_memory_integer (read_register (SP_REGNUM), 4);
|
|
|
|
}
|
|
|
|
|
2001-05-09 05:03:01 +00:00
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_extract_return_value (struct type *type, char *regbuf, char *valbuf)
|
1999-06-14 18:08:47 +00:00
|
|
|
{
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 14:24:31 +00:00
|
|
|
memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (4), TYPE_LENGTH (type));
|
1999-06-14 18:08:47 +00:00
|
|
|
else
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 14:24:31 +00:00
|
|
|
memcpy (valbuf, regbuf + DEPRECATED_REGISTER_BYTE (0), TYPE_LENGTH (type));
|
1999-06-14 18:08:47 +00:00
|
|
|
}
|
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_store_return_value (struct type *type, char *valbuf)
|
1999-06-14 18:08:47 +00:00
|
|
|
{
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 14:24:31 +00:00
|
|
|
deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (4), valbuf,
|
2002-11-13 Andrew Cagney <cagney@redhat.com>
* regcache.h (deprecated_read_register_bytes): Rename
read_register_bytes.
(deprecated_write_register_bytes): Rename write_register_bytes.
* alpha-tdep.c, arm-tdep.c, cris-tdep.c, d10v-tdep.c: Update.
* dwarf2cfi.c, frv-tdep.c, hppa-tdep.c, ia64-tdep.c: Update.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, regcache.c, remote-sds.c, remote-vx.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh-tdep.c: Update.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c, x86-64-tdep.c: Update.
* xstormy16-tdep.c, z8k-tdep.c, config/nm-gnu.h: Update.
* config/nm-m3.h, config/h8500/tm-h8500.h: Update.
* config/i386/nm-ptx4.h, config/i386/nm-symmetry.h: Update.
* config/m32r/tm-m32r.h, config/m68k/nm-sun3.h: Update.
* config/m68k/tm-delta68.h, config/m68k/tm-linux.h: Update.
* config/mn10200/tm-mn10200.h, config/pa/tm-hppa64.h: Update.
* config/sparc/nm-nbsd.h, config/sparc/nm-sun4os4.h: Update.
* config/sparc/nm-sun4sol2.h, config/sparc/tm-sparclet.h: Update.
2002-11-13 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Use
deprecated_write_register_bytes instead of write_register_bytes.
2002-11-14 00:25:05 +00:00
|
|
|
TYPE_LENGTH (type));
|
1999-06-14 18:08:47 +00:00
|
|
|
else
|
2003-09-17 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_BYTE): Rename REGISTER_BYTE.
* gdbarch.h, gdbarch.c: Regenerate.
* arm-linux-tdep.c, core-sol2.c, cris-tdep.c: Update.
* d10v-tdep.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, irix5-nat.c, lynx-nat.c, m68knbsd-nat.c: Update.
* mcore-tdep.c, mips-linux-tdep.c, mips-tdep.c: Update.
* mipsv4-nat.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* ns32knbsd-nat.c, ppc-bdm.c, regcache.c, remote-sds.c: Update.
* remote-vx68.c, remote-vxmips.c, remote-vxsparc.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh64-tdep.c: Update.
* sparc-nat.c, sparc-tdep.c, sun3-nat.c, v850-tdep.c: Update.
* v850ice.c, vax-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-cisco.h, config/m68k/tm-delta68.h: Update.
* config/pa/nm-hppah.h: Update.
2003-09-17 Andrew Cagney <cagney@redhat.com>
* mi/mi-main.c: Rename REGISTER_BYTE to DEPRECATED_REGISTER_BYTE.
2003-09-17 14:24:31 +00:00
|
|
|
deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (0), valbuf,
|
2002-11-13 Andrew Cagney <cagney@redhat.com>
* regcache.h (deprecated_read_register_bytes): Rename
read_register_bytes.
(deprecated_write_register_bytes): Rename write_register_bytes.
* alpha-tdep.c, arm-tdep.c, cris-tdep.c, d10v-tdep.c: Update.
* dwarf2cfi.c, frv-tdep.c, hppa-tdep.c, ia64-tdep.c: Update.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, regcache.c, remote-sds.c, remote-vx.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh-tdep.c: Update.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c, x86-64-tdep.c: Update.
* xstormy16-tdep.c, z8k-tdep.c, config/nm-gnu.h: Update.
* config/nm-m3.h, config/h8500/tm-h8500.h: Update.
* config/i386/nm-ptx4.h, config/i386/nm-symmetry.h: Update.
* config/m32r/tm-m32r.h, config/m68k/nm-sun3.h: Update.
* config/m68k/tm-delta68.h, config/m68k/tm-linux.h: Update.
* config/mn10200/tm-mn10200.h, config/pa/tm-hppa64.h: Update.
* config/sparc/nm-nbsd.h, config/sparc/nm-sun4os4.h: Update.
* config/sparc/nm-sun4sol2.h, config/sparc/tm-sparclet.h: Update.
2002-11-13 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Use
deprecated_write_register_bytes instead of write_register_bytes.
2002-11-14 00:25:05 +00:00
|
|
|
TYPE_LENGTH (type));
|
1999-06-14 18:08:47 +00:00
|
|
|
}
|
|
|
|
|
2000-05-28 01:12:42 +00:00
|
|
|
static struct frame_info *analyze_dummy_frame (CORE_ADDR, CORE_ADDR);
|
1999-04-16 01:35:26 +00:00
|
|
|
static struct frame_info *
|
2000-07-30 01:48:28 +00:00
|
|
|
analyze_dummy_frame (CORE_ADDR pc, CORE_ADDR frame)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-11-23 02:48:40 +00:00
|
|
|
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
|
|
|
|
struct frame_info *dummy
|
|
|
|
= deprecated_frame_xmalloc_with_cleanup (SIZEOF_FRAME_SAVED_REGS,
|
|
|
|
sizeof (struct frame_extra_info));
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 22:20:47 +00:00
|
|
|
deprecated_update_frame_pc_hack (dummy, pc);
|
2003-01-07 16:22:29 +00:00
|
|
|
deprecated_update_frame_base_hack (dummy, frame);
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
get_frame_extra_info (dummy)->status = 0;
|
|
|
|
get_frame_extra_info (dummy)->stack_size = 0;
|
2003-07-30 20:44:46 +00:00
|
|
|
mn10300_analyze_prologue (dummy, pc);
|
2003-11-23 02:48:40 +00:00
|
|
|
do_cleanups (old_chain);
|
1999-04-16 01:35:26 +00:00
|
|
|
return dummy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Values for frame_info.status */
|
|
|
|
|
|
|
|
#define MY_FRAME_IN_SP 0x1
|
|
|
|
#define MY_FRAME_IN_FP 0x2
|
|
|
|
#define NO_MORE_FRAMES 0x4
|
|
|
|
|
|
|
|
|
|
|
|
/* Should call_function allocate stack space for a struct return? */
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static int
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_use_struct_convention (int gcc_p, struct type *type)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
return (TYPE_NFIELDS (type) > 1 || TYPE_LENGTH (type) > 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The breakpoint instruction must be the same size as the smallest
|
|
|
|
instruction in the instruction set.
|
|
|
|
|
|
|
|
The Matsushita mn10x00 processors have single byte instructions
|
|
|
|
so we need a single byte breakpoint. Matsushita hasn't defined
|
|
|
|
one, so we defined it ourselves. */
|
|
|
|
|
2002-04-18 18:09:09 +00:00
|
|
|
const static unsigned char *
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_breakpoint_from_pc (CORE_ADDR *bp_addr, int *bp_size)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
static char breakpoint[] =
|
|
|
|
{0xff};
|
1999-04-16 01:35:26 +00:00
|
|
|
*bp_size = 1;
|
|
|
|
return breakpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Fix fi->frame if it's bogus at this point. This is a helper
|
|
|
|
function for mn10300_analyze_prologue. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
fix_frame_pointer (struct frame_info *fi, int stack_size)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
if (fi && get_next_frame (fi) == NULL)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
if (get_frame_extra_info (fi)->status & MY_FRAME_IN_SP)
|
2003-01-07 16:22:29 +00:00
|
|
|
deprecated_update_frame_base_hack (fi, read_sp () - stack_size);
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
else if (get_frame_extra_info (fi)->status & MY_FRAME_IN_FP)
|
2003-01-07 16:22:29 +00:00
|
|
|
deprecated_update_frame_base_hack (fi, read_register (A3_REGNUM));
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Set offsets of registers saved by movm instruction.
|
|
|
|
This is a helper function for mn10300_analyze_prologue. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
set_movm_offsets (struct frame_info *fi, int movm_args)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
if (fi == NULL || movm_args == 0)
|
|
|
|
return;
|
|
|
|
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
if (movm_args & movm_other_bit)
|
|
|
|
{
|
|
|
|
/* The `other' bit leaves a blank area of four bytes at the
|
|
|
|
beginning of its block of saved registers, making it 32 bytes
|
|
|
|
long in total. */
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
deprecated_get_frame_saved_regs (fi)[LAR_REGNUM] = get_frame_base (fi) + offset + 4;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[LIR_REGNUM] = get_frame_base (fi) + offset + 8;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[MDR_REGNUM] = get_frame_base (fi) + offset + 12;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[A0_REGNUM + 1] = get_frame_base (fi) + offset + 16;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[A0_REGNUM] = get_frame_base (fi) + offset + 20;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[D0_REGNUM + 1] = get_frame_base (fi) + offset + 24;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[D0_REGNUM] = get_frame_base (fi) + offset + 28;
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
offset += 32;
|
|
|
|
}
|
|
|
|
if (movm_args & movm_a3_bit)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
deprecated_get_frame_saved_regs (fi)[A3_REGNUM] = get_frame_base (fi) + offset;
|
1999-04-16 01:35:26 +00:00
|
|
|
offset += 4;
|
|
|
|
}
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
if (movm_args & movm_a2_bit)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
deprecated_get_frame_saved_regs (fi)[A2_REGNUM] = get_frame_base (fi) + offset;
|
1999-04-16 01:35:26 +00:00
|
|
|
offset += 4;
|
|
|
|
}
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
if (movm_args & movm_d3_bit)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
deprecated_get_frame_saved_regs (fi)[D3_REGNUM] = get_frame_base (fi) + offset;
|
1999-04-16 01:35:26 +00:00
|
|
|
offset += 4;
|
|
|
|
}
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
if (movm_args & movm_d2_bit)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
deprecated_get_frame_saved_regs (fi)[D2_REGNUM] = get_frame_base (fi) + offset;
|
1999-04-16 01:35:26 +00:00
|
|
|
offset += 4;
|
|
|
|
}
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
if (AM33_MODE)
|
1999-12-07 03:56:43 +00:00
|
|
|
{
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
if (movm_args & movm_exother_bit)
|
|
|
|
{
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
deprecated_get_frame_saved_regs (fi)[MCVF_REGNUM] = get_frame_base (fi) + offset;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[MCRL_REGNUM] = get_frame_base (fi) + offset + 4;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[MCRH_REGNUM] = get_frame_base (fi) + offset + 8;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[MDRQ_REGNUM] = get_frame_base (fi) + offset + 12;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 1] = get_frame_base (fi) + offset + 16;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 0] = get_frame_base (fi) + offset + 20;
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
offset += 24;
|
|
|
|
}
|
|
|
|
if (movm_args & movm_exreg1_bit)
|
|
|
|
{
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 7] = get_frame_base (fi) + offset;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 6] = get_frame_base (fi) + offset + 4;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 5] = get_frame_base (fi) + offset + 8;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 4] = get_frame_base (fi) + offset + 12;
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
offset += 16;
|
|
|
|
}
|
|
|
|
if (movm_args & movm_exreg0_bit)
|
|
|
|
{
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 3] = get_frame_base (fi) + offset;
|
|
|
|
deprecated_get_frame_saved_regs (fi)[E0_REGNUM + 2] = get_frame_base (fi) + offset + 4;
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
offset += 8;
|
|
|
|
}
|
1999-12-07 03:56:43 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* The main purpose of this file is dealing with prologues to extract
|
|
|
|
information about stack frames and saved registers.
|
|
|
|
|
2001-10-10 21:22:44 +00:00
|
|
|
In gcc/config/mn13000/mn10300.c, the expand_prologue prologue
|
|
|
|
function is pretty readable, and has a nice explanation of how the
|
|
|
|
prologue is generated. The prologues generated by that code will
|
2001-11-25 23:43:43 +00:00
|
|
|
have the following form (NOTE: the current code doesn't handle all
|
|
|
|
this!):
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-10-10 21:22:44 +00:00
|
|
|
+ If this is an old-style varargs function, then its arguments
|
|
|
|
need to be flushed back to the stack:
|
|
|
|
|
|
|
|
mov d0,(4,sp)
|
|
|
|
mov d1,(4,sp)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-10-10 21:22:44 +00:00
|
|
|
+ If we use any of the callee-saved registers, save them now.
|
|
|
|
|
|
|
|
movm [some callee-saved registers],(sp)
|
|
|
|
|
|
|
|
+ If we have any floating-point registers to save:
|
|
|
|
|
|
|
|
- Decrement the stack pointer to reserve space for the registers.
|
|
|
|
If the function doesn't need a frame pointer, we may combine
|
|
|
|
this with the adjustment that reserves space for the frame.
|
|
|
|
|
|
|
|
add -SIZE, sp
|
|
|
|
|
|
|
|
- Save the floating-point registers. We have two possible
|
|
|
|
strategies:
|
|
|
|
|
|
|
|
. Save them at fixed offset from the SP:
|
|
|
|
|
|
|
|
fmov fsN,(OFFSETN,sp)
|
|
|
|
fmov fsM,(OFFSETM,sp)
|
|
|
|
...
|
|
|
|
|
2001-11-25 23:43:43 +00:00
|
|
|
Note that, if OFFSETN happens to be zero, you'll get the
|
|
|
|
different opcode: fmov fsN,(sp)
|
|
|
|
|
2001-10-10 21:22:44 +00:00
|
|
|
. Or, set a0 to the start of the save area, and then use
|
|
|
|
post-increment addressing to save the FP registers.
|
|
|
|
|
|
|
|
mov sp, a0
|
|
|
|
add SIZE, a0
|
|
|
|
fmov fsN,(a0+)
|
|
|
|
fmov fsM,(a0+)
|
|
|
|
...
|
|
|
|
|
|
|
|
+ If the function needs a frame pointer, we set it here.
|
|
|
|
|
|
|
|
mov sp, a3
|
|
|
|
|
|
|
|
+ Now we reserve space for the stack frame proper. This could be
|
|
|
|
merged into the `add -SIZE, sp' instruction for FP saves up
|
|
|
|
above, unless we needed to set the frame pointer in the previous
|
|
|
|
step, or the frame is so large that allocating the whole thing at
|
|
|
|
once would put the FP register save slots out of reach of the
|
|
|
|
addressing mode (128 bytes).
|
|
|
|
|
|
|
|
add -SIZE, sp
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
One day we might keep the stack pointer constant, that won't
|
|
|
|
change the code for prologues, but it will make the frame
|
|
|
|
pointerless case much more common. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
/* Analyze the prologue to determine where registers are saved,
|
|
|
|
the end of the prologue, etc etc. Return the end of the prologue
|
|
|
|
scanned.
|
|
|
|
|
|
|
|
We store into FI (if non-null) several tidbits of information:
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
* stack_size -- size of this stack frame. Note that if we stop in
|
|
|
|
certain parts of the prologue/epilogue we may claim the size of the
|
|
|
|
current frame is zero. This happens when the current frame has
|
|
|
|
not been allocated yet or has already been deallocated.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
* fsr -- Addresses of registers saved in the stack by this frame.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
* status -- A (relatively) generic status indicator. It's a bitmask
|
|
|
|
with the following bits:
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
MY_FRAME_IN_SP: The base of the current frame is actually in
|
|
|
|
the stack pointer. This can happen for frame pointerless
|
|
|
|
functions, or cases where we're stopped in the prologue/epilogue
|
|
|
|
itself. For these cases mn10300_analyze_prologue will need up
|
|
|
|
update fi->frame before returning or analyzing the register
|
|
|
|
save instructions.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
MY_FRAME_IN_FP: The base of the current frame is in the
|
2001-10-10 21:22:44 +00:00
|
|
|
frame pointer register ($a3).
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
NO_MORE_FRAMES: Set this if the current frame is "start" or
|
|
|
|
if the first instruction looks like mov <imm>,sp. This tells
|
|
|
|
frame chain to not bother trying to unwind past this frame. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
static CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_analyze_prologue (struct frame_info *fi, CORE_ADDR pc)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
CORE_ADDR func_addr, func_end, addr, stop;
|
|
|
|
CORE_ADDR stack_size;
|
|
|
|
int imm_size;
|
|
|
|
unsigned char buf[4];
|
|
|
|
int status, movm_args = 0;
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
/* Use the PC in the frame if it's provided to look up the
|
2003-07-30 20:44:46 +00:00
|
|
|
start of this function.
|
|
|
|
|
|
|
|
Note: kevinb/2003-07-16: We used to do the following here:
|
|
|
|
pc = (fi ? get_frame_pc (fi) : pc);
|
|
|
|
But this is (now) badly broken when called from analyze_dummy_frame().
|
|
|
|
*/
|
|
|
|
pc = (pc ? pc : get_frame_pc (fi));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Find the start of this function. */
|
|
|
|
status = find_pc_partial_function (pc, &name, &func_addr, &func_end);
|
|
|
|
|
|
|
|
/* Do nothing if we couldn't find the start of this function or if we're
|
|
|
|
stopped at the first instruction in the prologue. */
|
|
|
|
if (status == 0)
|
1999-07-05 17:58:44 +00:00
|
|
|
{
|
|
|
|
return pc;
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* If we're in start, then give up. */
|
|
|
|
if (strcmp (name, "start") == 0)
|
|
|
|
{
|
|
|
|
if (fi != NULL)
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
get_frame_extra_info (fi)->status = NO_MORE_FRAMES;
|
1999-04-16 01:35:26 +00:00
|
|
|
return pc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* At the start of a function our frame is in the stack pointer. */
|
|
|
|
if (fi)
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
get_frame_extra_info (fi)->status = MY_FRAME_IN_SP;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Get the next two bytes into buf, we need two because rets is a two
|
|
|
|
byte insn and the first isn't enough to uniquely identify it. */
|
|
|
|
status = read_memory_nobpt (pc, buf, 2);
|
|
|
|
if (status != 0)
|
|
|
|
return pc;
|
|
|
|
|
2003-07-30 20:44:46 +00:00
|
|
|
#if 0
|
|
|
|
/* Note: kevinb/2003-07-16: We shouldn't be making these sorts of
|
|
|
|
changes to the frame in prologue examination code. */
|
1999-04-16 01:35:26 +00:00
|
|
|
/* If we're physically on an "rets" instruction, then our frame has
|
|
|
|
already been deallocated. Note this can also be true for retf
|
|
|
|
and ret if they specify a size of zero.
|
|
|
|
|
|
|
|
In this case fi->frame is bogus, we need to fix it. */
|
|
|
|
if (fi && buf[0] == 0xf0 && buf[1] == 0xfc)
|
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
if (get_next_frame (fi) == NULL)
|
2003-01-07 16:22:29 +00:00
|
|
|
deprecated_update_frame_base_hack (fi, read_sp ());
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 22:20:47 +00:00
|
|
|
return get_frame_pc (fi);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Similarly if we're stopped on the first insn of a prologue as our
|
|
|
|
frame hasn't been allocated yet. */
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 22:20:47 +00:00
|
|
|
if (fi && get_frame_pc (fi) == func_addr)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
if (get_next_frame (fi) == NULL)
|
2003-01-07 16:22:29 +00:00
|
|
|
deprecated_update_frame_base_hack (fi, read_sp ());
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 22:20:47 +00:00
|
|
|
return get_frame_pc (fi);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
2003-07-30 20:44:46 +00:00
|
|
|
#endif
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Figure out where to stop scanning. */
|
2003-07-30 20:44:46 +00:00
|
|
|
stop = fi ? pc : func_end;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Don't walk off the end of the function. */
|
|
|
|
stop = stop > func_end ? func_end : stop;
|
|
|
|
|
|
|
|
/* Start scanning on the first instruction of this function. */
|
|
|
|
addr = func_addr;
|
|
|
|
|
|
|
|
/* Suck in two bytes. */
|
|
|
|
status = read_memory_nobpt (addr, buf, 2);
|
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
fix_frame_pointer (fi, 0);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
2001-10-10 21:22:44 +00:00
|
|
|
/* First see if this insn sets the stack pointer from a register; if
|
|
|
|
so, it's probably the initialization of the stack pointer in _start,
|
|
|
|
so mark this as the bottom-most frame. */
|
1999-04-16 01:35:26 +00:00
|
|
|
if (buf[0] == 0xf2 && (buf[1] & 0xf3) == 0xf0)
|
|
|
|
{
|
|
|
|
if (fi)
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
get_frame_extra_info (fi)->status = NO_MORE_FRAMES;
|
1999-04-16 01:35:26 +00:00
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now look for movm [regs],sp, which saves the callee saved registers.
|
|
|
|
|
|
|
|
At this time we don't know if fi->frame is valid, so we only note
|
|
|
|
that we encountered a movm instruction. Later, we'll set the entries
|
|
|
|
in fsr.regs as needed. */
|
|
|
|
if (buf[0] == 0xcf)
|
|
|
|
{
|
|
|
|
/* Extract the register list for the movm instruction. */
|
|
|
|
status = read_memory_nobpt (addr + 1, buf, 1);
|
|
|
|
movm_args = *buf;
|
|
|
|
|
|
|
|
addr += 2;
|
|
|
|
|
|
|
|
/* Quit now if we're beyond the stop point. */
|
|
|
|
if (addr >= stop)
|
|
|
|
{
|
|
|
|
/* Fix fi->frame since it's bogus at this point. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
if (fi && get_next_frame (fi) == NULL)
|
2003-01-07 16:22:29 +00:00
|
|
|
deprecated_update_frame_base_hack (fi, read_sp ());
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Note if/where callee saved registers were saved. */
|
|
|
|
set_movm_offsets (fi, movm_args);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the next two bytes so the prologue scan can continue. */
|
|
|
|
status = read_memory_nobpt (addr, buf, 2);
|
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
/* Fix fi->frame since it's bogus at this point. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
if (fi && get_next_frame (fi) == NULL)
|
2003-01-07 16:22:29 +00:00
|
|
|
deprecated_update_frame_base_hack (fi, read_sp ());
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Note if/where callee saved registers were saved. */
|
|
|
|
set_movm_offsets (fi, movm_args);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now see if we set up a frame pointer via "mov sp,a3" */
|
|
|
|
if (buf[0] == 0x3f)
|
|
|
|
{
|
|
|
|
addr += 1;
|
|
|
|
|
|
|
|
/* The frame pointer is now valid. */
|
|
|
|
if (fi)
|
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
get_frame_extra_info (fi)->status |= MY_FRAME_IN_FP;
|
|
|
|
get_frame_extra_info (fi)->status &= ~MY_FRAME_IN_SP;
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Quit now if we're beyond the stop point. */
|
|
|
|
if (addr >= stop)
|
|
|
|
{
|
|
|
|
/* Fix fi->frame if it's bogus at this point. */
|
|
|
|
fix_frame_pointer (fi, 0);
|
|
|
|
|
|
|
|
/* Note if/where callee saved registers were saved. */
|
|
|
|
set_movm_offsets (fi, movm_args);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get two more bytes so scanning can continue. */
|
|
|
|
status = read_memory_nobpt (addr, buf, 2);
|
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
/* Fix fi->frame if it's bogus at this point. */
|
|
|
|
fix_frame_pointer (fi, 0);
|
|
|
|
|
|
|
|
/* Note if/where callee saved registers were saved. */
|
|
|
|
set_movm_offsets (fi, movm_args);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
}
|
1999-07-07 20:19:36 +00:00
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
/* Next we should allocate the local frame. No more prologue insns
|
|
|
|
are found after allocating the local frame.
|
1999-07-07 20:19:36 +00:00
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
Search for add imm8,sp (0xf8feXX)
|
1999-07-07 20:19:36 +00:00
|
|
|
or add imm16,sp (0xfafeXXXX)
|
|
|
|
or add imm32,sp (0xfcfeXXXXXXXX).
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
If none of the above was found, then this prologue has no
|
|
|
|
additional stack. */
|
|
|
|
|
|
|
|
status = read_memory_nobpt (addr, buf, 2);
|
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
/* Fix fi->frame if it's bogus at this point. */
|
|
|
|
fix_frame_pointer (fi, 0);
|
|
|
|
|
|
|
|
/* Note if/where callee saved registers were saved. */
|
|
|
|
set_movm_offsets (fi, movm_args);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
imm_size = 0;
|
|
|
|
if (buf[0] == 0xf8 && buf[1] == 0xfe)
|
|
|
|
imm_size = 1;
|
|
|
|
else if (buf[0] == 0xfa && buf[1] == 0xfe)
|
|
|
|
imm_size = 2;
|
|
|
|
else if (buf[0] == 0xfc && buf[1] == 0xfe)
|
|
|
|
imm_size = 4;
|
|
|
|
|
|
|
|
if (imm_size != 0)
|
|
|
|
{
|
|
|
|
/* Suck in imm_size more bytes, they'll hold the size of the
|
|
|
|
current frame. */
|
|
|
|
status = read_memory_nobpt (addr + 2, buf, imm_size);
|
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
/* Fix fi->frame if it's bogus at this point. */
|
|
|
|
fix_frame_pointer (fi, 0);
|
|
|
|
|
|
|
|
/* Note if/where callee saved registers were saved. */
|
|
|
|
set_movm_offsets (fi, movm_args);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Note the size of the stack in the frame info structure. */
|
|
|
|
stack_size = extract_signed_integer (buf, imm_size);
|
|
|
|
if (fi)
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
get_frame_extra_info (fi)->stack_size = stack_size;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* We just consumed 2 + imm_size bytes. */
|
|
|
|
addr += 2 + imm_size;
|
|
|
|
|
|
|
|
/* No more prologue insns follow, so begin preparation to return. */
|
|
|
|
/* Fix fi->frame if it's bogus at this point. */
|
|
|
|
fix_frame_pointer (fi, stack_size);
|
|
|
|
|
|
|
|
/* Note if/where callee saved registers were saved. */
|
|
|
|
set_movm_offsets (fi, movm_args);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We never found an insn which allocates local stack space, regardless
|
|
|
|
this is the end of the prologue. */
|
|
|
|
/* Fix fi->frame if it's bogus at this point. */
|
|
|
|
fix_frame_pointer (fi, 0);
|
|
|
|
|
|
|
|
/* Note if/where callee saved registers were saved. */
|
|
|
|
set_movm_offsets (fi, movm_args);
|
|
|
|
return addr;
|
|
|
|
}
|
1999-07-07 20:19:36 +00:00
|
|
|
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
|
|
|
|
/* Function: saved_regs_size
|
|
|
|
Return the size in bytes of the register save area, based on the
|
|
|
|
saved_regs array in FI. */
|
|
|
|
static int
|
|
|
|
saved_regs_size (struct frame_info *fi)
|
|
|
|
{
|
|
|
|
int adjust = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Reserve four bytes for every register saved. */
|
|
|
|
for (i = 0; i < NUM_REGS; i++)
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
if (deprecated_get_frame_saved_regs (fi)[i])
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
adjust += 4;
|
|
|
|
|
|
|
|
/* If we saved LIR, then it's most likely we used a `movm'
|
|
|
|
instruction with the `other' bit set, in which case the SP is
|
|
|
|
decremented by an extra four bytes, "to simplify calculation
|
|
|
|
of the transfer area", according to the processor manual. */
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
if (deprecated_get_frame_saved_regs (fi)[LIR_REGNUM])
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
adjust += 4;
|
|
|
|
|
|
|
|
return adjust;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
/* Function: frame_chain
|
|
|
|
Figure out and return the caller's frame pointer given current
|
|
|
|
frame_info struct.
|
|
|
|
|
|
|
|
We don't handle dummy frames yet but we would probably just return the
|
|
|
|
stack pointer that was in use at the time the function call was made? */
|
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_frame_chain (struct frame_info *fi)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
struct frame_info *dummy;
|
|
|
|
/* Walk through the prologue to determine the stack size,
|
|
|
|
location of saved registers, end of the prologue, etc. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
if (get_frame_extra_info (fi)->status == 0)
|
1999-07-07 20:19:36 +00:00
|
|
|
mn10300_analyze_prologue (fi, (CORE_ADDR) 0);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Quit now if mn10300_analyze_prologue set NO_MORE_FRAMES. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
if (get_frame_extra_info (fi)->status & NO_MORE_FRAMES)
|
1999-04-16 01:35:26 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Now that we've analyzed our prologue, determine the frame
|
|
|
|
pointer for our caller.
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
If our caller has a frame pointer, then we need to
|
|
|
|
find the entry value of $a3 to our function.
|
|
|
|
|
|
|
|
If fsr.regs[A3_REGNUM] is nonzero, then it's at the memory
|
|
|
|
location pointed to by fsr.regs[A3_REGNUM].
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
Else it's still in $a3.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
If our caller does not have a frame pointer, then his
|
|
|
|
frame base is fi->frame + -caller's stack size. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* The easiest way to get that info is to analyze our caller's frame.
|
|
|
|
So we set up a dummy frame and call mn10300_analyze_prologue to
|
|
|
|
find stuff for us. */
|
2003-03-12 16:50:47 +00:00
|
|
|
dummy = analyze_dummy_frame (DEPRECATED_FRAME_SAVED_PC (fi), get_frame_base (fi));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
if (get_frame_extra_info (dummy)->status & MY_FRAME_IN_FP)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
/* Our caller has a frame pointer. So find the frame in $a3 or
|
|
|
|
in the stack. */
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
if (deprecated_get_frame_saved_regs (fi)[A3_REGNUM])
|
|
|
|
return (read_memory_integer (deprecated_get_frame_saved_regs (fi)[A3_REGNUM],
|
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_SIZE): Rename REGISTER_SIZE.
(DEPRECATED_SIZEOF_CALL_DUMMY_WORDS): Rename
SIZEOF_CALL_DUMMY_WORDS.
(DEPRECATED_CALL_DUMMY_WORDS): Rename CALL_DUMMY_WORDS.
(DEPRECATED_FIX_CALL_DUMMY): Rename FIX_CALL_DUMMY.
(DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET): Rename
CALL_DUMMY_BREAKPOINT_OFFSET.
(DEPRECATED_CALL_DUMMY_START_OFFSET): Rename
CALL_DUMMY_START_OFFSET.
(DEPRECATED_CALL_DUMMY_LENGTH): Rename CALL_DUMMY_LENGTH.
* gdbarch.h, gdbarch.c: Re-generate.
* alpha-tdep.c, alphafbsd-tdep.c, arm-linux-tdep.c: Update.
* arm-tdep.c, avr-tdep.c, breakpoint.c, cris-tdep.c: Update.
* dummy-frame.c, dummy-frame.h, frv-tdep.c, gdbarch.c: Update.
* gdbarch.h, gdbarch.sh, h8300-tdep.c, hppa-tdep.c: Update.
* i386-tdep.c, ia64-tdep.c, infcall.c, inferior.h: Update.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Update.
* mips-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* rs6000-tdep.c, s390-tdep.c, sh-tdep.c, sol-thread.c: Update.
* sparc-tdep.c, target.c, v850-tdep.c, valops.c: Update.
* vax-tdep.c, x86-64-tdep.c, xstormy16-tdep.c: Update.
* config/ia64/tm-ia64.h, config/m68k/tm-vx68.h: Update.
* config/mips/tm-mips.h, config/pa/nm-hppah.h: Update.
* config/pa/tm-hppa.h, config/pa/tm-hppa64.h: Update.
* config/s390/tm-s390.h, config/sparc/tm-sp64.h: Update.
* config/sparc/tm-sparc.h: Update.
Index: doc/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Make
CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_LENGTH,
FIX_CALL_DUMMY, CALL_DUMMY_BREAKPOINT_OFFSET and
CALL_DUMMY_BREAKPOINT_OFFSET deprecated.
Index: mi/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Replace
REGISTER_SIZE with DEPRECATED_REGISTER_SIZE.
Index: testsuite/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdb.base/watchpoint.exp: Rename CALL_DUMMY_BREAKPOINT_OFFSET to
DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET in comments.
2003-05-05 17:56:57 +00:00
|
|
|
DEPRECATED_REGISTER_SIZE));
|
1999-04-16 01:35:26 +00:00
|
|
|
else
|
|
|
|
return read_register (A3_REGNUM);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
int adjust = saved_regs_size (fi);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Our caller does not have a frame pointer. So his frame starts
|
1999-07-07 20:19:36 +00:00
|
|
|
at the base of our frame (fi->frame) + register save space
|
|
|
|
+ <his size>. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
return get_frame_base (fi) + adjust + -get_frame_extra_info (dummy)->stack_size;
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: skip_prologue
|
|
|
|
Return the address of the first inst past the prologue of the function. */
|
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_skip_prologue (CORE_ADDR pc)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
/* We used to check the debug symbols, but that can lose if
|
|
|
|
we have a null prologue. */
|
|
|
|
return mn10300_analyze_prologue (NULL, pc);
|
|
|
|
}
|
|
|
|
|
2001-05-09 02:22:35 +00:00
|
|
|
/* generic_pop_current_frame calls this function if the current
|
|
|
|
frame isn't a dummy frame. */
|
|
|
|
static void
|
|
|
|
mn10300_pop_frame_regular (struct frame_info *frame)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int regnum;
|
|
|
|
|
2003-03-12 16:50:47 +00:00
|
|
|
write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-05-09 02:22:35 +00:00
|
|
|
/* Restore any saved registers. */
|
|
|
|
for (regnum = 0; regnum < NUM_REGS; regnum++)
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
if (deprecated_get_frame_saved_regs (frame)[regnum] != 0)
|
2001-05-09 02:22:35 +00:00
|
|
|
{
|
|
|
|
ULONGEST value;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2003-09-25 Andrew Cagney <cagney@redhat.com>
* frame.h (deprecated_frame_saved_regs): Rename
get_frame_saved_regs.
* cris-tdep.c, frame.c, h8300-tdep.c, hppa-tdep.c: Update.
* mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, ppc-linux-tdep.c, rs6000-tdep.c: Update.
* s390-tdep.c, sh64-tdep.c, stack.c: Update.
* v850-tdep.c, vax-tdep.c, xstormy16-tdep.c: Update.
2003-09-25 20:44:02 +00:00
|
|
|
value = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (frame)[regnum],
|
2003-10-02 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_RAW_SIZE): Rename
REGISTER_RAW_SIZE.
* gdbarch.h, gdbarch.c: Re-generate.
* aix-thread.c, alpha-tdep.h, arm-tdep.c, core-sol2.c: Update.
* cris-tdep.c, dve3900-rom.c, findvar.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, ia64-tdep.c, infcmd.c, infptrace.c: Update.
* infrun.c, irix5-nat.c, lynx-nat.c, mips-linux-tdep.c: Update.
* mips-nat.c, mips-tdep.c, mipsv4-nat.c, mn10300-tdep.c: Update.
* monitor.c, ns32k-tdep.c, ppc-linux-nat.c, regcache.c: Update.
* remote-e7000.c, remote-mips.c, remote-sim.c: Update.
* remote-vxmips.c, remote-vxsparc.c, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, rs6000-tdep.c, s390-tdep.c: Update.
* sh64-tdep.c, sparc-nat.c, sparc-tdep.c, stack.c: Update.
* target.c, tracepoint.c, v850-tdep.c, v850ice.c, valops.c: Update.
* vax-tdep.c, vax-tdep.h, x86-64-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-delta68.h, config/m68k/tm-vx68.h: Update.
* config/sparc/tm-sparc.h, config/sparc/tm-sparclynx.h: Update.
2003-10-02 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Rename
REGISTER_RAW_SIZE to DEPRECATED_REGISTER_RAW_SIZE.
* gdb.texinfo (Packets, Stop Reply Packets): Ditto.
* gdbint.texinfo (Target Architecture Definition): Rename
2003-10-02 Andrew Cagney <cagney@redhat.com>
* mi-main.c: Rename REGISTER_RAW_SIZE to
DEPRECATED_REGISTER_RAW_SIZE.
2003-10-02 20:28:31 +00:00
|
|
|
DEPRECATED_REGISTER_RAW_SIZE (regnum));
|
2001-05-09 02:22:35 +00:00
|
|
|
write_register (regnum, value);
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-05-09 02:22:35 +00:00
|
|
|
/* Actually cut back the stack. */
|
2002-11-19 Andrew Cagney <ac131313@redhat.com>
* frame.h (FRAME_FP): Delete macro.
(get_frame_base): New function declaration.
* frame.c (get_frame_base): New function.
(get_frame_id): Use ->frame.
(frame_find_by_id): Rewrite to use get_frame_id.
* blockframe.c: Use get_frame_base instead of FRAME_FP.
* cris-tdep.c, d10v-tdep.c, findvar.c, h8500-tdep.c: Ditto.
* hppa-tdep.c, i386-tdep.c, infcmd.c, infrun.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, rs6000-tdep.c: Ditto.
* sh-tdep.c, sparc-tdep.c, stack.c, tracepoint.c: Ditto.
* v850-tdep.c, valops.c, z8k-tdep.c: Ditto.
2002-11-24 19:48:13 +00:00
|
|
|
write_register (SP_REGNUM, get_frame_base (frame));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-05-09 02:22:35 +00:00
|
|
|
/* Don't we need to set the PC?!? XXX FIXME. */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: pop_frame
|
|
|
|
This routine gets called when either the user uses the `return'
|
|
|
|
command, or the call dummy breakpoint gets hit. */
|
|
|
|
static void
|
|
|
|
mn10300_pop_frame (void)
|
|
|
|
{
|
|
|
|
/* This function checks for and handles generic dummy frames, and
|
|
|
|
calls back to our function for ordinary frames. */
|
|
|
|
generic_pop_current_frame (mn10300_pop_frame_regular);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/* Throw away any cached frame information. */
|
|
|
|
flush_cached_frames ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: push_arguments
|
|
|
|
Setup arguments for a call to the target. Arguments go in
|
|
|
|
order on the stack. */
|
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static CORE_ADDR
|
2000-08-11 07:54:49 +00:00
|
|
|
mn10300_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|
|
|
int struct_return, CORE_ADDR struct_addr)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int argnum = 0;
|
|
|
|
int len = 0;
|
|
|
|
int stack_offset = 0;
|
|
|
|
int regsused = struct_return ? 1 : 0;
|
|
|
|
|
|
|
|
/* This should be a nop, but align the stack just in case something
|
|
|
|
went wrong. Stacks are four byte aligned on the mn10300. */
|
|
|
|
sp &= ~3;
|
|
|
|
|
|
|
|
/* Now make space on the stack for the args.
|
|
|
|
|
|
|
|
XXX This doesn't appear to handle pass-by-invisible reference
|
|
|
|
arguments. */
|
|
|
|
for (argnum = 0; argnum < nargs; argnum++)
|
|
|
|
{
|
|
|
|
int arg_length = (TYPE_LENGTH (VALUE_TYPE (args[argnum])) + 3) & ~3;
|
|
|
|
|
|
|
|
while (regsused < 2 && arg_length > 0)
|
|
|
|
{
|
|
|
|
regsused++;
|
|
|
|
arg_length -= 4;
|
|
|
|
}
|
|
|
|
len += arg_length;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate stack space. */
|
|
|
|
sp -= len;
|
|
|
|
|
|
|
|
regsused = struct_return ? 1 : 0;
|
|
|
|
/* Push all arguments onto the stack. */
|
|
|
|
for (argnum = 0; argnum < nargs; argnum++)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
char *val;
|
|
|
|
|
|
|
|
/* XXX Check this. What about UNIONS? */
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (*args)) == TYPE_CODE_STRUCT
|
|
|
|
&& TYPE_LENGTH (VALUE_TYPE (*args)) > 8)
|
|
|
|
{
|
|
|
|
/* XXX Wrong, we want a pointer to this argument. */
|
1999-07-07 20:19:36 +00:00
|
|
|
len = TYPE_LENGTH (VALUE_TYPE (*args));
|
|
|
|
val = (char *) VALUE_CONTENTS (*args);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
len = TYPE_LENGTH (VALUE_TYPE (*args));
|
1999-07-07 20:19:36 +00:00
|
|
|
val = (char *) VALUE_CONTENTS (*args);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while (regsused < 2 && len > 0)
|
|
|
|
{
|
|
|
|
write_register (regsused, extract_unsigned_integer (val, 4));
|
|
|
|
val += 4;
|
|
|
|
len -= 4;
|
|
|
|
regsused++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (len > 0)
|
|
|
|
{
|
|
|
|
write_memory (sp + stack_offset, val, 4);
|
|
|
|
len -= 4;
|
|
|
|
val += 4;
|
|
|
|
stack_offset += 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
args++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make space for the flushback area. */
|
|
|
|
sp -= 8;
|
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: push_return_address (pc)
|
|
|
|
Set up the return address for the inferior function call.
|
|
|
|
Needed for targets where we don't actually execute a JSR/BSR instruction */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
unsigned char buf[4];
|
|
|
|
|
2003-09-09 03:58:18 +00:00
|
|
|
store_unsigned_integer (buf, 4, entry_point_address ());
|
1999-04-16 01:35:26 +00:00
|
|
|
write_memory (sp - 4, buf, 4);
|
|
|
|
return sp - 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: store_struct_return (addr,sp)
|
|
|
|
Store the structure value return address for an inferior function
|
|
|
|
call. */
|
1999-07-07 20:19:36 +00:00
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static void
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
/* The structure return address is passed as the first argument. */
|
|
|
|
write_register (0, addr);
|
|
|
|
}
|
1999-07-07 20:19:36 +00:00
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
/* Function: frame_saved_pc
|
|
|
|
Find the caller of this frame. We do this by seeing if RP_REGNUM
|
|
|
|
is saved in the stack anywhere, otherwise we get it from the
|
|
|
|
registers. If the inner frame is a dummy frame, return its PC
|
|
|
|
instead of RP, because that's where "caller" of the dummy-frame
|
|
|
|
will be found. */
|
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
mn10300_frame_saved_pc (struct frame_info *fi)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
Correct and expand handling of `movm' instruction, and register
saves in general.
* config/mn10300/tm-mn10300.h (D0_REGNUM, A0_REGNUM, MDRQ_REGNUM,
MCRH_REGNUM, MCRL_REGNUM, MCVF_REGNUM): New definitions.
(enum movm_register_bits): New enum.
* mn10300-tdep.c (set_movm_offsets): Use symbolic names for the
bits, not hex literals. Handle the `other', `exreg0', and
`exother' bits. Correct handling of `exreg1': it saves r4, r5,
r6, and r7, not r2, r3, r4, and r5.
(saved_regs_size): New function.
(mn10300_frame_chain, mn10300_frame_saved_pc): Use it, instead
of computing the same thing inline, incorrectly.
2001-05-09 02:44:01 +00:00
|
|
|
int adjust = saved_regs_size (fi);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_SIZE): Rename REGISTER_SIZE.
(DEPRECATED_SIZEOF_CALL_DUMMY_WORDS): Rename
SIZEOF_CALL_DUMMY_WORDS.
(DEPRECATED_CALL_DUMMY_WORDS): Rename CALL_DUMMY_WORDS.
(DEPRECATED_FIX_CALL_DUMMY): Rename FIX_CALL_DUMMY.
(DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET): Rename
CALL_DUMMY_BREAKPOINT_OFFSET.
(DEPRECATED_CALL_DUMMY_START_OFFSET): Rename
CALL_DUMMY_START_OFFSET.
(DEPRECATED_CALL_DUMMY_LENGTH): Rename CALL_DUMMY_LENGTH.
* gdbarch.h, gdbarch.c: Re-generate.
* alpha-tdep.c, alphafbsd-tdep.c, arm-linux-tdep.c: Update.
* arm-tdep.c, avr-tdep.c, breakpoint.c, cris-tdep.c: Update.
* dummy-frame.c, dummy-frame.h, frv-tdep.c, gdbarch.c: Update.
* gdbarch.h, gdbarch.sh, h8300-tdep.c, hppa-tdep.c: Update.
* i386-tdep.c, ia64-tdep.c, infcall.c, inferior.h: Update.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Update.
* mips-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* rs6000-tdep.c, s390-tdep.c, sh-tdep.c, sol-thread.c: Update.
* sparc-tdep.c, target.c, v850-tdep.c, valops.c: Update.
* vax-tdep.c, x86-64-tdep.c, xstormy16-tdep.c: Update.
* config/ia64/tm-ia64.h, config/m68k/tm-vx68.h: Update.
* config/mips/tm-mips.h, config/pa/nm-hppah.h: Update.
* config/pa/tm-hppa.h, config/pa/tm-hppa64.h: Update.
* config/s390/tm-s390.h, config/sparc/tm-sp64.h: Update.
* config/sparc/tm-sparc.h: Update.
Index: doc/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Make
CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_LENGTH,
FIX_CALL_DUMMY, CALL_DUMMY_BREAKPOINT_OFFSET and
CALL_DUMMY_BREAKPOINT_OFFSET deprecated.
Index: mi/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Replace
REGISTER_SIZE with DEPRECATED_REGISTER_SIZE.
Index: testsuite/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdb.base/watchpoint.exp: Rename CALL_DUMMY_BREAKPOINT_OFFSET to
DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET in comments.
2003-05-05 17:56:57 +00:00
|
|
|
return (read_memory_integer (get_frame_base (fi) + adjust,
|
|
|
|
DEPRECATED_REGISTER_SIZE));
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: mn10300_init_extra_frame_info
|
|
|
|
Setup the frame's frame pointer, pc, and frame addresses for saved
|
|
|
|
registers. Most of the work is done in mn10300_analyze_prologue().
|
|
|
|
|
|
|
|
Note that when we are called for the last frame (currently active frame),
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 22:20:47 +00:00
|
|
|
that get_frame_pc (fi) and fi->frame will already be setup. However, fi->frame will
|
1999-04-16 01:35:26 +00:00
|
|
|
be valid only if this routine uses FP. For previous frames, fi-frame will
|
|
|
|
always be correct. mn10300_analyze_prologue will fix fi->frame if
|
|
|
|
it's not valid.
|
|
|
|
|
2003-04-21 Andrew Cagney <cagney@redhat.com>
* infcall.c: New file.
* infcall.h: New file.
* valarith.c: Include "infcall.h".
* scm-lang.c, objc-lang.cm, hppa-tdep.c, gcore.c: Ditto.
* eval.c, ada-valprint.c, ada-lang.c: Ditto.
* Makefile.in (valarith.o, scm-lang.o): Update dependencies.
(objc-lang.o, hppa-tdep.o, gcore.o): Update dependencies.
(eval.o, ada-valprint.o, ada-lang.o): Update dependencies.
(SFILES): Add "infcall.c"
(COMMON_OBS): Add "infcall.o".
(infcall.o): Specify dependencies.
* value.h (call_function_by_hand): Delete declaration.
* inferior.h (run_stack_dummy): Delete declaration.
* infcmd.c (breakpoint_auto_delete_contents): Move to "infcall.c".
(run_stack_dummy): Move to "infcall.c", merged into
call_function_by_hand.
* valops.c (call_function_by_hand): Moved to "infcall.c".
(find_function_addr, value_arg_coerce): Ditto.
(unwindonsignal_p, coerce_float_to_double): Ditto.
(_initialize_valops): Move "set/show coerce-float-to-double", and
"set/show unwindonsignal" commands to "infcall.c".
* v850-tdep.c, target.h: Update comments.
* sparc-tdep.c (sparc_fix_call_dummy): Update comments.
* sh-tdep.c (sh_init_extra_frame_info): Update comments.
(sh64_init_extra_frame_info): Update comments.
* mn10300-tdep.c: Update comments.
* mcore-tdep.c (mcore_init_extra_frame_info): Update comments.
* config/sparc/tm-sparc.h: Update comments.
* breakpoint.h: Update comments.
* avr-tdep.c (avr_init_extra_frame_info): Update comments.
* arm-tdep.c: Update comment.
2003-04-21 16:48:41 +00:00
|
|
|
We can be called with the PC in the call dummy under two
|
|
|
|
circumstances. First, during normal backtracing, second, while
|
|
|
|
figuring out the frame pointer just prior to calling the target
|
|
|
|
function (see call_function_by_hand). */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static void
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
mn10300_init_extra_frame_info (int fromleaf, struct frame_info *fi)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 15:56:38 +00:00
|
|
|
if (get_next_frame (fi))
|
2003-03-12 16:50:47 +00:00
|
|
|
deprecated_update_frame_pc_hack (fi, DEPRECATED_FRAME_SAVED_PC (get_next_frame (fi)));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
frame_saved_regs_zalloc (fi);
|
2003-01-07 14:51:11 +00:00
|
|
|
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
get_frame_extra_info (fi)->status = 0;
|
|
|
|
get_frame_extra_info (fi)->stack_size = 0;
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
mn10300_analyze_prologue (fi, 0);
|
|
|
|
}
|
|
|
|
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
|
|
|
|
/* This function's job is handled by init_extra_frame_info. */
|
* mn10300-tdep.c (mn10300_saved_pc_after_call,
mn10300_extract_return_value,
mn10300_extract_struct_value_address, mn10300_store_return_value,
mn10300_use_struct_convention, mn10300_breakpoint_from_pc,
mn10300_frame_chain, mn10300_skip_prologue,
mn10300_push_arguments, mn10300_push_return_address,
mn10300_store_struct_return, mn10300_frame_saved_pc,
mn10300_init_extra_frame_info, mn10300_frame_init_saved_regs):
Make these functions static; they should only be visible to the
outside world as gdbarch methods.
2001-05-09 02:19:06 +00:00
|
|
|
static void
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
mn10300_frame_init_saved_regs (struct frame_info *frame)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
/* Function: mn10300_virtual_frame_pointer
|
|
|
|
Return the register that the function uses for a frame pointer,
|
|
|
|
plus any necessary offset to be applied to the register before
|
|
|
|
any frame pointer offsets. */
|
|
|
|
|
2001-08-11 00:59:29 +00:00
|
|
|
static void
|
|
|
|
mn10300_virtual_frame_pointer (CORE_ADDR pc,
|
|
|
|
int *reg,
|
|
|
|
LONGEST *offset)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
struct frame_info *dummy = analyze_dummy_frame (pc, 0);
|
|
|
|
/* Set up a dummy frame_info, Analyze the prolog and fill in the
|
|
|
|
extra info. */
|
|
|
|
/* Results will tell us which type of frame it uses. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
if (get_frame_extra_info (dummy)->status & MY_FRAME_IN_SP)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
*reg = SP_REGNUM;
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 17:21:30 +00:00
|
|
|
*offset = -(get_frame_extra_info (dummy)->stack_size);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-07-07 20:19:36 +00:00
|
|
|
*reg = A3_REGNUM;
|
1999-04-16 01:35:26 +00:00
|
|
|
*offset = 0;
|
|
|
|
}
|
|
|
|
}
|
1999-07-07 20:19:36 +00:00
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
static int
|
|
|
|
mn10300_reg_struct_has_addr (int gcc_p, struct type *type)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2000-08-11 07:54:49 +00:00
|
|
|
return (TYPE_LENGTH (type) > 8);
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2000-08-12 03:28:42 +00:00
|
|
|
static struct type *
|
|
|
|
mn10300_register_virtual_type (int reg)
|
|
|
|
{
|
|
|
|
return builtin_type_int;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mn10300_register_byte (int reg)
|
|
|
|
{
|
|
|
|
return (reg * 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mn10300_register_virtual_size (int reg)
|
|
|
|
{
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mn10300_register_raw_size (int reg)
|
|
|
|
{
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
2001-05-09 02:55:21 +00:00
|
|
|
/* If DWARF2 is a register number appearing in Dwarf2 debug info, then
|
|
|
|
mn10300_dwarf2_reg_to_regnum (DWARF2) is the corresponding GDB
|
|
|
|
register number. Why don't Dwarf2 and GDB use the same numbering?
|
|
|
|
Who knows? But since people have object files lying around with
|
|
|
|
the existing Dwarf2 numbering, and other people have written stubs
|
|
|
|
to work with the existing GDB, neither of them can change. So we
|
|
|
|
just have to cope. */
|
|
|
|
static int
|
|
|
|
mn10300_dwarf2_reg_to_regnum (int dwarf2)
|
|
|
|
{
|
|
|
|
/* This table is supposed to be shaped like the REGISTER_NAMES
|
|
|
|
initializer in gcc/config/mn10300/mn10300.h. Registers which
|
|
|
|
appear in GCC's numbering, but have no counterpart in GDB's
|
|
|
|
world, are marked with a -1. */
|
|
|
|
static int dwarf2_to_gdb[] = {
|
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, -1, 8,
|
|
|
|
15, 16, 17, 18, 19, 20, 21, 22
|
|
|
|
};
|
|
|
|
int gdb;
|
|
|
|
|
|
|
|
if (dwarf2 < 0
|
|
|
|
|| dwarf2 >= (sizeof (dwarf2_to_gdb) / sizeof (dwarf2_to_gdb[0]))
|
|
|
|
|| dwarf2_to_gdb[dwarf2] == -1)
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
"bogus register number in debug info: %d", dwarf2);
|
|
|
|
|
|
|
|
return dwarf2_to_gdb[dwarf2];
|
|
|
|
}
|
|
|
|
|
2000-08-12 03:28:42 +00:00
|
|
|
static void
|
|
|
|
mn10300_print_register (const char *name, int regnum, int reg_width)
|
|
|
|
{
|
2003-05-08 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh: Delete references to MAX_REGISTER_RAW_SIZE.
* gdbarch.h: Re-generate.
* defs.h (MAX_REGISTER_RAW_SIZE): Delete macro.
(legacy_max_register_raw_size): Delete declaration.
* regcache.c (legacy_max_register_raw_size): Delete function.
* valops.c: Replace MAX_REGISTER_RAW_SIZE with MAX_REGISTER_SIZE.
* target.c, stack.c, sparc-tdep.c, sh-tdep.c: Update.
* rs6000-tdep.c, rs6000-nat.c, remote.c, remote-sim.c: Update.
* remote-rdp.c, remote-array.c, regcache.c: Update.
* ppc-linux-nat.c, monitor.c, mn10300-tdep.c: Update.
* mips-tdep.c, mips-linux-tdep.c, m68klinux-nat.c: Update.
* infptrace.c, ia64-tdep.c, i386-tdep.c, frame.c: Update.
* findvar.c, dwarf2cfi.c: Update.
Index: tui/ChangeLog
2003-05-08 Andrew Cagney <cagney@redhat.com>
* tuiRegs.c: Use MAX_REGISTER_SIZE instead of
MAX_REGISTER_RAW_SIZE.
Index: mi/ChangeLog
2003-05-08 Andrew Cagney <cagney@redhat.com>
* mi-main.c (register_changed_p): Use MAX_REGISTER_SIZE instead of
MAX_REGISTER_RAW_SIZE.
2003-05-08 20:52:49 +00:00
|
|
|
char raw_buffer[MAX_REGISTER_SIZE];
|
2000-08-12 03:28:42 +00:00
|
|
|
|
|
|
|
if (reg_width)
|
|
|
|
printf_filtered ("%*s: ", reg_width, name);
|
|
|
|
else
|
|
|
|
printf_filtered ("%s: ", name);
|
|
|
|
|
|
|
|
/* Get the data */
|
2002-11-29 Andrew Cagney <ac131313@redhat.com>
* stack.c (selected_frame, select_frame): Move from here ...
* frame.c (selected_frame, select_frame): ... to here. Include
"language.h".
* Makefile.in (frame.o): Update dependencies.
* frame.c (get_selected_frame): New function.
* frame.h (get_selected_frame): Declare.
(deprecated_selected_frame): Rename selected_frame.
* ada-lang.c, ada-tasks.c, breakpoint.c, corelow.c: Update.
* eval.c, f-valprint.c, findvar.c, frame.c, frame.h: Update.
* h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, infcmd.c: Update.
* inflow.c, infrun.c, macroscope.c, mips-tdep.c: Update.
* mn10300-tdep.c, ocd.c, regcache.h, remote-e7000.c: Update.
* remote-mips.c, remote-rdp.c, sh-tdep.c, sparc-tdep.c: Update.
* stack.c, thread.c, tracepoint.c, valops.c, varobj.c: Update.
* z8k-tdep.c, cli/cli-cmds.c: Update.
Index: mi/ChangeLog
2002-11-29 Andrew Cagney <ac131313@redhat.com>
* mi/mi-cmd-stack.c, mi/mi-main.c: Update to use
deprecated_selected_frame.
Index: tui/ChangeLog
2002-11-29 Andrew Cagney <ac131313@redhat.com>
* tui/tui-hooks.c: Update to use deprecated_selected_frame.
* tui/tui.c, tui/tuiDisassem.c, tui/tuiRegs.c: Ditto.
* tui/tuiSource.c, tui/tuiSourceWin.c, tui/tuiWin.c: Ditto.
2002-11-29 19:15:16 +00:00
|
|
|
if (!frame_register_read (deprecated_selected_frame, regnum, raw_buffer))
|
2000-08-12 03:28:42 +00:00
|
|
|
{
|
|
|
|
printf_filtered ("[invalid]");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int byte;
|
2002-01-05 04:30:46 +00:00
|
|
|
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
|
2000-08-12 03:28:42 +00:00
|
|
|
{
|
2003-10-02 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_RAW_SIZE): Rename
REGISTER_RAW_SIZE.
* gdbarch.h, gdbarch.c: Re-generate.
* aix-thread.c, alpha-tdep.h, arm-tdep.c, core-sol2.c: Update.
* cris-tdep.c, dve3900-rom.c, findvar.c, frame.c: Update.
* hppa-tdep.c, hppab-nat.c, hppah-nat.c, hppam3-nat.c: Update.
* hpux-thread.c, i386gnu-nat.c, ia64-aix-nat.c: Update.
* ia64-linux-nat.c, ia64-tdep.c, infcmd.c, infptrace.c: Update.
* infrun.c, irix5-nat.c, lynx-nat.c, mips-linux-tdep.c: Update.
* mips-nat.c, mips-tdep.c, mipsv4-nat.c, mn10300-tdep.c: Update.
* monitor.c, ns32k-tdep.c, ppc-linux-nat.c, regcache.c: Update.
* remote-e7000.c, remote-mips.c, remote-sim.c: Update.
* remote-vxmips.c, remote-vxsparc.c, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, rs6000-tdep.c, s390-tdep.c: Update.
* sh64-tdep.c, sparc-nat.c, sparc-tdep.c, stack.c: Update.
* target.c, tracepoint.c, v850-tdep.c, v850ice.c, valops.c: Update.
* vax-tdep.c, vax-tdep.h, x86-64-tdep.c, xstormy16-tdep.c: Update.
* config/m68k/tm-delta68.h, config/m68k/tm-vx68.h: Update.
* config/sparc/tm-sparc.h, config/sparc/tm-sparclynx.h: Update.
2003-10-02 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Rename
REGISTER_RAW_SIZE to DEPRECATED_REGISTER_RAW_SIZE.
* gdb.texinfo (Packets, Stop Reply Packets): Ditto.
* gdbint.texinfo (Target Architecture Definition): Rename
2003-10-02 Andrew Cagney <cagney@redhat.com>
* mi-main.c: Rename REGISTER_RAW_SIZE to
DEPRECATED_REGISTER_RAW_SIZE.
2003-10-02 20:28:31 +00:00
|
|
|
for (byte = DEPRECATED_REGISTER_RAW_SIZE (regnum) - DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum);
|
|
|
|
byte < DEPRECATED_REGISTER_RAW_SIZE (regnum);
|
2000-08-12 03:28:42 +00:00
|
|
|
byte++)
|
|
|
|
printf_filtered ("%02x", (unsigned char) raw_buffer[byte]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-09-30 19:12:20 +00:00
|
|
|
for (byte = DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum) - 1;
|
2000-08-12 03:28:42 +00:00
|
|
|
byte >= 0;
|
|
|
|
byte--)
|
|
|
|
printf_filtered ("%02x", (unsigned char) raw_buffer[byte]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
mn10300_do_registers_info (int regnum, int fpregs)
|
|
|
|
{
|
|
|
|
if (regnum >= 0)
|
|
|
|
{
|
|
|
|
const char *name = REGISTER_NAME (regnum);
|
|
|
|
if (name == NULL || name[0] == '\0')
|
|
|
|
error ("Not a valid register for the current processor type");
|
|
|
|
mn10300_print_register (name, regnum, 0);
|
|
|
|
printf_filtered ("\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* print registers in an array 4x8 */
|
|
|
|
int r;
|
|
|
|
int reg;
|
|
|
|
const int nr_in_row = 4;
|
|
|
|
const int reg_width = 4;
|
|
|
|
for (r = 0; r < NUM_REGS; r += nr_in_row)
|
|
|
|
{
|
|
|
|
int c;
|
|
|
|
int printing = 0;
|
|
|
|
int padding = 0;
|
|
|
|
for (c = r; c < r + nr_in_row; c++)
|
|
|
|
{
|
|
|
|
const char *name = REGISTER_NAME (c);
|
|
|
|
if (name != NULL && *name != '\0')
|
|
|
|
{
|
|
|
|
printing = 1;
|
|
|
|
while (padding > 0)
|
|
|
|
{
|
|
|
|
printf_filtered (" ");
|
|
|
|
padding--;
|
|
|
|
}
|
|
|
|
mn10300_print_register (name, c, reg_width);
|
|
|
|
printf_filtered (" ");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
padding += (reg_width + 2 + 8 + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (printing)
|
|
|
|
printf_filtered ("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-06-07 18:08:25 +00:00
|
|
|
static CORE_ADDR
|
|
|
|
mn10300_read_fp (void)
|
|
|
|
{
|
|
|
|
/* That's right, we're using the stack pointer as our frame pointer. */
|
|
|
|
gdb_assert (SP_REGNUM >= 0);
|
|
|
|
return read_register (SP_REGNUM);
|
|
|
|
}
|
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
/* Dump out the mn10300 speciic architecture information. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
static void
|
|
|
|
mn10300_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
|
|
|
|
{
|
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
|
|
|
|
fprintf_unfiltered (file, "mn10300_dump_tdep: am33_mode = %d\n",
|
|
|
|
tdep->am33_mode);
|
|
|
|
}
|
1999-12-07 03:56:43 +00:00
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
static struct gdbarch *
|
|
|
|
mn10300_gdbarch_init (struct gdbarch_info info,
|
|
|
|
struct gdbarch_list *arches)
|
|
|
|
{
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
static LONGEST mn10300_call_dummy_words[] = { 0 };
|
2000-08-11 07:54:49 +00:00
|
|
|
struct gdbarch *gdbarch;
|
|
|
|
struct gdbarch_tdep *tdep = NULL;
|
|
|
|
int am33_mode;
|
|
|
|
gdbarch_register_name_ftype *register_name;
|
|
|
|
int mach;
|
|
|
|
int num_regs;
|
|
|
|
|
|
|
|
arches = gdbarch_list_lookup_by_info (arches, &info);
|
|
|
|
if (arches != NULL)
|
|
|
|
return arches->gdbarch;
|
|
|
|
tdep = xmalloc (sizeof (struct gdbarch_tdep));
|
|
|
|
gdbarch = gdbarch_alloc (&info, tdep);
|
|
|
|
|
|
|
|
if (info.bfd_arch_info != NULL
|
2000-08-12 03:28:42 +00:00
|
|
|
&& info.bfd_arch_info->arch == bfd_arch_mn10300)
|
2000-08-11 07:54:49 +00:00
|
|
|
mach = info.bfd_arch_info->mach;
|
|
|
|
else
|
|
|
|
mach = 0;
|
|
|
|
switch (mach)
|
|
|
|
{
|
|
|
|
case 0:
|
2000-08-12 03:28:42 +00:00
|
|
|
case bfd_mach_mn10300:
|
2000-08-11 07:54:49 +00:00
|
|
|
am33_mode = 0;
|
|
|
|
register_name = mn10300_generic_register_name;
|
|
|
|
num_regs = 32;
|
|
|
|
break;
|
|
|
|
case bfd_mach_am33:
|
1999-12-07 03:56:43 +00:00
|
|
|
am33_mode = 1;
|
2000-08-11 07:54:49 +00:00
|
|
|
register_name = am33_register_name;
|
|
|
|
num_regs = 32;
|
|
|
|
break;
|
|
|
|
default:
|
2001-02-08 06:03:54 +00:00
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
"mn10300_gdbarch_init: Unknown mn10300 variant");
|
2000-08-11 07:54:49 +00:00
|
|
|
return NULL; /* keep GCC happy. */
|
1999-12-07 03:56:43 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-05-09 02:09:48 +00:00
|
|
|
/* Registers. */
|
|
|
|
set_gdbarch_num_regs (gdbarch, num_regs);
|
|
|
|
set_gdbarch_register_name (gdbarch, register_name);
|
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_SIZE): Rename REGISTER_SIZE.
(DEPRECATED_SIZEOF_CALL_DUMMY_WORDS): Rename
SIZEOF_CALL_DUMMY_WORDS.
(DEPRECATED_CALL_DUMMY_WORDS): Rename CALL_DUMMY_WORDS.
(DEPRECATED_FIX_CALL_DUMMY): Rename FIX_CALL_DUMMY.
(DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET): Rename
CALL_DUMMY_BREAKPOINT_OFFSET.
(DEPRECATED_CALL_DUMMY_START_OFFSET): Rename
CALL_DUMMY_START_OFFSET.
(DEPRECATED_CALL_DUMMY_LENGTH): Rename CALL_DUMMY_LENGTH.
* gdbarch.h, gdbarch.c: Re-generate.
* alpha-tdep.c, alphafbsd-tdep.c, arm-linux-tdep.c: Update.
* arm-tdep.c, avr-tdep.c, breakpoint.c, cris-tdep.c: Update.
* dummy-frame.c, dummy-frame.h, frv-tdep.c, gdbarch.c: Update.
* gdbarch.h, gdbarch.sh, h8300-tdep.c, hppa-tdep.c: Update.
* i386-tdep.c, ia64-tdep.c, infcall.c, inferior.h: Update.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Update.
* mips-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* rs6000-tdep.c, s390-tdep.c, sh-tdep.c, sol-thread.c: Update.
* sparc-tdep.c, target.c, v850-tdep.c, valops.c: Update.
* vax-tdep.c, x86-64-tdep.c, xstormy16-tdep.c: Update.
* config/ia64/tm-ia64.h, config/m68k/tm-vx68.h: Update.
* config/mips/tm-mips.h, config/pa/nm-hppah.h: Update.
* config/pa/tm-hppa.h, config/pa/tm-hppa64.h: Update.
* config/s390/tm-s390.h, config/sparc/tm-sp64.h: Update.
* config/sparc/tm-sparc.h: Update.
Index: doc/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Make
CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_LENGTH,
FIX_CALL_DUMMY, CALL_DUMMY_BREAKPOINT_OFFSET and
CALL_DUMMY_BREAKPOINT_OFFSET deprecated.
Index: mi/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Replace
REGISTER_SIZE with DEPRECATED_REGISTER_SIZE.
Index: testsuite/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdb.base/watchpoint.exp: Rename CALL_DUMMY_BREAKPOINT_OFFSET to
DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET in comments.
2003-05-05 17:56:57 +00:00
|
|
|
set_gdbarch_deprecated_register_size (gdbarch, 4);
|
2003-05-17 06:00:01 +00:00
|
|
|
set_gdbarch_deprecated_register_bytes (gdbarch, num_regs * gdbarch_deprecated_register_size (gdbarch));
|
2003-03-03 20:50:20 +00:00
|
|
|
set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4);
|
2003-06-13 04:40:34 +00:00
|
|
|
set_gdbarch_deprecated_register_raw_size (gdbarch, mn10300_register_raw_size);
|
|
|
|
set_gdbarch_deprecated_register_byte (gdbarch, mn10300_register_byte);
|
2003-03-03 20:50:20 +00:00
|
|
|
set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
|
2003-06-13 04:40:34 +00:00
|
|
|
set_gdbarch_deprecated_register_virtual_size (gdbarch, mn10300_register_virtual_size);
|
|
|
|
set_gdbarch_deprecated_register_virtual_type (gdbarch, mn10300_register_virtual_type);
|
2001-05-09 02:55:21 +00:00
|
|
|
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum);
|
2002-10-26 17:19:28 +00:00
|
|
|
set_gdbarch_deprecated_do_registers_info (gdbarch, mn10300_do_registers_info);
|
2001-08-12 02:10:18 +00:00
|
|
|
set_gdbarch_sp_regnum (gdbarch, 8);
|
|
|
|
set_gdbarch_pc_regnum (gdbarch, 9);
|
2003-04-28 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_TARGET_READ_FP): Replace TARGET_READ_FP.
(DEPRECATED_FP_REGNUM): Replace FP_REGNUM.
* gdbarch.h, gdbarch.c: Re-generate.
* infcall.c (call_function_by_hand): Use DEPRECATED_FP_REGNUM,
DEPRECATED_TARGET_READ_FP, or "sp" to create the dummy frame ID.
* inferior.h (deprecated_read_fp): Rename read_fp.
(generic_target_read_fp): Delete declaration.
* regcache.c (generic_target_read_fp): Delete function.
(deprecated_read_fp): Replace read_fp, use
DEPRECATED_TARGET_READ_FP or DEPRECATED_FP_REGNUM.
* d10v-tdep.c (d10v_read_fp): Delete function.
(d10v_gdbarch_init): Do not set deprecated_read_fp.
* sparc-tdep.c (sparc_gdbarch_init): Do not set
deprecated_target_read_fp to generic_target_read_fp.
* sh-tdep.c (sh_gdbarch_init): Ditto.
* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
* frv-tdep.c (frv_gdbarch_init): Ditto.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Set
deprecated_fp_regnum.
* x86-64-tdep.c (x86_64_init_abi): Ditto.
* vax-tdep.c (vax_gdbarch_init): Ditto.
* v850-tdep.c (v850_gdbarch_init): Ditto.
* sparc-tdep.c (sparc_gdbarch_init): Ditto.
* sh-tdep.c (sh_gdbarch_init): Ditto.
* s390-tdep.c (s390_gdbarch_init): Ditto.
* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
* mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
* mcore-tdep.c (mcore_gdbarch_init): Ditto.
* m68k-tdep.c (m68k_gdbarch_init): Ditto.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
* ia64-tdep.c (ia64_gdbarch_init): Ditto.
* i386-tdep.c (i386_gdbarch_init): Ditto.
* hppa-tdep.c (hppa_gdbarch_init): Ditto.
* h8300-tdep.c (h8300_gdbarch_init): Ditto.
* frv-tdep.c (frv_gdbarch_init): Ditto.
* cris-tdep.c (cris_gdbarch_init): Ditto.
* avr-tdep.c (avr_gdbarch_init): Ditto.
* arm-tdep.c (arm_gdbarch_init): Ditto.
* alpha-tdep.c (alpha_gdbarch_init): Ditto.
* x86-64-tdep.c (x86_64_init_abi): Set deprecated_target_read_fp.
* v850-tdep.c (v850_gdbarch_init): Ditto.
* sparc-tdep.c (sparc_gdbarch_init): Ditto.
* sh-tdep.c (sh_gdbarch_init): Ditto.
* s390-tdep.c (s390_gdbarch_init): Ditto.
* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
* mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
* mips-tdep.c (mips_gdbarch_init): Ditto.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
* ia64-tdep.c (ia64_gdbarch_init): Ditto.
* hppa-tdep.c (hppa_gdbarch_init): Ditto.
* frv-tdep.c (frv_gdbarch_init): Ditto.
* avr-tdep.c (avr_gdbarch_init): Ditto.
* arm-tdep.c (arm_gdbarch_init): Ditto.
* vax-tdep.c (vax_frame_init_saved_regs): Replace FP_REGNUM with
DEPRECATED_FP_REGNUM.
(vax_push_dummy_frame, vax_pop_frame): Ditto.
* std-regs.c (value_of_builtin_frame_fp_reg): Ditto.
* sparc-tdep.c (sparc_init_extra_frame_info): Ditto.
(sparc_push_dummy_frame, sparc64_read_fp): Ditto.
(sparc32_register_virtual_type): Ditto.
* sh-tdep.c (sh64_frame_chain): Ditto.
(sh64_get_saved_register, sh64_pop_frame): Ditto.
(sh_nofp_frame_init_saved_regs): Ditto.
(sh64_nofp_frame_init_saved_regs): Ditto.
(sh_fp_frame_init_saved_regs): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump): Ditto.
* procfs.c (procfs_fetch_registers): Ditto.
(procfs_store_registers): Ditto.
* ns32knbsd-nat.c (fetch_inferior_registers): Ditto.
(store_inferior_registers, fetch_core_registers): Ditto.
(fetch_kcore_registers, clear_regs): Ditto.
* ns32k-tdep.c (ns32k_frame_init_saved_regs): Ditto.
(ns32k_push_dummy_frame, ns32k_pop_frame): Ditto.
* nlm/i386.h (DEPRECATED_FP_REGNUM): Ditto.
* nlm/i386.c (do_status): Ditto.
* mipsv4-nat.c (supply_gregset): Ditto.
* mips-tdep.c: Ditto for comments.
* mips-nat.c (fetch_inferior_registers): Ditto.
(store_inferior_registers, fetch_core_registers): Ditto.
* m68k-tdep.c (m68k_push_dummy_frame): Ditto.
(m68k_pop_frame, m68k_frame_init_saved_regs): Ditto.
* i386-tdep.c (i386_frame_init_saved_regs): Ditto.
(i386_do_pop_frame, i386_register_type): Ditto.
* hppa-tdep.c (hppa_frame_chain): Ditto.
(hppa_push_dummy_frame, find_dummy_frame_regs): Ditto.
(hppa_pop_frame, hppa_read_fp): Ditto.
(skip_prologue_hard_way, hppa_frame_find_saved_regs): Ditto.
* cris-tdep.c (cris_examine, cris_pop_frame): Ditto.
* config/vax/nm-vax.h (REGISTER_U_ADDR): Ditto.
* config/sparc/tm-sparc.h (DEPRECATED_FP_REGNUM): Ditto.
* config/sparc/tm-sp64.h (DEPRECATED_FP_REGNUM): Ditto.
* config/s390/tm-s390.h (DEPRECATED_FP_REGNUM): Ditto.
* config/pa/tm-hppa64.h (DEPRECATED_FP_REGNUM): Ditto.
* config/ia64/tm-ia64.h (DEPRECATED_FP_REGNUM): Ditto.
* blockframe.c: Ditto for comments.
* arch-utils.h: Ditto for comments.
* arch-utils.c (legacy_virtual_frame_pointer): Ditto.
* alphanbsd-tdep.c (fetch_core_registers): Ditto.
* alphabsd-nat.c (fetch_inferior_registers): Ditto.
* alpha-tdep.h: Ditto for comments.
* alpha-tdep.c (alpha_cannot_fetch_register): Ditto.
(alpha_cannot_store_register): Ditto.
(alpha_push_dummy_frame): Ditto.
* alpha-nat.c (supply_gregset): Ditto.
* config/sparc/tm-sp64.h (DEPRECATED_TARGET_READ_FP): Update.
* config/pa/tm-hppa64.h (DEPRECATED_TARGET_READ_FP): Update.
* config/sparc/tm-sparc.h: Update comment.
* hppa-tdep.c (hppa_init_extra_frame_info): Use
deprecated_read_fp instead of TARGET_READ_FP.
(hppa_init_extra_frame_info, hppa_frame_chain): Ditto.
(hppa_push_dummy_frame, hppa_read_fp): Ditto.
* sparc-tdep.c (sparc_init_extra_frame_info): Use
deprecated_read_fp instead of read_fp.
* s390-tdep.c (s390_push_arguments): Ditto.
* ia64-tdep.c (ia64_gdbarch_init): Ditto.
* frame.h: Ditto in comments.
* frame.c (legacy_get_prev_frame): Ditto.
* dummy-frame.c (dummy_frame_this_id): Ditto.
* arm-tdep.c (arm_init_extra_frame_info): Ditto.
2003-04-28 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Replace
read_fp, TARGET_READ_FP and FP_REGNUM, with deprecated_read_fp,
DEPRECATED_TARGET_READ_FP and DEPRECATED_REGNUM.
2003-04-29 01:49:49 +00:00
|
|
|
set_gdbarch_deprecated_fp_regnum (gdbarch, 31);
|
2001-08-11 00:59:29 +00:00
|
|
|
set_gdbarch_virtual_frame_pointer (gdbarch, mn10300_virtual_frame_pointer);
|
2001-05-09 02:09:48 +00:00
|
|
|
|
|
|
|
/* Breakpoints. */
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
set_gdbarch_breakpoint_from_pc (gdbarch, mn10300_breakpoint_from_pc);
|
2001-05-09 02:09:48 +00:00
|
|
|
|
|
|
|
/* Stack unwinding. */
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
2003-04-11 18:15:40 +00:00
|
|
|
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, mn10300_saved_pc_after_call);
|
2003-03-02 00:11:43 +00:00
|
|
|
set_gdbarch_deprecated_init_extra_frame_info (gdbarch, mn10300_init_extra_frame_info);
|
2003-03-02 04:02:25 +00:00
|
|
|
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, mn10300_frame_init_saved_regs);
|
2003-03-24 03:54:51 +00:00
|
|
|
set_gdbarch_deprecated_frame_chain (gdbarch, mn10300_frame_chain);
|
2003-03-12 16:50:47 +00:00
|
|
|
set_gdbarch_deprecated_frame_saved_pc (gdbarch, mn10300_frame_saved_pc);
|
2002-06-14 22:55:51 +00:00
|
|
|
set_gdbarch_deprecated_extract_return_value (gdbarch, mn10300_extract_return_value);
|
2002-08-24 00:21:37 +00:00
|
|
|
set_gdbarch_deprecated_store_return_value (gdbarch, mn10300_store_return_value);
|
2003-03-25 20:38:47 +00:00
|
|
|
set_gdbarch_deprecated_store_struct_return (gdbarch, mn10300_store_struct_return);
|
2003-03-13 21:45:43 +00:00
|
|
|
set_gdbarch_deprecated_pop_frame (gdbarch, mn10300_pop_frame);
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue);
|
|
|
|
set_gdbarch_frame_args_skip (gdbarch, 0);
|
|
|
|
/* That's right, we're using the stack pointer as our frame pointer. */
|
2003-06-07 18:08:25 +00:00
|
|
|
set_gdbarch_deprecated_target_read_fp (gdbarch, mn10300_read_fp);
|
2001-05-09 02:09:48 +00:00
|
|
|
|
|
|
|
/* Calling functions in the inferior from GDB. */
|
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_SIZE): Rename REGISTER_SIZE.
(DEPRECATED_SIZEOF_CALL_DUMMY_WORDS): Rename
SIZEOF_CALL_DUMMY_WORDS.
(DEPRECATED_CALL_DUMMY_WORDS): Rename CALL_DUMMY_WORDS.
(DEPRECATED_FIX_CALL_DUMMY): Rename FIX_CALL_DUMMY.
(DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET): Rename
CALL_DUMMY_BREAKPOINT_OFFSET.
(DEPRECATED_CALL_DUMMY_START_OFFSET): Rename
CALL_DUMMY_START_OFFSET.
(DEPRECATED_CALL_DUMMY_LENGTH): Rename CALL_DUMMY_LENGTH.
* gdbarch.h, gdbarch.c: Re-generate.
* alpha-tdep.c, alphafbsd-tdep.c, arm-linux-tdep.c: Update.
* arm-tdep.c, avr-tdep.c, breakpoint.c, cris-tdep.c: Update.
* dummy-frame.c, dummy-frame.h, frv-tdep.c, gdbarch.c: Update.
* gdbarch.h, gdbarch.sh, h8300-tdep.c, hppa-tdep.c: Update.
* i386-tdep.c, ia64-tdep.c, infcall.c, inferior.h: Update.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Update.
* mips-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* rs6000-tdep.c, s390-tdep.c, sh-tdep.c, sol-thread.c: Update.
* sparc-tdep.c, target.c, v850-tdep.c, valops.c: Update.
* vax-tdep.c, x86-64-tdep.c, xstormy16-tdep.c: Update.
* config/ia64/tm-ia64.h, config/m68k/tm-vx68.h: Update.
* config/mips/tm-mips.h, config/pa/nm-hppah.h: Update.
* config/pa/tm-hppa.h, config/pa/tm-hppa64.h: Update.
* config/s390/tm-s390.h, config/sparc/tm-sp64.h: Update.
* config/sparc/tm-sparc.h: Update.
Index: doc/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Make
CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_LENGTH,
FIX_CALL_DUMMY, CALL_DUMMY_BREAKPOINT_OFFSET and
CALL_DUMMY_BREAKPOINT_OFFSET deprecated.
Index: mi/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Replace
REGISTER_SIZE with DEPRECATED_REGISTER_SIZE.
Index: testsuite/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdb.base/watchpoint.exp: Rename CALL_DUMMY_BREAKPOINT_OFFSET to
DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET in comments.
2003-05-05 17:56:57 +00:00
|
|
|
set_gdbarch_deprecated_call_dummy_words (gdbarch, mn10300_call_dummy_words);
|
|
|
|
set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, sizeof (mn10300_call_dummy_words));
|
2002-12-01 Andrew Cagney <ac131313@redhat.com>
* gdbarch.sh (DEPRECATED_PC_IN_CALL_DUMMY): Rename
PC_IN_CALL_DUMMY. Change to predicate. Always allow call.
* gdbarch.h, gdbarch.c: Re-generate.
* config/sparc/tm-sparc.h, config/sparc/tm-sp64.h: Update.
* config/mn10200/tm-mn10200.h, config/h8500/tm-h8500.h: Update.
* config/pa/tm-hppa.h, frame.h: Update.
* x86-64-tdep.c, vax-tdep.c, sparc-tdep.c: Update.
* s390-tdep.c, ns32k-tdep.c, mn10300-tdep.c: Update.
* m68k-tdep.c, i386-tdep.c, frv-tdep.c: Update.
* cris-tdep.c, alpha-tdep.c: Update.
* frame.c (set_unwind_by_pc, create_new_frame): Use either
DEPRECATED_PC_IN_CALL_DUMMY or pc_in_dummy_frame.
(get_prev_frame): Ditto.
Index: doc/ChangeLog
2002-12-01 Andrew Cagney <ac131313@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Delete
PC_IN_CALL_DUMMY.
2002-12-01 19:07:16 +00:00
|
|
|
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
|
2003-03-26 22:39:53 +00:00
|
|
|
set_gdbarch_deprecated_push_arguments (gdbarch, mn10300_push_arguments);
|
2003-09-13 23:25:41 +00:00
|
|
|
set_gdbarch_deprecated_reg_struct_has_addr
|
|
|
|
(gdbarch, mn10300_reg_struct_has_addr);
|
2003-03-30 14:32:09 +00:00
|
|
|
set_gdbarch_deprecated_push_return_address (gdbarch, mn10300_push_return_address);
|
2003-06-16 16:47:44 +00:00
|
|
|
set_gdbarch_deprecated_save_dummy_frame_tos (gdbarch, generic_save_dummy_frame_tos);
|
Use gdbarch for most target parameters for the MN10300, rather
than the tm-*.h file.
* config/mn10300/tm-mn10300.h (MAX_REGISTER_VIRTUAL_SIZE,
REGISTER_BYTES, FP_REGNUM, BREAKPOINT_FROM_PC,
FUNCTION_START_OFFSET, DECR_PC_AFTER_BREAK, INNER_THAN,
SAVED_PC_AFTER_CALL, INIT_EXTRA_FRAME_INFO, FRAME_INIT_SAVED_REGS,
FRAME_CHAIN, FRAME_CHAIN_VALID, FRAME_SAVED_PC,
EXTRACT_RETURN_VALUE, EXTRACT_STRUCT_VALUE_ADDRESS,
STORE_RETURN_VALUE, STORE_STRUCT_RETURN, SKIP_PROLOGUE,
FRAME_ARGS_SKIP, FRAME_ARGS_ADDRESS, FRAME_LOCALS_ADDRESS,
FRAME_NUM_ARGS, POP_FRAME, USE_GENERIC_DUMMY_FRAMES, CALL_DUMMY,
CALL_DUMMY_START_OFFSET, CALL_DUMMY_BREAKPOINT_OFFSET,
CALL_DUMMY_LOCATION, FIX_CALL_DUMMY, CALL_DUMMY_ADDRESS,
TARGET_READ_FP, PUSH_RETURN_ADDRESS, PUSH_DUMMY_FRAME,
SAVE_DUMMY_FRAME_TOS, PUSH_ARGUMENTS, PC_IN_CALL_DUMMY,
REG_STRUCT_HAS_ADDR, USE_STRUCT_CONVENTION, GET_SAVED_REGISTER):
Delete definitions. We register gdbarch methods for these now.
(struct frame_info, struct type, struct value): Delete forward
declarations of these types; they're no longer necessary, since we
don't have function declarations here any more.
* mn10300-tdep.c: #include "arch-utils.h", to get declarations for
some default gdbarch methods.
(mn10300_store_struct_return): Return void, as expected by
gdbarch.
(mn10300_init_extra_frame_info): Take initial `fromleaf' argument,
as expected by gdbarch.
(mn10300_frame_init_saved_regs): Provide dummy definition for
this, as required by gdbarch.
(mn10300_gdbarch_init): Add mn10300_call_dummy_words, as expected
by gdbarch. Register gdbarch methods or values for all the stuff
removed from tm-10300.h, listed above.
2001-05-09 02:04:26 +00:00
|
|
|
set_gdbarch_use_struct_convention (gdbarch, mn10300_use_struct_convention);
|
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
tdep->am33_mode = am33_mode;
|
|
|
|
|
2003-03-30 14:59:02 +00:00
|
|
|
/* Should be using push_dummy_call. */
|
2003-06-07 22:38:56 +00:00
|
|
|
set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
|
2003-03-30 14:59:02 +00:00
|
|
|
|
2003-08-28 03:03:44 +00:00
|
|
|
set_gdbarch_print_insn (gdbarch, print_insn_mn10300);
|
|
|
|
|
2000-08-11 07:54:49 +00:00
|
|
|
return gdbarch;
|
|
|
|
}
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
_initialize_mn10300_tdep (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
/* printf("_initialize_mn10300_tdep\n"); */
|
2004-01-19 02:50:15 +00:00
|
|
|
gdbarch_register (bfd_arch_mn10300, mn10300_gdbarch_init, mn10300_dump_tdep);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|