binutils-gdb/gdb/avr-tdep.c

1421 lines
43 KiB
C
Raw Normal View History

/* Target-dependent code for Atmel AVR, for GDB.
2007-01-09 18:59:20 +01:00
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Contributed by Theodore A. Roth, troth@openavr.org */
/* Portions of this file were taken from the original gdb-4.18 patch developed
by Denis Chertykov, denisc@overta.ru */
#include "defs.h"
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
#include "frame.h"
#include "frame-unwind.h"
#include "frame-base.h"
#include "trad-frame.h"
#include "gdbcmd.h"
#include "gdbcore.h"
#include "gdbtypes.h"
#include "inferior.h"
#include "symfile.h"
#include "arch-utils.h"
#include "regcache.h"
#include "gdb_string.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 06:41:32 +02:00
#include "dis-asm.h"
/* AVR Background:
(AVR micros are pure Harvard Architecture processors.)
The AVR family of microcontrollers have three distinctly different memory
spaces: flash, sram and eeprom. The flash is 16 bits wide and is used for
the most part to store program instructions. The sram is 8 bits wide and is
used for the stack and the heap. Some devices lack sram and some can have
an additional external sram added on as a peripheral.
The eeprom is 8 bits wide and is used to store data when the device is
powered down. Eeprom is not directly accessible, it can only be accessed
via io-registers using a special algorithm. Accessing eeprom via gdb's
remote serial protocol ('m' or 'M' packets) looks difficult to do and is
not included at this time.
[The eeprom could be read manually via ``x/b <eaddr + AVR_EMEM_START>'' or
written using ``set {unsigned char}<eaddr + AVR_EMEM_START>''. For this to
work, the remote target must be able to handle eeprom accesses and perform
the address translation.]
All three memory spaces have physical addresses beginning at 0x0. In
addition, the flash is addressed by gcc/binutils/gdb with respect to 8 bit
bytes instead of the 16 bit wide words used by the real device for the
Program Counter.
In order for remote targets to work correctly, extra bits must be added to
addresses before they are send to the target or received from the target
via the remote serial protocol. The extra bits are the MSBs and are used to
decode which memory space the address is referring to. */
#undef XMALLOC
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
#undef EXTRACT_INSN
#define EXTRACT_INSN(addr) extract_unsigned_integer(addr,2)
/* Constants: prefixed with AVR_ to avoid name space clashes */
enum
{
AVR_REG_W = 24,
AVR_REG_X = 26,
AVR_REG_Y = 28,
AVR_FP_REGNUM = 28,
AVR_REG_Z = 30,
AVR_SREG_REGNUM = 32,
AVR_SP_REGNUM = 33,
AVR_PC_REGNUM = 34,
AVR_NUM_REGS = 32 + 1 /*SREG*/ + 1 /*SP*/ + 1 /*PC*/,
AVR_NUM_REG_BYTES = 32 + 1 /*SREG*/ + 2 /*SP*/ + 4 /*PC*/,
AVR_PC_REG_INDEX = 35, /* index into array of registers */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
AVR_MAX_PROLOGUE_SIZE = 64, /* bytes */
/* Count of pushed registers. From r2 to r17 (inclusively), r28, r29 */
AVR_MAX_PUSHES = 18,
/* Number of the last pushed register. r17 for current avr-gcc */
AVR_LAST_PUSHED_REGNUM = 17,
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
AVR_ARG1_REGNUM = 24, /* Single byte argument */
AVR_ARGN_REGNUM = 25, /* Multi byte argments */
AVR_RET1_REGNUM = 24, /* Single byte return value */
AVR_RETN_REGNUM = 25, /* Multi byte return value */
/* FIXME: TRoth/2002-01-??: Can we shift all these memory masks left 8
bits? Do these have to match the bfd vma values?. It sure would make
things easier in the future if they didn't need to match.
Note: I chose these values so as to be consistent with bfd vma
addresses.
TRoth/2002-04-08: There is already a conflict with very large programs
in the mega128. The mega128 has 128K instruction bytes (64K words),
thus the Most Significant Bit is 0x10000 which gets masked off my
AVR_MEM_MASK.
The problem manifests itself when trying to set a breakpoint in a
function which resides in the upper half of the instruction space and
thus requires a 17-bit address.
For now, I've just removed the EEPROM mask and changed AVR_MEM_MASK
from 0x00ff0000 to 0x00f00000. Eeprom is not accessible from gdb yet,
but could be for some remote targets by just adding the correct offset
to the address and letting the remote target handle the low-level
details of actually accessing the eeprom. */
AVR_IMEM_START = 0x00000000, /* INSN memory */
AVR_SMEM_START = 0x00800000, /* SRAM memory */
#if 1
/* No eeprom mask defined */
AVR_MEM_MASK = 0x00f00000, /* mask to determine memory space */
#else
AVR_EMEM_START = 0x00810000, /* EEPROM memory */
AVR_MEM_MASK = 0x00ff0000, /* mask to determine memory space */
#endif
};
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Prologue types:
NORMAL and CALL are the typical types (the -mcall-prologues gcc option
causes the generation of the CALL type prologues). */
enum {
AVR_PROLOGUE_NONE, /* No prologue */
AVR_PROLOGUE_NORMAL,
AVR_PROLOGUE_CALL, /* -mcall-prologues */
AVR_PROLOGUE_MAIN,
AVR_PROLOGUE_INTR, /* interrupt handler */
AVR_PROLOGUE_SIG, /* signal handler */
};
/* Any function with a frame looks like this
....... <-SP POINTS HERE
LOCALS1 <-FP POINTS HERE
LOCALS0
SAVED FP
SAVED R3
SAVED R2
RET PC
FIRST ARG
SECOND ARG */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
struct avr_unwind_cache
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* The previous frame's inner most stack address. Used as this
frame ID's stack_addr. */
CORE_ADDR prev_sp;
/* The frame's base, optionally used by the high-level debug info. */
CORE_ADDR base;
int size;
int prologue_type;
/* Table indicating the location of each and every register. */
struct trad_frame_saved_reg *saved_regs;
};
struct gdbarch_tdep
{
/* FIXME: TRoth: is there anything to put here? */
int foo;
};
/* Lookup the name of a register given it's number. */
2002-06-18 01:32:36 +02:00
static const char *
2007-11-02 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (register_name): Add gdbarch parameter. * gdbarch.{c,h}: Regenerate. * target-descriptions.c (tdesc_register_name): Add gdbarch parameter. (tdesc_register_name): Replace current_gdbarch by gdbarch. * target-descriptions.h (tdesc_register_name): Add gdbarch parameter. * xstormy16-tdep.c (xstormy16_register_name): Add gdbarch parameter. * vax-tdep.c (vax_register_name): Add gdbarch parameter. * spu-tdep.c (spu_register_name): Add gdbarch parameter. * s390-tdep.c (s390_register_name): Add gdbarch parameter. * mt-tdep.c (mt_register_name): Add gdbarch parameter. (mt_registers_info): Replace current_gdbarch by gdbarch. (mt_register_reggroup_p): Add gdbarch to mt_register_name call. * mips-tdep.c (mips_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (mips_register_name): Add gdbarch to tdesc_register_name call. * mep-tdep.c (mep_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (mep_register_reggroup_p): Add gdbarch to mep_register_name call. * m32c-tdep.c (m32c_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. * m88k-tdep.c (m88k_register_name): Add gdbarch parameter. * m68k-tdep.c (m68k_register_name): Add gdbarch parameter. * m32r-tdep.c (m32r_register_name): Add gdbarch parameter. (m32r_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. * iq2000-tdep.c (iq2000_register_name): Add gdbarch parameter. * ia64-tdep.c (ia64_register_name): Add gdbarch parameter. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Add gdbarch parameter. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Add gdbarch parameter. * cris-tdep.c (cris_register_name, crisv32_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (cris_gdbarch_init): Replace current_gdbarch by gdbarch (comment). * avr-tdep.c (avr_register_name): Add gdbarch parameter. * arm-tdep.c (arm_register_name): Add gdbarch paramete * amd64-tdep.c (amd64_register_name): Add gdbarch parameter. Update caller. * amd64-tdep.h (amd64_register_name): Add gdbarch parameter. * amd64-linux-tdep.c (amd64_linux_register_name): Add gdbarch parameter. * alpha-tdep.c (alpha_register_name): Add gdbarch parameter. (alpha_cannot_fetch_register, alpha_cannot_store_register): Update call of alpha_register_name. * frv-tdep.c (frv_register_name): Add gdbarch parameter. * i386-tdep.c (i386_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (i386_register_type): Replace ?current_gdbarch by gdbarch. * i386-tdep.h (i386_register_name): Add gdbarch parameter. * i386-linux-tdep.c (i386_linux_register_name): Add gdbarch parameter. * m68hc11-tdep.c (m68hc11_register_name): Add gdbarch parameter. (m68hc11_register_reggroup_p): Add gdbarch to call of m68hc11_register_name. * mn10300-tdep.c (mn10300_generic_register_name, am33_register_name) (am33_2_register_name): Add gdbarch parameter. (mn10300_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. (mn10300_dump_tdep): Replace current_gdbarch by gdbarch. * rs6000-tdep.c (rs6000_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. * score-tdep.c (score_register_name): Add gdbarch parameter. (score_return_value, score_push_dummy_call): Replace current_gdbarch by gdbarch. * sh64-tdep.c (sh64_register_name): Add gdbarch parameter. (sh64_compact_reg_base_num, sh64_register_convert_to_virtual) (sh64_register_convert_to_raw, sh64_fv_reg_base_num) (sh64_dr_reg_base_num, sh64_fpp_reg_base_num): Add gdbarch parameter and update caller. Replace current_gdbarch by gdbarch. (sh64_extract_return_value, sh64_store_return_value): Use get_regcache_arch to get at the current architecture by regcache. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name, sh_sh2a_register_name) (sh_sh2a_nofpu_register_name, sh_sh_dsp_register_name) (sh_sh3_dsp_register_name, sh_sh4_register_name) (sh_sh4_nofpu_register_name, sh_sh4al_dsp_register_name): Add gdbarch parameter. (fv_reg_base_num, dr_reg_base_num, sh_justify_value_in_reg) (sh_next_flt_argreg): Add gdbarch parameter and update caller. Replace current_gdbarch by gdbarch. (sh_extract_return_value_fpu, sh_store_return_value_fpu): Use get_regcache_arch to get at the current architecture by regcache. * sparc-tdep.c (sparc32_register_name): Add gdbarch parameter. * sparc64-tdep.c (sparc64_register_name): Add gdbarch parameter. * v850-tdep.c (v850_register_name, v850e_register_name): Add gdbarch parameter. (v850_unwind_sp, v850_unwind_pc): Replace current_gdbarch by gdbarch. * xtensa-tdep.c (xtensa_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (xtensa_pseudo_register_read, xtensa_pseudo_register_write) (xtensa_frame_prev_register): Add gdbarch parameter to xtensa_register_name call.
2007-11-02 15:27:15 +01:00
avr_register_name (struct gdbarch *gdbarch, int regnum)
{
static char *register_names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31",
"SREG", "SP", "PC"
};
if (regnum < 0)
return NULL;
if (regnum >= (sizeof (register_names) / sizeof (*register_names)))
return NULL;
return register_names[regnum];
}
/* Return the GDB type object for the "standard" data type
of data in register N. */
static struct type *
avr_register_type (struct gdbarch *gdbarch, int reg_nr)
{
if (reg_nr == AVR_PC_REGNUM)
return builtin_type_uint32;
if (reg_nr == AVR_SP_REGNUM)
* alpha-tdep.c (alpha_register_type): Use builtin_type (gdbarch) instead of builtin_type_ macros. * amd64-tdep.c (amd64_register_type): Likewise. (amd64_get_longjmp_target): Likewise. * arm-tdep.c (arm_register_type): Likewise. * avr-tdep.c (avr_register_type): Likewise. * cris-tdep.c (cris_register_type, crisv32_register_type): Likewise. * frv-tdep.c (frv_register_type): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * hppa-tdep.c (hppa32_convert_from_func_ptr_addr, hppa_skip_trampoline_code): Likewise. * i386-tdep.c (i386_register_type): Likewise. (i386_unwind_pc, i386_sse_type): Likewise. * ia64-tdep.c (ia64_register_type): Likewise. * m32r-tdep.c (m32r_register_type): Likewise. * m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise. * m88k-tdep.c (m88k_register_type): Likewise. * mep-tdep.c (mep_register_type): Likewise. * mips-tdep.c (mips_pseudo_register_type): Likewise. * mn10300-tdep.c (mn10300_register_type): Likewise. * mt-tdep.c (mt_copro_register_type): Likewise. * rs6000-tdep.c (rs6000_builtin_type_vec64): Likewise. (rs6000_convert_register_p, rs6000_register_to_value, rs6000_value_to_register): Likewise. * s390-tdep.c (s390_register_type): Likewise. * sh64-tdep.c (sh64_register_type): Likewise. (sh64_build_float_register_type, sh64_do_fp_register): Likewise. * sh-tdep.c (sh_sh2a_register_type, sh_sh3e_register_type, sh_sh4_build_float_register_type, sh_sh4_register_type, sh_default_register_type): Likewise. * sparc64-tdep.c (sparc64_register_type): Likewise. * sparc-tdep.c (sparc32_register_type): Likewise. * spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise. * v850-tdep.c (v850_register_type): Likewise. * vax-tdep.c (vax_register_type): Likewise. * xtensa-tdep.c (xtensa_register_type, xtensa_unwind_pc, xtensa_push_dummy_call): Likewise. * std-regs.c (value_of_builtin_frame_fp_reg, value_of_builtin_frame_pc_reg): Likewise. * target-descriptions.c (tdesc_register_type): Likewise.
2008-09-11 16:23:15 +02:00
return builtin_type (gdbarch)->builtin_data_ptr;
else
return builtin_type_uint8;
}
/* Instruction address checks and convertions. */
static CORE_ADDR
avr_make_iaddr (CORE_ADDR x)
{
return ((x) | AVR_IMEM_START);
}
/* FIXME: TRoth: Really need to use a larger mask for instructions. Some
devices are already up to 128KBytes of flash space.
TRoth/2002-04-8: See comment above where AVR_IMEM_START is defined. */
static CORE_ADDR
avr_convert_iaddr_to_raw (CORE_ADDR x)
{
return ((x) & 0xffffffff);
}
/* SRAM address checks and convertions. */
static CORE_ADDR
avr_make_saddr (CORE_ADDR x)
{
return ((x) | AVR_SMEM_START);
}
static CORE_ADDR
avr_convert_saddr_to_raw (CORE_ADDR x)
{
return ((x) & 0xffffffff);
}
/* EEPROM address checks and convertions. I don't know if these will ever
actually be used, but I've added them just the same. TRoth */
/* TRoth/2002-04-08: Commented out for now to allow fix for problem with large
programs in the mega128. */
/* static CORE_ADDR */
/* avr_make_eaddr (CORE_ADDR x) */
/* { */
/* return ((x) | AVR_EMEM_START); */
/* } */
/* static int */
/* avr_eaddr_p (CORE_ADDR x) */
/* { */
/* return (((x) & AVR_MEM_MASK) == AVR_EMEM_START); */
/* } */
/* static CORE_ADDR */
/* avr_convert_eaddr_to_raw (CORE_ADDR x) */
/* { */
/* return ((x) & 0xffffffff); */
/* } */
/* Convert from address to pointer and vice-versa. */
static void
avr_address_to_pointer (struct type *type, gdb_byte *buf, CORE_ADDR addr)
{
/* Is it a code address? */
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
|| TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
{
store_unsigned_integer (buf, TYPE_LENGTH (type),
avr_convert_iaddr_to_raw (addr >> 1));
}
else
{
/* Strip off any upper segment bits. */
store_unsigned_integer (buf, TYPE_LENGTH (type),
avr_convert_saddr_to_raw (addr));
}
}
static CORE_ADDR
avr_pointer_to_address (struct type *type, const gdb_byte *buf)
{
2003-06-01 Andrew Cagney <cagney@redhat.com> * defs.h (extract_address): Delete declaration. * findvar.c (extract_address): Delete function. * xstormy16-tdep.c (xstormy16_extract_return_value): Replace extract_address with the inline equivalent, extract_unsigned_integer. (xstormy16_extract_struct_value_address): Ditto. (xstormy16_pointer_to_address): Ditto. * vax-tdep.c (vax_extract_struct_value_address): Ditto. * v850-tdep.c (v850_push_arguments): Ditto. (v850_extract_return_value): Ditto. (v850_extract_struct_value_address): Ditto. * sparcnbsd-tdep.c (sparcnbsd_get_longjmp_target_32): Ditto. (sparcnbsd_get_longjmp_target_64): Ditto. * sparc-tdep.c (sparc_frame_saved_pc): Ditto. (get_longjmp_target): Ditto. * sh-tdep.c (sh_extract_struct_value_address): Ditto. (sh64_extract_struct_value_address): Ditto. (sh_push_arguments): Ditto. (sh64_push_arguments): Ditto. * remote-vxsparc.c (vx_read_register): Ditto. * ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Ditto. * ns32k-tdep.c (ns32k_extract_struct_value_address): Ditto. * mn10300-tdep.c (mn10300_extract_struct_value_address): Ditto. * mipsv4-nat.c (get_longjmp_target): Ditto. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Ditto. * mips-nat.c (get_longjmp_target): Ditto. * mips-linux-tdep.c (mips_linux_get_longjmp_target): Ditto. * mcore-tdep.c (mcore_extract_struct_value_address): Ditto. * m68k-tdep.c (m68k_get_longjmp_target): Ditto. * m68hc11-tdep.c (m68hc11_extract_struct_value_address): Ditto. * irix5-nat.c (get_longjmp_target): Ditto. * irix4-nat.c (get_longjmp_target): Ditto. * ia64-tdep.c (generic_elf_find_global_pointer): Ditto. (ia64_push_arguments): Ditto. * hpux-thread.c (hpux_thread_store_registers): Ditto. * h8300-tdep.c (h8300_push_arguments): Ditto. (h8300_store_return_value): Ditto. (h8300_extract_struct_value_address): Ditto. * frv-tdep.c (frv_extract_struct_value_address): Ditto. (frv_push_arguments): Ditto. * avr-tdep.c (avr_pointer_to_address): Ditto. (avr_push_arguments): Ditto. * arm-tdep.c (arm_push_dummy_call): Ditto. (arm_get_longjmp_target): Ditto. * arm-linux-tdep.c (arm_linux_push_arguments): Ditto. * alpha-tdep.c (alpha_extract_struct_value_address): Ditto. (alpha_get_longjmp_target): Ditto.
2003-06-02 04:09:40 +02:00
CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
/* Is it a code address? */
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
|| TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
|| TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
return avr_make_iaddr (addr << 1);
else
return avr_make_saddr (addr);
}
static CORE_ADDR
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
avr_read_pc (struct regcache *regcache)
{
ULONGEST pc;
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
regcache_cooked_read_unsigned (regcache, AVR_PC_REGNUM, &pc);
return avr_make_iaddr (pc);
}
static void
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
avr_write_pc (struct regcache *regcache, CORE_ADDR val)
{
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
regcache_cooked_write_unsigned (regcache, AVR_PC_REGNUM,
avr_convert_iaddr_to_raw (val));
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static int
avr_scan_arg_moves (int vpc, unsigned char *prologue)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
unsigned short insn;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
for (; vpc < AVR_MAX_PROLOGUE_SIZE; vpc += 2)
{
insn = EXTRACT_INSN (&prologue[vpc]);
if ((insn & 0xff00) == 0x0100) /* movw rXX, rYY */
continue;
else if ((insn & 0xfc00) == 0x2c00) /* mov rXX, rYY */
continue;
else
break;
}
return vpc;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Function: avr_scan_prologue
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
This function decodes an AVR function prologue to determine:
1) the size of the stack frame
2) which registers are saved on it
3) the offsets of saved regs
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
This information is stored in the avr_unwind_cache structure.
Some devices lack the sbiw instruction, so on those replace this:
sbiw r28, XX
with this:
subi r28,lo8(XX)
sbci r29,hi8(XX)
A typical AVR function prologue with a frame pointer might look like this:
push rXX ; saved regs
...
push r28
push r29
in r28,__SP_L__
in r29,__SP_H__
sbiw r28,<LOCALS_SIZE>
in __tmp_reg__,__SREG__
cli
out __SP_H__,r29
out __SREG__,__tmp_reg__
out __SP_L__,r28
A typical AVR function prologue without a frame pointer might look like
this:
push rXX ; saved regs
...
A main function prologue looks like this:
ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>)
ldi r29,hi8(<RAM_ADDR> - <LOCALS_SIZE>)
out __SP_H__,r29
out __SP_L__,r28
A signal handler prologue looks like this:
push __zero_reg__
push __tmp_reg__
in __tmp_reg__, __SREG__
push __tmp_reg__
clr __zero_reg__
push rXX ; save registers r18:r27, r30:r31
...
push r28 ; save frame pointer
push r29
in r28, __SP_L__
in r29, __SP_H__
sbiw r28, <LOCALS_SIZE>
out __SP_H__, r29
out __SP_L__, r28
A interrupt handler prologue looks like this:
sei
push __zero_reg__
push __tmp_reg__
in __tmp_reg__, __SREG__
push __tmp_reg__
clr __zero_reg__
push rXX ; save registers r18:r27, r30:r31
...
push r28 ; save frame pointer
push r29
in r28, __SP_L__
in r29, __SP_H__
sbiw r28, <LOCALS_SIZE>
cli
out __SP_H__, r29
sei
out __SP_L__, r28
A `-mcall-prologues' prologue looks like this (Note that the megas use a
jmp instead of a rjmp, thus the prologue is one word larger since jmp is a
32 bit insn and rjmp is a 16 bit insn):
ldi r26,lo8(<LOCALS_SIZE>)
ldi r27,hi8(<LOCALS_SIZE>)
ldi r30,pm_lo8(.L_foo_body)
ldi r31,pm_hi8(.L_foo_body)
rjmp __prologue_saves__+RRR
.L_foo_body: */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Not really part of a prologue, but still need to scan for it, is when a
function prologue moves values passed via registers as arguments to new
registers. In this case, all local variables live in registers, so there
may be some register saves. This is what it looks like:
movw rMM, rNN
...
There could be multiple movw's. If the target doesn't have a movw insn, it
will use two mov insns. This could be done after any of the above prologue
types. */
static CORE_ADDR
avr_scan_prologue (CORE_ADDR pc, struct avr_unwind_cache *info)
{
int i;
unsigned short insn;
int scan_stage = 0;
struct minimal_symbol *msymbol;
unsigned char prologue[AVR_MAX_PROLOGUE_SIZE];
int vpc = 0;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* FIXME: TRoth/2003-06-11: This could be made more efficient by only
reading in the bytes of the prologue. The problem is that the figuring
out where the end of the prologue is is a bit difficult. The old code
tried to do that, but failed quite often. */
read_memory (pc, prologue, AVR_MAX_PROLOGUE_SIZE);
/* Scanning main()'s prologue
ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>)
ldi r29,hi8(<RAM_ADDR> - <LOCALS_SIZE>)
out __SP_H__,r29
out __SP_L__,r28 */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (1)
{
CORE_ADDR locals;
unsigned char img[] = {
0xde, 0xbf, /* out __SP_H__,r29 */
0xcd, 0xbf /* out __SP_L__,r28 */
};
insn = EXTRACT_INSN (&prologue[vpc]);
/* ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>) */
if ((insn & 0xf0f0) == 0xe0c0)
{
locals = (insn & 0xf) | ((insn & 0x0f00) >> 4);
insn = EXTRACT_INSN (&prologue[vpc + 2]);
/* ldi r29,hi8(<RAM_ADDR> - <LOCALS_SIZE>) */
if ((insn & 0xf0f0) == 0xe0d0)
{
locals |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
if (memcmp (prologue + vpc + 4, img, sizeof (img)) == 0)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->prologue_type = AVR_PROLOGUE_MAIN;
info->base = locals;
return pc + 4;
}
}
}
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Scanning `-mcall-prologues' prologue
Classic prologue is 10 bytes, mega prologue is a 12 bytes long */
while (1) /* Using a while to avoid many goto's */
{
int loc_size;
int body_addr;
unsigned num_pushes;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
int pc_offset = 0;
insn = EXTRACT_INSN (&prologue[vpc]);
/* ldi r26,<LOCALS_SIZE> */
if ((insn & 0xf0f0) != 0xe0a0)
break;
loc_size = (insn & 0xf) | ((insn & 0x0f00) >> 4);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
pc_offset += 2;
insn = EXTRACT_INSN (&prologue[vpc + 2]);
/* ldi r27,<LOCALS_SIZE> / 256 */
if ((insn & 0xf0f0) != 0xe0b0)
break;
loc_size |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
pc_offset += 2;
insn = EXTRACT_INSN (&prologue[vpc + 4]);
/* ldi r30,pm_lo8(.L_foo_body) */
if ((insn & 0xf0f0) != 0xe0e0)
break;
body_addr = (insn & 0xf) | ((insn & 0x0f00) >> 4);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
pc_offset += 2;
insn = EXTRACT_INSN (&prologue[vpc + 6]);
/* ldi r31,pm_hi8(.L_foo_body) */
if ((insn & 0xf0f0) != 0xe0f0)
break;
body_addr |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
pc_offset += 2;
msymbol = lookup_minimal_symbol ("__prologue_saves__", NULL, NULL);
if (!msymbol)
break;
insn = EXTRACT_INSN (&prologue[vpc + 8]);
/* rjmp __prologue_saves__+RRR */
if ((insn & 0xf000) == 0xc000)
{
/* Extract PC relative offset from RJMP */
i = (insn & 0xfff) | (insn & 0x800 ? (-1 ^ 0xfff) : 0);
/* Convert offset to byte addressable mode */
i *= 2;
/* Destination address */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
i += pc + 10;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (body_addr != (pc + 10)/2)
break;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
pc_offset += 2;
}
else if ((insn & 0xfe0e) == 0x940c)
{
/* Extract absolute PC address from JMP */
i = (((insn & 0x1) | ((insn & 0x1f0) >> 3) << 16)
| (EXTRACT_INSN (&prologue[vpc + 10]) & 0xffff));
/* Convert address to byte addressable mode */
i *= 2;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (body_addr != (pc + 12)/2)
break;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
pc_offset += 4;
}
else
break;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Resolve offset (in words) from __prologue_saves__ symbol.
Which is a pushes count in `-mcall-prologues' mode */
num_pushes = AVR_MAX_PUSHES - (i - SYMBOL_VALUE_ADDRESS (msymbol)) / 2;
if (num_pushes > AVR_MAX_PUSHES)
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
{
fprintf_unfiltered (gdb_stderr, _("Num pushes too large: %d\n"),
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
num_pushes);
num_pushes = 0;
}
if (num_pushes)
{
int from;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->saved_regs[AVR_FP_REGNUM + 1].addr = num_pushes;
if (num_pushes >= 2)
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->saved_regs[AVR_FP_REGNUM].addr = num_pushes - 1;
i = 0;
for (from = AVR_LAST_PUSHED_REGNUM + 1 - (num_pushes - 2);
from <= AVR_LAST_PUSHED_REGNUM; ++from)
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->saved_regs [from].addr = ++i;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->size = loc_size + num_pushes;
info->prologue_type = AVR_PROLOGUE_CALL;
return pc + pc_offset;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Scan for the beginning of the prologue for an interrupt or signal
function. Note that we have to set the prologue type here since the
third stage of the prologue may not be present (e.g. no saved registered
or changing of the SP register). */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (1)
{
unsigned char img[] = {
0x78, 0x94, /* sei */
0x1f, 0x92, /* push r1 */
0x0f, 0x92, /* push r0 */
0x0f, 0xb6, /* in r0,0x3f SREG */
0x0f, 0x92, /* push r0 */
0x11, 0x24 /* clr r1 */
};
if (memcmp (prologue, img, sizeof (img)) == 0)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->prologue_type = AVR_PROLOGUE_INTR;
vpc += sizeof (img);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->saved_regs[AVR_SREG_REGNUM].addr = 3;
info->saved_regs[0].addr = 2;
info->saved_regs[1].addr = 1;
info->size += 3;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
else if (memcmp (img + 2, prologue, sizeof (img) - 2) == 0)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->prologue_type = AVR_PROLOGUE_SIG;
vpc += sizeof (img) - 2;
info->saved_regs[AVR_SREG_REGNUM].addr = 3;
info->saved_regs[0].addr = 2;
info->saved_regs[1].addr = 1;
info->size += 3;
}
}
/* First stage of the prologue scanning.
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
Scan pushes (saved registers) */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
for (; vpc < AVR_MAX_PROLOGUE_SIZE; vpc += 2)
{
insn = EXTRACT_INSN (&prologue[vpc]);
if ((insn & 0xfe0f) == 0x920f) /* push rXX */
{
/* Bits 4-9 contain a mask for registers R0-R32. */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
int regno = (insn & 0x1f0) >> 4;
info->size++;
info->saved_regs[regno].addr = info->size;
scan_stage = 1;
}
else
break;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (vpc >= AVR_MAX_PROLOGUE_SIZE)
fprintf_unfiltered (gdb_stderr,
_("Hit end of prologue while scanning pushes\n"));
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Second stage of the prologue scanning.
Scan:
in r28,__SP_L__
in r29,__SP_H__ */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (scan_stage == 1 && vpc < AVR_MAX_PROLOGUE_SIZE)
{
unsigned char img[] = {
0xcd, 0xb7, /* in r28,__SP_L__ */
0xde, 0xb7 /* in r29,__SP_H__ */
};
unsigned short insn1;
if (memcmp (prologue + vpc, img, sizeof (img)) == 0)
{
vpc += 4;
scan_stage = 2;
}
}
/* Third stage of the prologue scanning. (Really two stages)
Scan for:
sbiw r28,XX or subi r28,lo8(XX)
sbci r29,hi8(XX)
in __tmp_reg__,__SREG__
cli
out __SP_H__,r29
out __SREG__,__tmp_reg__
out __SP_L__,r28 */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (scan_stage == 2 && vpc < AVR_MAX_PROLOGUE_SIZE)
{
int locals_size = 0;
unsigned char img[] = {
0x0f, 0xb6, /* in r0,0x3f */
0xf8, 0x94, /* cli */
0xde, 0xbf, /* out 0x3e,r29 ; SPH */
0x0f, 0xbe, /* out 0x3f,r0 ; SREG */
0xcd, 0xbf /* out 0x3d,r28 ; SPL */
};
unsigned char img_sig[] = {
0xde, 0xbf, /* out 0x3e,r29 ; SPH */
0xcd, 0xbf /* out 0x3d,r28 ; SPL */
};
unsigned char img_int[] = {
0xf8, 0x94, /* cli */
0xde, 0xbf, /* out 0x3e,r29 ; SPH */
0x78, 0x94, /* sei */
0xcd, 0xbf /* out 0x3d,r28 ; SPL */
};
insn = EXTRACT_INSN (&prologue[vpc]);
vpc += 2;
if ((insn & 0xff30) == 0x9720) /* sbiw r28,XXX */
locals_size = (insn & 0xf) | ((insn & 0xc0) >> 2);
else if ((insn & 0xf0f0) == 0x50c0) /* subi r28,lo8(XX) */
{
locals_size = (insn & 0xf) | ((insn & 0xf00) >> 4);
insn = EXTRACT_INSN (&prologue[vpc]);
vpc += 2;
locals_size += ((insn & 0xf) | ((insn & 0xf00) >> 4) << 8);
}
else
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
return pc + vpc;
/* Scan the last part of the prologue. May not be present for interrupt
or signal handler functions, which is why we set the prologue type
when we saw the beginning of the prologue previously. */
if (memcmp (prologue + vpc, img_sig, sizeof (img_sig)) == 0)
{
vpc += sizeof (img_sig);
}
else if (memcmp (prologue + vpc, img_int, sizeof (img_int)) == 0)
{
vpc += sizeof (img_int);
}
if (memcmp (prologue + vpc, img, sizeof (img)) == 0)
{
info->prologue_type = AVR_PROLOGUE_NORMAL;
vpc += sizeof (img);
}
info->size += locals_size;
return pc + avr_scan_arg_moves (vpc, prologue);
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* If we got this far, we could not scan the prologue, so just return the pc
of the frame plus an adjustment for argument move insns. */
return pc + avr_scan_arg_moves (vpc, prologue);;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static CORE_ADDR
* gdbarch.sh (skip_prologue): Add gdbarch as parameter. * gdbarch.{c,h}: Regenerate. * alpha-tdep.c (alpha_skip_prologue): Add gdbarch as parameter. * amd64-tdep.c (amd64_skip_prologue): Likewise. * avr-tdep.c (avr_skip_prologue): Likewise. * cris-tdep.c (cris_skip_prologue): Likewise. * frv-tdep.c (frv_skip_prologue): Likewise. * h8300-tdep.c (h8300_skip_prologue): Likewise. * hppa-tdep.c (hppa_skip_prologue): Likewise. * i386-tdep.c (i386_skip_prologue): Likewise. * ia64-tdep.c (ia64_skip_prologue): Likewise. * iq2000-tdep.c (iq2000_skip_prologue): Likewise. * m32r-tdep.c (m32r_skip_prologue): Likewise. * m68hc11-tdep.c (m68hc11_skip_prologue): Likewise. * m68k-tdep.c (m68k_skip_prologue): Likewise. * m88k-tdep.c (m88k_skip_prologue): Likewise. * mep-tdep.c (mep_skip_prologue): Likewise. * mips-tdep.c (mips_skip_prologue): Likewise. * mn10300-tdep.c (mn10300_skip_prologue): Likewise. * mt-tdep.c (mt_skip_prologue): Likewise. * rs6000-tdep.c (rs6000_skip_prologue): Likewise. * score-tdep.c (score_skip_prologue): Likewise. * sh64-tdep.c (sh64_skip_prologue): Likewise. * sh-tdep.c (sh_skip_prologue): Likewise. * sparc64-tdep.c (sparc64_skip_prologue): Likewise. * sparc-tdep.c (sparc32_skip_prologue): Likewise. * spu-tdep.c (spu_skip_prologue): Likewise. * v850-tdep.c (v850_skip_prologue): Likewise. * vax-tdep.c (vax_skip_prologue): Likewise. * xstormy16-tdep.c (xstormy16_skip_prologue): Likewise. * xtensa-tdep.c (xtensa_skip_prologue): Likewise. * arm-tdep.c (arm_skip_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_skip_prologue): Likewise. * s390-tdep.c (s390_skip_prologue): Likewise.
2008-01-11 14:20:02 +01:00
avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
{
CORE_ADDR func_addr, func_end;
CORE_ADDR prologue_end = pc;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* See what the symbol table says */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
struct symtab_and_line sal;
struct avr_unwind_cache info = {0};
struct trad_frame_saved_reg saved_regs[AVR_NUM_REGS];
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info.saved_regs = saved_regs;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Need to run the prologue scanner to figure out if the function has a
prologue and possibly skip over moving arguments passed via registers
to other registers. */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
prologue_end = avr_scan_prologue (pc, &info);
if (info.prologue_type == AVR_PROLOGUE_NONE)
return pc;
else
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
{
sal = find_pc_line (func_addr, 0);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (sal.line != 0 && sal.end < func_end)
return sal.end;
}
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Either we didn't find the start of this function (nothing we can do),
or there's no line info, or the line after the prologue is after
the end of the function (there probably isn't a prologue). */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
return prologue_end;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Not all avr devices support the BREAK insn. Those that don't should treat
it as a NOP. Thus, it should be ok. Since the avr is currently a remote
only target, this shouldn't be a problem (I hope). TRoth/2003-05-14 */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static const unsigned char *
2007-11-07 07:33:01 +01:00
avr_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR * pcptr, int *lenptr)
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
{
static unsigned char avr_break_insn [] = { 0x98, 0x95 };
*lenptr = sizeof (avr_break_insn);
return avr_break_insn;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Given a return value in `regbuf' with a type `valtype',
extract and copy its value into `valbuf'.
Return values are always passed via registers r25:r24:... */
static void
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
avr_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
ULONGEST r24, r25;
ULONGEST c;
int len;
if (TYPE_LENGTH (type) == 1)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
regcache_cooked_read_unsigned (regcache, 24, &c);
store_unsigned_integer (valbuf, 1, c);
}
else
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
int i;
/* The MSB of the return value is always in r25, calculate which
register holds the LSB. */
int lsb_reg = 25 - TYPE_LENGTH (type) + 1;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
for (i=0; i< TYPE_LENGTH (type); i++)
{
regcache_cooked_read (regcache, lsb_reg + i,
(bfd_byte *) valbuf + i);
}
}
}
/* Determine, for architecture GDBARCH, how a return value of TYPE
should be returned. If it is supposed to be returned in registers,
and READBUF is non-zero, read the appropriate value from REGCACHE,
and copy it into READBUF. If WRITEBUF is non-zero, write the value
from WRITEBUF into REGCACHE. */
Silence a few -Wmissing-prototypes warnings. PR build/9877: * alpha-linux-tdep.c (alpha_linux_regset_from_core_section): Make it static. * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Declare. * amd64fbsd-tdep.c (amd64fbsd_init_abi): Make it static. * amd64nbsd-tdep.c (_initialize_amd64nbsd_ndep): Rename to ... (_initialize_amd64nbsd_tdep): ... this. * arm-linux-tdep.c (arm_linux_software_single_step): Make it static. (_initialize_arm_linux_tdep): Declare. * armbsd-tdep.c (armbsd_fpreg_offset): Make it static. * armnbsd-tdep.c (_initialize_arm_netbsd_tdep): Declare. * armobsd-tdep.c (_initialize_armobsd_tdep): Declare. * avr-tdep.c (avr_return_value): Make it static. (avr_frame_unwind_cache): Ditto. * bsd-uthread.c (bsd_uthread_inferior_created): Ditto. (bsd_uthread_solib_loaded): Ditto. (bsd_uthread_solib_unloaded): Ditto. (bsd_uthread_target): Ditto. (_initialize_bsd_uthread): Declare. * cris-tdep.c (crisv32_single_step_through_delay): Make it static. (cris_frame_unwind_cache): Ditto. * frv-tdep.c (frv_return_value): Ditto. * h8300-tdep.c (h8300_use_struct_convention): Ditto. (h8300h_use_struct_convention): Ditto. * hppa-tdep.c (hppa_sign_extend, hppa_low_hppa_sign_extend): Ditto. * hppa-tdep.h (hppa_low_sign_extend, hppa_sign_extend): Delete declarations. * hppabsd-tdep.c: Include hppabsd-tdep.h. (hppabsd_find_global_pointer): Make it static. * hppabsd-tdep.h: New. * hppanbsd-tdep.c: Include hppabsd-tdep.h. (hppabsd_init_abi): Remove declaration. (_initialize_hppabsd_tdep): Remove declaration. (_initialize_hppanbsd_tdep): Declare. * hppaobsd-tdep.c: Include hppabsd-tdep.h. (hppabsd_init_abi): Delete declaration. (hppaobsd_init_abi): Make it static. * i386-nto-tdep.c (_initialize_i386nto_tdep): Declare. * i386nbsd-tdep.c (_initialize_i386nbsd_tdep): Declare. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Declare. * ia64-tdep.c (ia64_register_reggroup_p): Make it static. * iq2000-tdep.c (_initialize_iq2000_tdep): Declare. * m32c-tdep.c (m32c_register_reggroup_p): Make it static. (m32c_analyze_prologue, m32c_virtual_frame_pointer): Ditto. (_initialize_m32c_tdep): Declare. * m32r-rom.c (_initialize_m32r_rom): Declare. * m32r-tdep.c (m32r_skip_prologue): Make it static. (m32r_return_value): Ditto. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Make it static. (m68hc11_return_value): Ditto. * m68klinux-tdep.c (_initialize_m68k_linux_tdep): Declare. * m88k-tdep.c (m88k_frame_cache): Make it static. * mep-tdep.c (mep_gdb_print_insn): Ditto. (mep_return_value): Ditto. (_initialize_mep_tdep): Declare. * mips-irix-tdep.c (_initialize_mips_irix_tdep): Declare. * mips-linux-tdep.c (supply_64bit_reg): Make it static. (mips_linux_syscall_next_pc): Ditto. (_initialize_mips_linux_tdep): Declare. * mips-tdep.c (mips_single_step_through_delay): Make it static. * mipsnbsd-tdep.c (_initialize_mipsnbsd_tdep): Declare. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Declare. * mn10300-tdep.c (_initialize_mn10300_tdep): Declare. * mt-tdep.c (_initialize_mt_tdep): Declare. * nbsd-tdep.c: Include nbsd-tdep.h. * nto-tdep.c (find_load_phdr): Make it static. (_initialize_nto_tdep): Declare. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Make it static. (_initialize_ppc_linux_tdep): Declare. * remote-m32r-sdi.c (m32r_can_use_hw_watchpoint) (m32r_insert_watchpoint, m32r_remove_watchpoint) (m32r_stopped_data_address, m32r_stopped_by_watchpoint): Make static. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Declare. * rs6000-nat.c: Include xcoffread.h. (find_toc_address): Don't extern declare get_toc_offset. Adjust to call xcoff_get_to_offset. * rs6000-tdep.c (ppc_vsx_support_p, ppc_displaced_step_fixup) (rs6000_skip_main_prologue, rs6000_in_solib_return_trampoline) (rs6000_skip_trampoline_code): Make static. * s390-tdep.c (s390_regset_from_core_section): Ditto. * sh-tdep.c (sh_register_reggroup_p): Ditto. * shnbsd-tdep.c (shnbsd_regset_from_core_section): Ditto. (_initialize_shnbsd_tdep): Declare. * solib-frv.c (displacement_from_map): Make static. (_initialize_frv_solib): Declare. * solib-irix.c (fetch_lm_info): Make static. (_initialize_irix_solib): Declare. * solib-som.c: Include solib-som.h. (som_solib_select): Line break. * sparc-tdep.c (sparc_regset_from_core_section): Make static. * sparcnbsd-tdep.c (_initialize_sparnbsd_tdep): Rename to ... (_initialize_sparcnbsd_tdep): ... this. * spu-tdep.c (spu_software_single_step): Make it static. (_initialize_spu_tdep): Declare. * vax-tdep.c (vax_frame_cache): Make it static. * xcoffread.c: Include xcoffread.h. (get_toc_offset): Rename to ... (xcoff_get_toc_offset): ... this. (_initialize_xcoffread): Declare. * xcoffread.h: New. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Declare. * xtensa-tdep.c (xtensa_skip_prologue, xtensa_derive_tdep): Make static. (_initialize_xtensa_tdep): Declare.
2009-02-22 02:02:20 +01:00
static enum return_value_convention
doc/ChangeLog: -------------- * gdb.texinfo (Set SH Calling convention): New @item. (Show SH Calling convention): Ditto. ChangeLog: ---------- * NEWS: Add information on calling convention and new SH CLI options. * sh-tdep.c (sh_cc_gcc): New static string. (sh_cc_renesas): Ditto. (sh_cc_enum): New static string array. (sh_active_calling_convention): New static string pointer denoting active user chosen ABI. (sh_is_renesas_calling_convention): New function to return function specific ABI, or user choice if necessary. (sh_use_struct_convention): Rename first argument and turn around its meaning. Check for renesas ABI and return accordingly. (sh_use_struct_convention_nofpu): New function. (sh_next_flt_argreg): Get function type as third parameter. Check for renesas ABI and choose floating registers accordingly. (sh_push_dummy_call_fpu): Check for ABI and choose argument slot and struct return slot accordingly. (sh_push_dummy_call_nofpu): Ditto. (sh_return_value_nofpu): Call sh_use_struct_convention_nofpu from here. Evaluate ABI and give to sh_use_struct_convention_nofpu. (sh_return_value_fpu): Evaluate ABI and give to sh_use_struct_convention. (show_sh_command): New function. (set_sh_command): Ditto. (_initialize_sh_tdep): Initialize `set/show sh calling-convention CLI command. * gdbarch.sh (return_value): Add func_type argument. * gdbarch.c: Regenerate. * gdbarch.h: Ditto. * eval.c (evaluate_subexp_standard): Rename local variable value_type to val_type so as not to collide with value_type function. Call using_struct_return with additional function type argument. * infcall.c (call_function_by_hand): Call using_struct_return and gdbarch_return_value with additional function type argument. * infcmd.c (print_return_value): Take addition func_type argument. Call gdbarch_return_value with additional function type argument. (finish_command_continuation): Call print_return_value with additional function type argument. (finish_command): Ditto. * sparc-tdep.c (sparc32_push_dummy_code): Call using_struct_return with additional function type argument. * stack.c (return_command): Call using_struct_return and gdbarch_return_value with additional function type argument. * value.c (using_struct_return): Take additional function type argument. * value.h (using_struct_return): Accommodate declaration. * alpha-tdep.c (alpha_return_value): Add func_type argument. * amd64-tdep.c (amd64_return_value): Ditto. * arm-tdep.c (arm_return_value): Ditto. * avr-tdep.c (avr_return_value): Ditto. * cris-tdep.c (cris_return_value): Ditto. * frv-tdep.c (frv_return_value): Ditto. * h8300-tdep.c (h8300_return_value): Ditto. (h8300h_return_value): Ditto. * hppa-tdep.c (hppa32_return_value): Ditto. (hppa64_return_value): Ditto. * i386-tdep.c (i386_return_value): Ditto. * ia64-tdep.c (ia64_return_value): Ditto. * iq2000-tdep.c (iq2000_return_value): Ditto. * m32c-tdep.c (m32c_return_value): Ditto. * m32r-tdep.c (m32r_return_value): Ditto. * m68hc11-tdep.c (m68hc11_return_value): Ditto. * m68k-tdep.c (m68k_return_value): Ditto. (m68k_svr4_return_value): Ditto. * m88k-tdep.c (m88k_return_value): Ditto. * mep-tdep.c (mep_return_value): Ditto. * mips-tdep.c (mips_eabi_return_value): Ditto. (mips_n32n64_return_value): Ditto. (mips_o32_return_value): Ditto. (mips_o64_return_value): Ditto. * mn10300-tdep.c (mn10300_return_value): Ditto. * mt-tdep.c (mt_return_value): Ditto. * ppc-linux-tdep.c (ppc_linux_return_value): Ditto. * ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Ditto. (ppc_sysv_abi_broken_return_value): Ditto. (ppc64_sysv_abi_return_value): Ditto. * ppc-tdep.h (ppc_sysv_abi_return_value): Ditto. (ppc_sysv_abi_broken_return_value): Ditto. (ppc64_sysv_abi_return_value): Ditto. * ppcnbsd-tdep.c (ppcnbsd_return_value): Ditto. * rs6000-tdep.c (rs6000_return_value): Ditto. * s390-tdep.c (s390_return_value): Ditto. * score-tdep.c (score_return_value): Ditto. * sh-tdep.c (sh_return_value_nofpu): Ditto. (sh_return_value_fpu): Ditto. * sh64-tdep.c (sh64_return_value): Ditto. * sparc-tdep.c (sparc32_return_value): Ditto. * sparc64-tdep.c (sparc64_return_value): Ditto. * spu-tdep.c (spu_return_value): Ditto. * v850-tdep.c (v850_return_value): Ditto. * vax-tdep.c (vax_return_value): Ditto. * xstormy16-tdep.c (xstormy16_return_value): Ditto. * xtensa-tdep.c (xtensa_return_value): Ditto. * gdbtypes.h (struct type): Add calling_convention member. * dwarf2read.c (read_subroutine_type): Add calling convention read from DW_AT_calling_convention attribute to function type.
2008-04-22 13:03:42 +02:00
avr_return_value (struct gdbarch *gdbarch, struct type *func_type,
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
int struct_return = ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
|| TYPE_CODE (valtype) == TYPE_CODE_UNION
|| TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
&& !(TYPE_LENGTH (valtype) == 1
|| TYPE_LENGTH (valtype) == 2
|| TYPE_LENGTH (valtype) == 4
|| TYPE_LENGTH (valtype) == 8));
if (writebuf != NULL)
{
gdb_assert (!struct_return);
error (_("Cannot store return value."));
}
if (readbuf != NULL)
{
gdb_assert (!struct_return);
avr_extract_return_value (valtype, regcache, readbuf);
}
if (struct_return)
return RETURN_VALUE_STRUCT_CONVENTION;
else
return RETURN_VALUE_REGISTER_CONVENTION;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Put here the code to store, into fi->saved_regs, the addresses of
the saved registers of frame described by FRAME_INFO. This
includes special registers such as pc and fp saved in special ways
in the stack frame. sp is even more special: the address we return
for it IS the sp for the next frame. */
Silence a few -Wmissing-prototypes warnings. PR build/9877: * alpha-linux-tdep.c (alpha_linux_regset_from_core_section): Make it static. * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Declare. * amd64fbsd-tdep.c (amd64fbsd_init_abi): Make it static. * amd64nbsd-tdep.c (_initialize_amd64nbsd_ndep): Rename to ... (_initialize_amd64nbsd_tdep): ... this. * arm-linux-tdep.c (arm_linux_software_single_step): Make it static. (_initialize_arm_linux_tdep): Declare. * armbsd-tdep.c (armbsd_fpreg_offset): Make it static. * armnbsd-tdep.c (_initialize_arm_netbsd_tdep): Declare. * armobsd-tdep.c (_initialize_armobsd_tdep): Declare. * avr-tdep.c (avr_return_value): Make it static. (avr_frame_unwind_cache): Ditto. * bsd-uthread.c (bsd_uthread_inferior_created): Ditto. (bsd_uthread_solib_loaded): Ditto. (bsd_uthread_solib_unloaded): Ditto. (bsd_uthread_target): Ditto. (_initialize_bsd_uthread): Declare. * cris-tdep.c (crisv32_single_step_through_delay): Make it static. (cris_frame_unwind_cache): Ditto. * frv-tdep.c (frv_return_value): Ditto. * h8300-tdep.c (h8300_use_struct_convention): Ditto. (h8300h_use_struct_convention): Ditto. * hppa-tdep.c (hppa_sign_extend, hppa_low_hppa_sign_extend): Ditto. * hppa-tdep.h (hppa_low_sign_extend, hppa_sign_extend): Delete declarations. * hppabsd-tdep.c: Include hppabsd-tdep.h. (hppabsd_find_global_pointer): Make it static. * hppabsd-tdep.h: New. * hppanbsd-tdep.c: Include hppabsd-tdep.h. (hppabsd_init_abi): Remove declaration. (_initialize_hppabsd_tdep): Remove declaration. (_initialize_hppanbsd_tdep): Declare. * hppaobsd-tdep.c: Include hppabsd-tdep.h. (hppabsd_init_abi): Delete declaration. (hppaobsd_init_abi): Make it static. * i386-nto-tdep.c (_initialize_i386nto_tdep): Declare. * i386nbsd-tdep.c (_initialize_i386nbsd_tdep): Declare. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Declare. * ia64-tdep.c (ia64_register_reggroup_p): Make it static. * iq2000-tdep.c (_initialize_iq2000_tdep): Declare. * m32c-tdep.c (m32c_register_reggroup_p): Make it static. (m32c_analyze_prologue, m32c_virtual_frame_pointer): Ditto. (_initialize_m32c_tdep): Declare. * m32r-rom.c (_initialize_m32r_rom): Declare. * m32r-tdep.c (m32r_skip_prologue): Make it static. (m32r_return_value): Ditto. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Make it static. (m68hc11_return_value): Ditto. * m68klinux-tdep.c (_initialize_m68k_linux_tdep): Declare. * m88k-tdep.c (m88k_frame_cache): Make it static. * mep-tdep.c (mep_gdb_print_insn): Ditto. (mep_return_value): Ditto. (_initialize_mep_tdep): Declare. * mips-irix-tdep.c (_initialize_mips_irix_tdep): Declare. * mips-linux-tdep.c (supply_64bit_reg): Make it static. (mips_linux_syscall_next_pc): Ditto. (_initialize_mips_linux_tdep): Declare. * mips-tdep.c (mips_single_step_through_delay): Make it static. * mipsnbsd-tdep.c (_initialize_mipsnbsd_tdep): Declare. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Declare. * mn10300-tdep.c (_initialize_mn10300_tdep): Declare. * mt-tdep.c (_initialize_mt_tdep): Declare. * nbsd-tdep.c: Include nbsd-tdep.h. * nto-tdep.c (find_load_phdr): Make it static. (_initialize_nto_tdep): Declare. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Make it static. (_initialize_ppc_linux_tdep): Declare. * remote-m32r-sdi.c (m32r_can_use_hw_watchpoint) (m32r_insert_watchpoint, m32r_remove_watchpoint) (m32r_stopped_data_address, m32r_stopped_by_watchpoint): Make static. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Declare. * rs6000-nat.c: Include xcoffread.h. (find_toc_address): Don't extern declare get_toc_offset. Adjust to call xcoff_get_to_offset. * rs6000-tdep.c (ppc_vsx_support_p, ppc_displaced_step_fixup) (rs6000_skip_main_prologue, rs6000_in_solib_return_trampoline) (rs6000_skip_trampoline_code): Make static. * s390-tdep.c (s390_regset_from_core_section): Ditto. * sh-tdep.c (sh_register_reggroup_p): Ditto. * shnbsd-tdep.c (shnbsd_regset_from_core_section): Ditto. (_initialize_shnbsd_tdep): Declare. * solib-frv.c (displacement_from_map): Make static. (_initialize_frv_solib): Declare. * solib-irix.c (fetch_lm_info): Make static. (_initialize_irix_solib): Declare. * solib-som.c: Include solib-som.h. (som_solib_select): Line break. * sparc-tdep.c (sparc_regset_from_core_section): Make static. * sparcnbsd-tdep.c (_initialize_sparnbsd_tdep): Rename to ... (_initialize_sparcnbsd_tdep): ... this. * spu-tdep.c (spu_software_single_step): Make it static. (_initialize_spu_tdep): Declare. * vax-tdep.c (vax_frame_cache): Make it static. * xcoffread.c: Include xcoffread.h. (get_toc_offset): Rename to ... (xcoff_get_toc_offset): ... this. (_initialize_xcoffread): Declare. * xcoffread.h: New. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Declare. * xtensa-tdep.c (xtensa_skip_prologue, xtensa_derive_tdep): Make static. (_initialize_xtensa_tdep): Declare.
2009-02-22 02:02:20 +01:00
static struct avr_unwind_cache *
avr_frame_unwind_cache (struct frame_info *this_frame,
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
void **this_prologue_cache)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
CORE_ADDR pc;
ULONGEST prev_sp;
ULONGEST this_base;
struct avr_unwind_cache *info;
int i;
if ((*this_prologue_cache))
return (*this_prologue_cache);
info = FRAME_OBSTACK_ZALLOC (struct avr_unwind_cache);
(*this_prologue_cache) = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
info->size = 0;
info->prologue_type = AVR_PROLOGUE_NONE;
pc = get_frame_func (this_frame);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if ((pc > 0) && (pc < get_frame_pc (this_frame)))
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
avr_scan_prologue (pc, info);
if ((info->prologue_type != AVR_PROLOGUE_NONE)
&& (info->prologue_type != AVR_PROLOGUE_MAIN))
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
{
ULONGEST high_base; /* High byte of FP */
/* The SP was moved to the FP. This indicates that a new frame
was created. Get THIS frame's FP value by unwinding it from
the next frame. */
this_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM);
high_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM+1);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
this_base += (high_base << 8);
/* The FP points at the last saved register. Adjust the FP back
to before the first saved register giving the SP. */
prev_sp = this_base + info->size;
}
else
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
{
/* Assume that the FP is this frame's SP but with that pushed
stack space added back. */
this_base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
prev_sp = this_base + info->size;
}
/* Add 1 here to adjust for the post-decrement nature of the push
instruction.*/
info->prev_sp = avr_make_saddr (prev_sp+1);
info->base = avr_make_saddr (this_base);
/* Adjust all the saved registers so that they contain addresses and not
offsets. */
for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++)
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
if (info->saved_regs[i].addr)
{
info->saved_regs[i].addr = (info->prev_sp - info->saved_regs[i].addr);
}
/* Except for the main and startup code, the return PC is always saved on
the stack and is at the base of the frame. */
if (info->prologue_type != AVR_PROLOGUE_MAIN)
{
info->saved_regs[AVR_PC_REGNUM].addr = info->prev_sp;
}
/* The previous frame's SP needed to be computed. Save the computed
value. */
trad_frame_set_value (info->saved_regs, AVR_SP_REGNUM, info->prev_sp+1);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
return info;
}
static CORE_ADDR
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
avr_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
ULONGEST pc;
pc = frame_unwind_register_unsigned (next_frame, AVR_PC_REGNUM);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
return avr_make_iaddr (pc);
}
static CORE_ADDR
avr_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
{
ULONGEST sp;
sp = frame_unwind_register_unsigned (next_frame, AVR_SP_REGNUM);
return avr_make_saddr (sp);
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Given a GDB frame, determine the address of the calling function's
frame. This will be used to create a new GDB frame struct. */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static void
avr_frame_this_id (struct frame_info *this_frame,
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
void **this_prologue_cache,
struct frame_id *this_id)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
struct avr_unwind_cache *info
= avr_frame_unwind_cache (this_frame, this_prologue_cache);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
CORE_ADDR base;
CORE_ADDR func;
struct frame_id id;
/* The FUNC is easy. */
func = get_frame_func (this_frame);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Hopefully the prologue analysis either correctly determined the
frame's base (which is the SP from the previous frame), or set
that base to "NULL". */
base = info->prev_sp;
if (base == 0)
return;
id = frame_id_build (base, func);
(*this_id) = id;
}
static struct value *
avr_frame_prev_register (struct frame_info *this_frame,
void **this_prologue_cache, int regnum)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
struct avr_unwind_cache *info
= avr_frame_unwind_cache (this_frame, this_prologue_cache);
if (regnum == AVR_PC_REGNUM)
{
if (trad_frame_addr_p (info->saved_regs, regnum))
{
/* Reading the return PC from the PC register is slightly
abnormal. register_size(AVR_PC_REGNUM) says it is 4 bytes,
but in reality, only two bytes (3 in upcoming mega256) are
stored on the stack.
Also, note that the value on the stack is an addr to a word
not a byte, so we will need to multiply it by two at some
point.
And to confuse matters even more, the return address stored
on the stack is in big endian byte order, even though most
everything else about the avr is little endian. Ick! */
/* FIXME: number of bytes read here will need updated for the
mega256 when it is available. */
ULONGEST pc;
unsigned char tmp;
unsigned char buf[2];
read_memory (info->saved_regs[regnum].addr, buf, 2);
/* Convert the PC read from memory as a big-endian to
little-endian order. */
tmp = buf[0];
buf[0] = buf[1];
buf[1] = tmp;
pc = (extract_unsigned_integer (buf, 2) * 2);
return frame_unwind_got_constant (this_frame, regnum, pc);
}
return frame_unwind_got_optimized (this_frame, regnum);
}
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static const struct frame_unwind avr_frame_unwind = {
NORMAL_FRAME,
avr_frame_this_id,
avr_frame_prev_register,
NULL,
default_frame_sniffer
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
};
static CORE_ADDR
avr_frame_base_address (struct frame_info *this_frame, void **this_cache)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
struct avr_unwind_cache *info
= avr_frame_unwind_cache (this_frame, this_cache);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
return info->base;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static const struct frame_base avr_frame_base = {
&avr_frame_unwind,
avr_frame_base_address,
avr_frame_base_address,
avr_frame_base_address
};
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
frame. The frame ID's base needs to match the TOS value saved by
save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static struct frame_id
avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
{
ULONGEST base;
base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM);
return frame_id_build (avr_make_saddr (base), get_frame_pc (this_frame));
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* When arguments must be pushed onto the stack, they go on in reverse
order. The below implements a FILO (stack) to do this. */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
struct stack_item
{
int len;
struct stack_item *prev;
void *data;
};
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static struct stack_item *
push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
struct stack_item *si;
si = xmalloc (sizeof (struct stack_item));
si->data = xmalloc (len);
si->len = len;
si->prev = prev;
memcpy (si->data, contents, len);
return si;
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
static struct stack_item *pop_stack_item (struct stack_item *si);
static struct stack_item *
pop_stack_item (struct stack_item *si)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
struct stack_item *dead = si;
si = si->prev;
xfree (dead->data);
xfree (dead);
return si;
}
/* Setup the function arguments for calling a function in the inferior.
On the AVR architecture, there are 18 registers (R25 to R8) which are
dedicated for passing function arguments. Up to the first 18 arguments
(depending on size) may go into these registers. The rest go on the stack.
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
All arguments are aligned to start in even-numbered registers (odd-sized
arguments, including char, have one free register above them). For example,
an int in arg1 and a char in arg2 would be passed as such:
arg1 -> r25:r24
arg2 -> r22
Arguments that are larger than 2 bytes will be split between two or more
registers as available, but will NOT be split between a register and the
stack. Arguments that go onto the stack are pushed last arg first (this is
similar to the d10v). */
/* NOTE: TRoth/2003-06-17: The rest of this comment is old looks to be
inaccurate.
An exceptional case exists for struct arguments (and possibly other
aggregates such as arrays) -- if the size is larger than WORDSIZE bytes but
not a multiple of WORDSIZE bytes. In this case the argument is never split
between the registers and the stack, but instead is copied in its entirety
onto the stack, AND also copied into as many registers as there is room
for. In other words, space in registers permitting, two copies of the same
argument are passed in. As far as I can tell, only the one on the stack is
used, although that may be a function of the level of compiler
optimization. I suspect this is a compiler bug. Arguments of these odd
sizes are left-justified within the word (as opposed to arguments smaller
than WORDSIZE bytes, which are right-justified).
If the function is to return an aggregate type such as a struct, the caller
must allocate space into which the callee will copy the return value. In
this case, a pointer to the return value location is passed into the callee
in register R0, which displaces one of the other arguments passed in via
registers R0 to R2. */
static CORE_ADDR
2004-06-06 Randolph Chung <tausq@debian.org> * gdbarch.sh (PUSH_DUMMY_CALL): Change CORE_ADDR func_addr argument to struct value *function. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * infcall.c (call_function_by_hand): Pass entire function value to push_dummy_call. * Makefile.in (alpha-tdep.o, frv-tdep.o, ia64-tdep.o, mips-tdep.o) (ppc-sysv-tdep.o, rs6000-tdep.o): Update dependencies. * alpha-tdep.c (alpha_push_dummy_call): Update call signature. * amd64-tdep.c (amd64_push_dummy_call): Likewise. * arm-tdep.c (arm_push_dummy_call): Likewise. * avr-tdep.c (avr_push_dummy_call): Likewise. * cris-tdep.c (cris_push_dummy_call): Likewise. * d10v-tdep.c (d10v_push_dummy_call): Likewise. * frv-tdep.c (frv_push_dummy_call): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (hppa32_push_dummy_call) (hppa64_push_dummy_call): Likewise. * i386-tdep.c (i386_push_dummy_call): Likewise. * ia64-tdep.c (ia64_push_dummy_call): Likewise. * m32r-tdep.c (m32r_push_dummy_call): Likewise. * m68hc11-tdep.c (m68hc11_push_dummy_call): Likewise. * m68k-tdep.c (m68k_push_dummy_call): Likewise. * m88k-tdep.c (m88k_push_dummy_call): Likewise. * mips-tdep.c (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_o32_push_dummy_call, mips_o64_push_dummy_call): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call) (ppc64_sysv_abi_push_dummy_call): Likewise. * ppc-tdep.h (ppc_sysv_abi_push_dummy_call) (ppc64_sysv_abi_push_dummy_call): Likewise. * rs6000-tdep.c (rs6000_push_dummy_call): Likewise. * s390-tdep.c (s390_push_dummy_call): Likewise. * sh-tdep.c (sh_push_dummy_call_fpu) (sh_push_dummy_call_nofpu): Likewise. * sparc-tdep.c (sparc32_push_dummy_call): Likewise. * sparc64-tdep.c (sparc64_push_dummy_call): Likewise. * vax-tdep.c (vax_push_dummy_call): Likewise.
2004-06-07 04:02:55 +02:00
avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
struct regcache *regcache, CORE_ADDR bp_addr,
int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
int i;
unsigned char buf[2];
CORE_ADDR return_pc = avr_convert_iaddr_to_raw (bp_addr);
int regnum = AVR_ARGN_REGNUM;
struct stack_item *si = NULL;
#if 0
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* FIXME: TRoth/2003-06-18: Not sure what to do when returning a struct. */
if (struct_return)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
fprintf_unfiltered (gdb_stderr, "struct_return: 0x%lx\n", struct_addr);
* arm-tdep.c (arm_print_float_info): Use register value from FRAME instead of calling read_register. * avr-tdep.c (avr_push_dummy_call): Write to REGCACHE instead of calling write_register. * hppa-tdep.c (hppa32_push_dummy_call): Write to REGCACHE instead of calling write_register. * ia64-tdep.c (find_func_descr): Add REGCACHE parameter. Use it instead of calling read_register. (ia64_push_dummy_call): Update call to find_func_descr. Use REGCACHE instead of calling read_register and write_register. * m32r-tdep.c (m32r_linux_supply_gregset): Use REGCACHE parameter instead of current_regcache. * mn10300-tdep.c (mn10300_push_dummy_call): Write to REGCACHE instead of calling write_register. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Use REGCACHE parameter instead of current_regcache. * mips-tdep.c (mips2_fp_compat): Add FRAME parameter. Use it instead of calling read_register. (mips_read_fp_register_double, mips_print_fp_register): Update calls. (mips_eabi_push_dummy_call): Use REGCACHE instead of write_register. (mips_n32n64_push_dummy_call): Likewise. (mips_o32_push_dummy_call): Likewise. (mips_o64_push_dummy_call): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Use REGCACHE parameter instead of current_regcache. * xtensa-tdep.c (xtensa_register_write_masked): Add REGCACHE parameter. Use it instead of read_register and write_register. (xtensa_register_read_masked): Likewise. (xtensa_pseudo_register_read): Update call. (xtensa_pseudo_register_write): Likewise. (xtensa_frame_cache): Use register values unwound from NEXT_FRAME instead of calling read_register. (xtensa_push_dummy_call): Update comment.
2007-06-16 00:34:13 +02:00
regcache_cooked_write_unsigned (regcache, argreg--, struct_addr & 0xff);
regcache_cooked_write_unsigned (regcache, argreg--, (struct_addr >>8) & 0xff);
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
#endif
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
for (i = 0; i < nargs; i++)
{
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
int last_regnum;
int j;
struct value *arg = args[i];
struct type *type = check_typedef (value_type (arg));
const bfd_byte *contents = value_contents (arg);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
int len = TYPE_LENGTH (type);
/* Calculate the potential last register needed. */
last_regnum = regnum - (len + (len & 1));
/* If there are registers available, use them. Once we start putting
stuff on the stack, all subsequent args go on stack. */
if ((si == NULL) && (last_regnum >= 8))
{
ULONGEST val;
/* Skip a register for odd length args. */
if (len & 1)
regnum--;
val = extract_unsigned_integer (contents, len);
for (j=0; j<len; j++)
{
regcache_cooked_write_unsigned (regcache, regnum--,
val >> (8*(len-j-1)));
}
}
/* No registers available, push the args onto the stack. */
else
{
/* From here on, we don't care about regnum. */
si = push_stack_item (si, contents, len);
}
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Push args onto the stack. */
while (si)
{
sp -= si->len;
/* Add 1 to sp here to account for post decr nature of pushes. */
write_memory (sp+1, si->data, si->len);
si = pop_stack_item (si);
}
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Set the return address. For the avr, the return address is the BP_ADDR.
Need to push the return address onto the stack noting that it needs to be
in big-endian order on the stack. */
buf[0] = (return_pc >> 8) & 0xff;
buf[1] = return_pc & 0xff;
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
sp -= 2;
write_memory (sp+1, buf, 2); /* Add one since pushes are post decr ops. */
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
/* Finally, update the SP register. */
regcache_cooked_write_unsigned (regcache, AVR_SP_REGNUM,
avr_convert_saddr_to_raw (sp));
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
return sp;
}
/* Initialize the gdbarch structure for the AVR's. */
static struct gdbarch *
avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch *gdbarch;
struct gdbarch_tdep *tdep;
/* Find a candidate among the list of pre-declared architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
if (arches != NULL)
return arches->gdbarch;
/* None found, create a new architecture from the information provided. */
tdep = XMALLOC (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
/* If we ever need to differentiate the device types, do it here. */
switch (info.bfd_arch_info->mach)
{
case bfd_mach_avr1:
case bfd_mach_avr2:
case bfd_mach_avr3:
case bfd_mach_avr4:
case bfd_mach_avr5:
break;
}
set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
set_gdbarch_addr_bit (gdbarch, 32);
set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
set_gdbarch_long_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
* doublest.c (floatformat_from_length): Use the right element from gdbarch floatformats. (floatformat_from_type, extract_typed_floating) (store_typed_floating): Likewise. * doublest.h: Remove declarations for undefined floatformat arrays. * gdbarch.sh (float_format, double_format, long_double_format): Change to pairs. (pformat): Update for pairs. * gdbarch.c, gdbarch.h: Regenerated. * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double) (floatformats_ieee_double_littlebyte_bigword) (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext) (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f) (floatformats_vax_d): New variables. (builtin_type_ieee_single, builtin_type_ieee_double) (builtin_type_arm_ext, builtin_type_ia64_spill) (builtin_type_ia64_quad): Replace arrays with individual types. (builtin_type_ieee_single_big, builtin_type_ieee_single_little) (builtin_type_ieee_double_big, builtin_type_ieee_double_little) (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext) (builtin_type_m88110_ext, builtin_type_m88110_harris_ext) (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword) (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little) (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete unused and endian-specific types. (recursive_dump_type): Update for floatformat pairs. (build_flt): Move higher. Handle bit == -1. Take a floatformat pair. (build_gdbtypes): Use build_flt. (_initialize_gdbtypes): Update set of initialized types. * gdbtypes.h: Update declarations to match gdbtypes.c. (struct main_type): Store a pointer to two floatformats. * arch-utils.c (default_float_format, default_double_format): Delete. * arch-utils.h (default_float_format, default_double_format): Delete. * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c, ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c, sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c, vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
set_gdbarch_double_format (gdbarch, floatformats_ieee_single);
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_single);
set_gdbarch_read_pc (gdbarch, avr_read_pc);
set_gdbarch_write_pc (gdbarch, avr_write_pc);
set_gdbarch_num_regs (gdbarch, AVR_NUM_REGS);
set_gdbarch_sp_regnum (gdbarch, AVR_SP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, AVR_PC_REGNUM);
set_gdbarch_register_name (gdbarch, avr_register_name);
set_gdbarch_register_type (gdbarch, avr_register_type);
set_gdbarch_return_value (gdbarch, avr_return_value);
set_gdbarch_print_insn (gdbarch, print_insn_avr);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
set_gdbarch_push_dummy_call (gdbarch, avr_push_dummy_call);
set_gdbarch_address_to_pointer (gdbarch, avr_address_to_pointer);
set_gdbarch_pointer_to_address (gdbarch, avr_pointer_to_address);
set_gdbarch_skip_prologue (gdbarch, avr_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc);
frame_unwind_append_unwinder (gdbarch, &avr_frame_unwind);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
frame_base_set_default (gdbarch, &avr_frame_base);
set_gdbarch_dummy_id (gdbarch, avr_dummy_id);
* avr-tdep.c: Include frame.h, frame-unwind.h, frame-base.h, and trad-frame.h. (AVR_MAX_PROLOGUE_SIZE): Increase from 56 to 64. (AVR_ARG1_REGNUM, AVR_ARGN_REGNUM): Define. (AVR_RET1_REGNUM, AVR_RETN_REGNUM): Define. (AVR_PROLOGUE_*): Enumerate prologue types. (struct frame_extra_info): Remove. (struct avr_unwind_cache): Define. (avr_write_sp): Delete function. (avr_read_fp): Ditto. (avr_init_extra_frame_info): Ditto. (avr_pop_frame): Ditto. (avr_frame_saved_pc): Ditto. (avr_saved_pc_after_call): Ditto. (avr_push_return_address): Ditto. (avr_frame_chain): Ditto. (avr_store_struct_return): Ditto. (avr_push_arguments): Ditto. (avr_scan_prologue): Update comments. Changed to set up the info for cache unwinding. Now returns end of prologue PC. (avr_skip_prologue): Better handling of functions lacking a prologue by using avr_scan_prologue. (avr_scan_arg_moves): New function. (avr_saved_regs_unwinder): Ditto. (avr_frame_unwind_cache): Ditto. (avr_unwind_pc): Ditto. (avr_frame_this_id): Ditto. (avr_frame_prev_register): Ditto. (avr_frame_p): Ditto. (avr_frame_base_address ): Ditto. (avr_unwind_dummy_id): Ditto. (avr_push_dummy_code): Ditto. (push_stack_item): Ditto. (pop_stack_item): Ditto. (avr_push_dummy_call): Ditto. (struct stack_item): Define. (avr_frame_unwind): Declare structure. (avr_frame_base): Ditto. (avr_gdbarch_init): Remove calls to set_gdbarch_deprecated_init_frame_pc, set_gdbarch_deprecated_target_read_fp, set_gdbarch_deprecated_dummy_write_sp, set_gdbarch_deprecated_fp_regnum, set_gdbarch_deprecated_push_arguments, set_gdbarch_deprecated_push_return_address, set_gdbarch_deprecated_pop_frame, set_gdbarch_deprecated_store_struct_return, set_gdbarch_deprecated_frame_init_saved_regs, set_gdbarch_deprecated_init_extra_frame_info, set_gdbarch_deprecated_frame_chain, set_gdbarch_deprecated_frame_saved_pc, set_gdbarch_deprecated_saved_pc_after_call. Add calls to set_gdbarch_push_dummy_call, set_gdbarch_push_dummy_code, frame_unwind_append_predicate, frame_base_set_default, set_gdbarch_unwind_dummy_id, set_gdbarch_unwind_pc. Wrap a long line.
2003-06-19 10:09:54 +02:00
set_gdbarch_unwind_pc (gdbarch, avr_unwind_pc);
set_gdbarch_unwind_sp (gdbarch, avr_unwind_sp);
return gdbarch;
}
/* Send a query request to the avr remote target asking for values of the io
registers. If args parameter is not NULL, then the user has requested info
on a specific io register [This still needs implemented and is ignored for
now]. The query string should be one of these forms:
"Ravr.io_reg" -> reply is "NN" number of io registers
"Ravr.io_reg:addr,len" where addr is first register and len is number of
registers to be read. The reply should be "<NAME>,VV;" for each io register
where, <NAME> is a string, and VV is the hex value of the register.
All io registers are 8-bit. */
static void
avr_io_reg_read_command (char *args, int from_tty)
{
LONGEST bufsiz = 0;
gdb_byte *buf;
char query[400];
char *p;
unsigned int nreg = 0;
unsigned int val;
int i, j, k, step;
/* Find out how many io registers the target has. */
bufsiz = target_read_alloc (&current_target, TARGET_OBJECT_AVR,
"avr.io_reg", &buf);
if (bufsiz <= 0)
{
fprintf_unfiltered (gdb_stderr,
_("ERR: info io_registers NOT supported "
"by current target\n"));
return;
}
if (sscanf (buf, "%x", &nreg) != 1)
{
fprintf_unfiltered (gdb_stderr,
_("Error fetching number of io registers\n"));
xfree (buf);
return;
}
xfree (buf);
reinitialize_more_filter ();
printf_unfiltered (_("Target has %u io registers:\n\n"), nreg);
/* only fetch up to 8 registers at a time to keep the buffer small */
step = 8;
for (i = 0; i < nreg; i += step)
{
/* how many registers this round? */
j = step;
if ((i+j) >= nreg)
j = nreg - i; /* last block is less than 8 registers */
snprintf (query, sizeof (query) - 1, "avr.io_reg:%x,%x", i, j);
bufsiz = target_read_alloc (&current_target, TARGET_OBJECT_AVR,
query, &buf);
p = buf;
for (k = i; k < (i + j); k++)
{
if (sscanf (p, "%[^,],%x;", query, &val) == 2)
{
printf_filtered ("[%02x] %-15s : %02x\n", k, query, val);
while ((*p != ';') && (*p != '\0'))
p++;
p++; /* skip over ';' */
if (*p == '\0')
break;
}
}
xfree (buf);
}
}
2003-06-11 Andrew Cagney <cagney@redhat.com> * xstormy16-tdep.c (xstormy16_push_return_address): Make static. (xstormy16_save_dummy_frame_tos): Make static. (_initialize_xstormy16_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * v850-tdep.c: Make local functions static. (_initialize_v850_tdep): Add declaration. * sparc-tdep.c: Make local functions static. (_initialize_sparc_tdep): Add declaration. * sh-tdep.c: Make local functions static. (_initialize_sh_tdep): Add declaration. * sh3-rom.c (_initialize_sh3_rom): Add declaration. * s390-tdep.c: Make local functions static. (_initialize_s390_tdep): Add declaration. * dbxread.c (find_stab_function_addr): Make static. * ppc-bdm.c (_initialize_bdm_ppc): Add declaration. * ocd.c (_initialize_remote_ocd): Add declaration. * dink32-rom.c (_initialize_dink32_rom): Add declaration. * ppcbug-rom.c (_initialize_ppcbug_rom): Add declaration. * ns32k-tdep.c (_initialize_ns32k_tdep): Add declaration. * ns32knbsd-tdep.c (_initialize_ns32knbsd_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * remote-array.c (_initialize_array): Add declaration. (_initialize_remote_monitors): Add declaration. * remote-mips.c: Make local functions static. (_initialize_remote_mips): Add declaration. * mcore-tdep.c: Make all local functions static. (_initialize_mcore_tdep): Add declaration. * dbug-rom.c (_initialize_dbug_rom): Add declaration. * abug-rom.c (_initialize_abug_rom): Add declaration. * rom68k-rom.c (_initialize_rom68k): Add declaration. * cpu32bug-rom.c (_initialize_cpu32bug_rom): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * remote-est.c (_initialize_est): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. (m68hc11_call_dummy_address): Make static. * ia64-tdep.c: Make local functions static. (_initialize_ia64_tdep): Add declaration. * solib-legacy.c (_initialize_svr4_lm): Add declaration. * monitor.c (monitor_wait_filter): Make static. (_initialize_remote_monitors): Add declaration. * remote-hms.c (_initialize_remote_hms): Add declaration. * remote-e7000.c (fetch_regs_from_dump): Make static. (expect_n): Make static. (_initialize_remote_e7000): Add declaration. * ser-e7kpc.c: Always include "defs.h". (_initialize_ser_e7000pc): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * cris-tdep.c: Make all but one function static. (_initialize_cris_tdep): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib.c (update_solib_list): Make static. (_initialize_solib): Add declaration. * avr-tdep.c (avr_breakpoint_from_pc): Make static. (_initialize_avr_tdep): Add declaration. * remote-rdi.c (voiddummy): Make static. (_initialize_remote_rdi): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * remote-rdp.c (send_rdp): Make static. (_initialize_remote_rdp): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration.
2003-06-11 15:16:30 +02:00
extern initialize_file_ftype _initialize_avr_tdep; /* -Wmissing-prototypes */
void
_initialize_avr_tdep (void)
{
register_gdbarch_init (bfd_arch_avr, avr_gdbarch_init);
/* Add a new command to allow the user to query the avr remote target for
the values of the io space registers in a saner way than just using
`x/NNNb ADDR`. */
/* FIXME: TRoth/2002-02-18: This should probably be changed to 'info avr
io_registers' to signify it is not available on other platforms. */
add_cmd ("io_registers", class_info, avr_io_reg_read_command,
_("query remote avr target for io space register values"),
&infolist);
}