diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-07-14 00:15:20 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-07-14 00:15:20 +0000 |
commit | 3fbeef0be80152e38e0b6966805f1dfc5c26df74 (patch) | |
tree | 40301ef32a7438c2bd037f05db12d278993e793b /gdb | |
parent | f971e29ff187b5c6efab9521e539801da35733e3 (diff) | |
download | gdb-3fbeef0be80152e38e0b6966805f1dfc5c26df74.zip gdb-3fbeef0be80152e38e0b6966805f1dfc5c26df74.tar.gz gdb-3fbeef0be80152e38e0b6966805f1dfc5c26df74.tar.bz2 |
Obsolete the d30v.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/MAINTAINERS | 4 | ||||
-rw-r--r-- | gdb/config/d30v/d30v.mt | 10 | ||||
-rw-r--r-- | gdb/config/d30v/tm-d30v.h | 646 | ||||
-rw-r--r-- | gdb/configure.tgt | 2 | ||||
-rw-r--r-- | gdb/d30v-tdep.c | 2730 |
6 files changed, 1703 insertions, 1697 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dda63f5..bd5b860 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2002-07-13 Andrew Cagney <ac131313@redhat.com> + + * MAINTAINERS: Note that d30v / d30v-elf has been made obsolete. + * configure.tgt: Mark d30v-*-* as obsolete. + * d30v-tdep.c: Mark file as obsolete. + * config/d30v/d30v.mt: Ditto. + * config/d30v/tm-d30v.h: Ditto. + 2002-07-13 Aidan Skinner <aidan@velvet.net> * ada-tasks.c (add_task_entry): replace calls to diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index f2e4485..a6582a2 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -78,9 +78,7 @@ maintainer works with the native maintainer when resolving API issues. d10v --target=d10v-elf ,-Werror Maintenance only - d30v --target=d30v-elf ,-Werror - Maintenance only - OBSOLETE candidate, not multi-arch + d30v (--target=d30v-elf OBSOLETE) djgpp --target=i586-pc-msdosdjgpp ,-Werror (See native and host) diff --git a/gdb/config/d30v/d30v.mt b/gdb/config/d30v/d30v.mt index da0af2f..49bd83b 100644 --- a/gdb/config/d30v/d30v.mt +++ b/gdb/config/d30v/d30v.mt @@ -1,5 +1,5 @@ -# Target: Mitsubishi D30V processor -TDEPFILES= d30v-tdep.o -TM_FILE= tm-d30v.h -SIM_OBS= remote-sim.o -SIM= ../sim/d30v/libsim.a +# OBSOLETE # Target: Mitsubishi D30V processor +# OBSOLETE TDEPFILES= d30v-tdep.o +# OBSOLETE TM_FILE= tm-d30v.h +# OBSOLETE SIM_OBS= remote-sim.o +# OBSOLETE SIM= ../sim/d30v/libsim.a diff --git a/gdb/config/d30v/tm-d30v.h b/gdb/config/d30v/tm-d30v.h index e233630..3e1ea3f 100644 --- a/gdb/config/d30v/tm-d30v.h +++ b/gdb/config/d30v/tm-d30v.h @@ -1,323 +1,323 @@ -/* Target-specific definition for the Mitsubishi D30V - Copyright 1997, 1998, 1999, 2000 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 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef TM_D30V_H -#define TM_D30V_H - -#include "regcache.h" - -/* Offset from address of function to start of its code. - Zero on most machines. */ - -#define FUNCTION_START_OFFSET 0 - -/* these are the addresses the D30V-EVA board maps data */ -/* and instruction memory to. */ - -#define DMEM_START 0x20000000 -#define IMEM_START 0x00000000 /* was 0x10000000 */ -#define STACK_START 0x20007ffe - -/* Forward decls for prototypes */ -struct frame_info; -struct frame_saved_regs; -struct type; -struct value; - -/* Advance PC across any function entry prologue instructions - to reach some "real" code. */ - -extern CORE_ADDR d30v_skip_prologue (CORE_ADDR); -#define SKIP_PROLOGUE(ip) (d30v_skip_prologue (ip)) - - -/* Stack grows downward. */ -#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) - -/* for a breakpoint, use "dbt || nop" */ -#define BREAKPOINT {0x00, 0xb0, 0x00, 0x00,\ - 0x00, 0xf0, 0x00, 0x00} - -/* If your kernel resets the pc after the trap happens you may need to - define this before including this file. */ -#define DECR_PC_AFTER_BREAK 0 - -#define 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", \ - "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", \ - "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", \ - "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", \ - "r56", "r57", "r58", "r59", "r60", "r61", "r62", "r63", \ - "spi", "spu", \ - "psw", "bpsw", "pc", "bpc", "dpsw", "dpc", "cr6", "rpt_c", \ - "rpt_s", "rpt_e", "mod_s", "mod_e", "cr12", "cr13", "iba", "eit_vb",\ - "int_s", "int_m", "a0", "a1" \ - } - -#define NUM_REGS 86 - -/* Register numbers of various important registers. - Note that some of these values are "real" register numbers, - and correspond to the general registers of the machine, - and some are "phony" register numbers which are too large - to be actual register numbers as far as the user is concerned - but do serve to get the desired values when passed to read_register. */ - -#define R0_REGNUM 0 -#define FP_REGNUM 61 -#define LR_REGNUM 62 -#define SP_REGNUM 63 -#define SPI_REGNUM 64 /* Interrupt stack pointer */ -#define SPU_REGNUM 65 /* User stack pointer */ -#define CREGS_START 66 - -#define PSW_REGNUM (CREGS_START + 0) /* psw, bpsw, or dpsw??? */ -#define PSW_SM (((unsigned long)0x80000000) >> 0) /* Stack mode: 0/SPI */ - /* 1/SPU */ -#define PSW_EA (((unsigned long)0x80000000) >> 2) /* Execution status */ -#define PSW_DB (((unsigned long)0x80000000) >> 3) /* Debug mode */ -#define PSW_DS (((unsigned long)0x80000000) >> 4) /* Debug EIT status */ -#define PSW_IE (((unsigned long)0x80000000) >> 5) /* Interrupt enable */ -#define PSW_RP (((unsigned long)0x80000000) >> 6) /* Repeat enable */ -#define PSW_MD (((unsigned long)0x80000000) >> 7) /* Modulo enable */ -#define PSW_F0 (((unsigned long)0x80000000) >> 17) /* F0 flag */ -#define PSW_F1 (((unsigned long)0x80000000) >> 19) /* F1 flag */ -#define PSW_F2 (((unsigned long)0x80000000) >> 21) /* F2 flag */ -#define PSW_F3 (((unsigned long)0x80000000) >> 23) /* F3 flag */ -#define PSW_S (((unsigned long)0x80000000) >> 25) /* Saturation flag */ -#define PSW_V (((unsigned long)0x80000000) >> 27) /* Overflow flag */ -#define PSW_VA (((unsigned long)0x80000000) >> 29) /* Accum. overflow */ -#define PSW_C (((unsigned long)0x80000000) >> 31) /* Carry/Borrow flag */ - -#define BPSW_REGNUM (CREGS_START + 1) /* Backup PSW (on interrupt) */ -#define PC_REGNUM (CREGS_START + 2) /* pc, bpc, or dpc??? */ -#define BPC_REGNUM (CREGS_START + 3) /* Backup PC (on interrupt) */ -#define DPSW_REGNUM (CREGS_START + 4) /* Backup PSW (on debug trap) */ -#define DPC_REGNUM (CREGS_START + 5) /* Backup PC (on debug trap) */ -#define RPT_C_REGNUM (CREGS_START + 7) /* Loop count */ -#define RPT_S_REGNUM (CREGS_START + 8) /* Loop start address */ -#define RPT_E_REGNUM (CREGS_START + 9) /* Loop end address */ -#define MOD_S_REGNUM (CREGS_START + 10) -#define MOD_E_REGNUM (CREGS_START + 11) -#define IBA_REGNUM (CREGS_START + 14) /* Instruction break address */ -#define EIT_VB_REGNUM (CREGS_START + 15) /* Vector base address */ -#define INT_S_REGNUM (CREGS_START + 16) /* Interrupt status */ -#define INT_M_REGNUM (CREGS_START + 17) /* Interrupt mask */ -#define A0_REGNUM 84 -#define A1_REGNUM 85 - -/* Say how much memory is needed to store a copy of the register set */ -#define REGISTER_BYTES ((NUM_REGS - 2) * 4 + 2 * 8) - -/* Index within `registers' of the first byte of the space for - register N. */ - -#define REGISTER_BYTE(N) \ -( ((N) >= A0_REGNUM) ? ( ((N) - A0_REGNUM) * 8 + A0_REGNUM * 4 ) : ((N) * 4) ) - -/* Number of bytes of storage in the actual machine representation - for register N. */ - -#define REGISTER_RAW_SIZE(N) ( ((N) >= A0_REGNUM) ? 8 : 4 ) - -/* Number of bytes of storage in the program's representation - for register N. */ -#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) - -/* Largest value REGISTER_RAW_SIZE can have. */ - -#define MAX_REGISTER_RAW_SIZE 8 - -/* Largest value REGISTER_VIRTUAL_SIZE can have. */ - -#define MAX_REGISTER_VIRTUAL_SIZE 8 - -/* Return the GDB type object for the "standard" data type - of data in register N. */ - -#define REGISTER_VIRTUAL_TYPE(N) \ -( ((N) < A0_REGNUM ) ? builtin_type_long : builtin_type_long_long) - -/* Writing to r0 is a noop (not an error or exception or anything like - that, however). */ - -#define CANNOT_STORE_REGISTER(regno) ((regno) == R0_REGNUM) - -void d30v_do_registers_info (int regnum, int fpregs); - -#define DO_REGISTERS_INFO d30v_do_registers_info - -/* Store the address of the place in which to copy the structure the - subroutine will return. This is called from call_function. - - We store structs through a pointer passed in R2 */ - -#define STORE_STRUCT_RETURN(ADDR, SP) \ - { write_register (2, (ADDR)); } - - -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. - - Things always get returned in R2/R3 */ - -#define STORE_RETURN_VALUE(TYPE,VALBUF) \ - write_register_bytes (REGISTER_BYTE(2), VALBUF, TYPE_LENGTH (TYPE)) - - -/* Extract from an array REGBUF containing the (raw) register state - the address in which a function should return its structure value, - as a CORE_ADDR (or an expression that can be used as one). */ -#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (((CORE_ADDR *)(REGBUF))[2]) - - -/* Define other aspects of the stack frame. - we keep a copy of the worked out return pc lying around, since it - is a useful bit of info */ - -#define EXTRA_FRAME_INFO \ - CORE_ADDR return_pc; \ - CORE_ADDR dummy; \ - int frameless; \ - int size; - -#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \ - d30v_init_extra_frame_info(fromleaf, fi) - -extern void d30v_init_extra_frame_info (int fromleaf, struct frame_info *fi); - -/* A macro that tells us whether the function invocation represented - by FI does not have a frame on the stack associated with it. If it - does not, FRAMELESS is set to 1, else 0. */ - -#define FRAMELESS_FUNCTION_INVOCATION(FI) \ - (frameless_look_for_prologue (FI)) - -CORE_ADDR d30v_frame_chain (struct frame_info *frame); -#define FRAME_CHAIN(FRAME) d30v_frame_chain(FRAME) -extern int d30v_frame_chain_valid (CORE_ADDR, struct frame_info *); -#define FRAME_CHAIN_VALID(chain, thisframe) d30v_frame_chain_valid (chain, thisframe) -#define FRAME_SAVED_PC(FRAME) ((FRAME)->return_pc) -#define FRAME_ARGS_ADDRESS(fi) (fi)->frame -#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame - -void d30v_init_frame_pc (int fromleaf, struct frame_info *prev); -#define INIT_FRAME_PC_FIRST(fromleaf, prev) d30v_init_frame_pc(fromleaf, prev) -#define INIT_FRAME_PC(fromleaf, prev) /* nada */ - -/* Immediately after a function call, return the saved pc. We can't */ -/* use frame->return_pc beause that is determined by reading R62 off the */ -/* stack and that may not be written yet. */ - -#define SAVED_PC_AFTER_CALL(frame) (read_register(LR_REGNUM)) - -/* Set VAL to the number of args passed to frame described by FI. - Can set VAL to -1, meaning no way to tell. */ -/* We can't tell how many args there are */ - -#define FRAME_NUM_ARGS(fi) (-1) - -/* Return number of bytes at start of arglist that are not really args. */ - -#define FRAME_ARGS_SKIP 0 - - -/* Put here the code to store, into a struct frame_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. */ - -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - d30v_frame_find_saved_regs(frame_info, &(frame_saved_regs)) - -extern void d30v_frame_find_saved_regs (struct frame_info *, - struct frame_saved_regs *); - -/* DUMMY FRAMES. Need these to support inferior function calls. - They work like this on D30V: - First we set a breakpoint at 0 or __start. - Then we push all the registers onto the stack. - Then put the function arguments in the proper registers and set r13 - to our breakpoint address. - Finally call the function directly. - When it hits the breakpoint, clear the break point and pop the old - register contents off the stack. */ - -#define CALL_DUMMY { 0 } -#define PUSH_DUMMY_FRAME -#define CALL_DUMMY_START_OFFSET 0 -#define CALL_DUMMY_LOCATION AT_ENTRY_POINT -#define CALL_DUMMY_BREAKPOINT_OFFSET (0) - -extern CORE_ADDR d30v_call_dummy_address (void); -#define CALL_DUMMY_ADDRESS() d30v_call_dummy_address() - -#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ -sp = d30v_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p) - -#define PC_IN_CALL_DUMMY(pc, sp, frame_address) ( pc == IMEM_START + 4 ) - -extern CORE_ADDR d30v_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, - int, struct value **, - struct type *, int); -#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ - (d30v_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr))) -extern CORE_ADDR d30v_push_arguments (int, struct value **, CORE_ADDR, int, - CORE_ADDR); - - -/* Extract from an array REGBUF containing the (raw) register state - a function return value of type TYPE, and copy that, in virtual format, - into VALBUF. */ - -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ -d30v_extract_return_value(TYPE, REGBUF, VALBUF) -extern void d30v_extract_return_value (struct type *, char *, char *); - - -/* Discard from the stack the innermost frame, - restoring all saved registers. */ -#define POP_FRAME d30v_pop_frame(); -extern void d30v_pop_frame (void); - -#define REGISTER_SIZE 4 - -/* Need to handle SP special, as we need to select between spu and spi. */ -#if 0 /* XXX until the simulator is fixed */ -#define TARGET_READ_SP() ((read_register (PSW_REGNUM) & PSW_SM) \ - ? read_register (SPU_REGNUM) \ - : read_register (SPI_REGNUM)) - -#define TARGET_WRITE_SP(val) ((read_register (PSW_REGNUM) & PSW_SM) \ - ? write_register (SPU_REGNUM, (val)) \ - : write_register (SPI_REGNUM, (val))) -#endif - -#define STACK_ALIGN(len) (((len) + 7 ) & ~7) - -/* Turn this on to cause remote-sim.c to use sim_set/clear_breakpoint. */ - -#define SIM_HAS_BREAKPOINTS - -#endif /* TM_D30V_H */ +/* OBSOLETE /* Target-specific definition for the Mitsubishi D30V */ +/* OBSOLETE Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */ +/* OBSOLETE Boston, MA 02111-1307, USA. */ */ +/* OBSOLETE */ +/* OBSOLETE #ifndef TM_D30V_H */ +/* OBSOLETE #define TM_D30V_H */ +/* OBSOLETE */ +/* OBSOLETE #include "regcache.h" */ +/* OBSOLETE */ +/* OBSOLETE /* Offset from address of function to start of its code. */ +/* OBSOLETE Zero on most machines. */ */ +/* OBSOLETE */ +/* OBSOLETE #define FUNCTION_START_OFFSET 0 */ +/* OBSOLETE */ +/* OBSOLETE /* these are the addresses the D30V-EVA board maps data */ */ +/* OBSOLETE /* and instruction memory to. */ */ +/* OBSOLETE */ +/* OBSOLETE #define DMEM_START 0x20000000 */ +/* OBSOLETE #define IMEM_START 0x00000000 /* was 0x10000000 */ */ +/* OBSOLETE #define STACK_START 0x20007ffe */ +/* OBSOLETE */ +/* OBSOLETE /* Forward decls for prototypes */ */ +/* OBSOLETE struct frame_info; */ +/* OBSOLETE struct frame_saved_regs; */ +/* OBSOLETE struct type; */ +/* OBSOLETE struct value; */ +/* OBSOLETE */ +/* OBSOLETE /* Advance PC across any function entry prologue instructions */ +/* OBSOLETE to reach some "real" code. */ */ +/* OBSOLETE */ +/* OBSOLETE extern CORE_ADDR d30v_skip_prologue (CORE_ADDR); */ +/* OBSOLETE #define SKIP_PROLOGUE(ip) (d30v_skip_prologue (ip)) */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Stack grows downward. */ */ +/* OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) */ +/* OBSOLETE */ +/* OBSOLETE /* for a breakpoint, use "dbt || nop" */ */ +/* OBSOLETE #define BREAKPOINT {0x00, 0xb0, 0x00, 0x00,\ */ +/* OBSOLETE 0x00, 0xf0, 0x00, 0x00} */ +/* OBSOLETE */ +/* OBSOLETE /* If your kernel resets the pc after the trap happens you may need to */ +/* OBSOLETE define this before including this file. */ */ +/* OBSOLETE #define DECR_PC_AFTER_BREAK 0 */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_NAMES \ */ +/* OBSOLETE { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ */ +/* OBSOLETE "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ */ +/* OBSOLETE "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ */ +/* OBSOLETE "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \ */ +/* OBSOLETE "r32", "r33", "r34", "r35", "r36", "r37", "r38", "r39", \ */ +/* OBSOLETE "r40", "r41", "r42", "r43", "r44", "r45", "r46", "r47", \ */ +/* OBSOLETE "r48", "r49", "r50", "r51", "r52", "r53", "r54", "r55", \ */ +/* OBSOLETE "r56", "r57", "r58", "r59", "r60", "r61", "r62", "r63", \ */ +/* OBSOLETE "spi", "spu", \ */ +/* OBSOLETE "psw", "bpsw", "pc", "bpc", "dpsw", "dpc", "cr6", "rpt_c", \ */ +/* OBSOLETE "rpt_s", "rpt_e", "mod_s", "mod_e", "cr12", "cr13", "iba", "eit_vb",\ */ +/* OBSOLETE "int_s", "int_m", "a0", "a1" \ */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE #define NUM_REGS 86 */ +/* OBSOLETE */ +/* OBSOLETE /* Register numbers of various important registers. */ +/* OBSOLETE Note that some of these values are "real" register numbers, */ +/* OBSOLETE and correspond to the general registers of the machine, */ +/* OBSOLETE and some are "phony" register numbers which are too large */ +/* OBSOLETE to be actual register numbers as far as the user is concerned */ +/* OBSOLETE but do serve to get the desired values when passed to read_register. */ */ +/* OBSOLETE */ +/* OBSOLETE #define R0_REGNUM 0 */ +/* OBSOLETE #define FP_REGNUM 61 */ +/* OBSOLETE #define LR_REGNUM 62 */ +/* OBSOLETE #define SP_REGNUM 63 */ +/* OBSOLETE #define SPI_REGNUM 64 /* Interrupt stack pointer */ */ +/* OBSOLETE #define SPU_REGNUM 65 /* User stack pointer */ */ +/* OBSOLETE #define CREGS_START 66 */ +/* OBSOLETE */ +/* OBSOLETE #define PSW_REGNUM (CREGS_START + 0) /* psw, bpsw, or dpsw??? */ */ +/* OBSOLETE #define PSW_SM (((unsigned long)0x80000000) >> 0) /* Stack mode: 0/SPI */ */ +/* OBSOLETE /* 1/SPU */ */ +/* OBSOLETE #define PSW_EA (((unsigned long)0x80000000) >> 2) /* Execution status */ */ +/* OBSOLETE #define PSW_DB (((unsigned long)0x80000000) >> 3) /* Debug mode */ */ +/* OBSOLETE #define PSW_DS (((unsigned long)0x80000000) >> 4) /* Debug EIT status */ */ +/* OBSOLETE #define PSW_IE (((unsigned long)0x80000000) >> 5) /* Interrupt enable */ */ +/* OBSOLETE #define PSW_RP (((unsigned long)0x80000000) >> 6) /* Repeat enable */ */ +/* OBSOLETE #define PSW_MD (((unsigned long)0x80000000) >> 7) /* Modulo enable */ */ +/* OBSOLETE #define PSW_F0 (((unsigned long)0x80000000) >> 17) /* F0 flag */ */ +/* OBSOLETE #define PSW_F1 (((unsigned long)0x80000000) >> 19) /* F1 flag */ */ +/* OBSOLETE #define PSW_F2 (((unsigned long)0x80000000) >> 21) /* F2 flag */ */ +/* OBSOLETE #define PSW_F3 (((unsigned long)0x80000000) >> 23) /* F3 flag */ */ +/* OBSOLETE #define PSW_S (((unsigned long)0x80000000) >> 25) /* Saturation flag */ */ +/* OBSOLETE #define PSW_V (((unsigned long)0x80000000) >> 27) /* Overflow flag */ */ +/* OBSOLETE #define PSW_VA (((unsigned long)0x80000000) >> 29) /* Accum. overflow */ */ +/* OBSOLETE #define PSW_C (((unsigned long)0x80000000) >> 31) /* Carry/Borrow flag */ */ +/* OBSOLETE */ +/* OBSOLETE #define BPSW_REGNUM (CREGS_START + 1) /* Backup PSW (on interrupt) */ */ +/* OBSOLETE #define PC_REGNUM (CREGS_START + 2) /* pc, bpc, or dpc??? */ */ +/* OBSOLETE #define BPC_REGNUM (CREGS_START + 3) /* Backup PC (on interrupt) */ */ +/* OBSOLETE #define DPSW_REGNUM (CREGS_START + 4) /* Backup PSW (on debug trap) */ */ +/* OBSOLETE #define DPC_REGNUM (CREGS_START + 5) /* Backup PC (on debug trap) */ */ +/* OBSOLETE #define RPT_C_REGNUM (CREGS_START + 7) /* Loop count */ */ +/* OBSOLETE #define RPT_S_REGNUM (CREGS_START + 8) /* Loop start address */ */ +/* OBSOLETE #define RPT_E_REGNUM (CREGS_START + 9) /* Loop end address */ */ +/* OBSOLETE #define MOD_S_REGNUM (CREGS_START + 10) */ +/* OBSOLETE #define MOD_E_REGNUM (CREGS_START + 11) */ +/* OBSOLETE #define IBA_REGNUM (CREGS_START + 14) /* Instruction break address */ */ +/* OBSOLETE #define EIT_VB_REGNUM (CREGS_START + 15) /* Vector base address */ */ +/* OBSOLETE #define INT_S_REGNUM (CREGS_START + 16) /* Interrupt status */ */ +/* OBSOLETE #define INT_M_REGNUM (CREGS_START + 17) /* Interrupt mask */ */ +/* OBSOLETE #define A0_REGNUM 84 */ +/* OBSOLETE #define A1_REGNUM 85 */ +/* OBSOLETE */ +/* OBSOLETE /* Say how much memory is needed to store a copy of the register set */ */ +/* OBSOLETE #define REGISTER_BYTES ((NUM_REGS - 2) * 4 + 2 * 8) */ +/* OBSOLETE */ +/* OBSOLETE /* Index within `registers' of the first byte of the space for */ +/* OBSOLETE register N. */ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_BYTE(N) \ */ +/* OBSOLETE ( ((N) >= A0_REGNUM) ? ( ((N) - A0_REGNUM) * 8 + A0_REGNUM * 4 ) : ((N) * 4) ) */ +/* OBSOLETE */ +/* OBSOLETE /* Number of bytes of storage in the actual machine representation */ +/* OBSOLETE for register N. */ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_RAW_SIZE(N) ( ((N) >= A0_REGNUM) ? 8 : 4 ) */ +/* OBSOLETE */ +/* OBSOLETE /* Number of bytes of storage in the program's representation */ +/* OBSOLETE for register N. */ */ +/* OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N) */ +/* OBSOLETE */ +/* OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. */ */ +/* OBSOLETE */ +/* OBSOLETE #define MAX_REGISTER_RAW_SIZE 8 */ +/* OBSOLETE */ +/* OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have. */ */ +/* OBSOLETE */ +/* OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE 8 */ +/* OBSOLETE */ +/* OBSOLETE /* Return the GDB type object for the "standard" data type */ +/* OBSOLETE of data in register N. */ */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) \ */ +/* OBSOLETE ( ((N) < A0_REGNUM ) ? builtin_type_long : builtin_type_long_long) */ +/* OBSOLETE */ +/* OBSOLETE /* Writing to r0 is a noop (not an error or exception or anything like */ +/* OBSOLETE that, however). */ */ +/* OBSOLETE */ +/* OBSOLETE #define CANNOT_STORE_REGISTER(regno) ((regno) == R0_REGNUM) */ +/* OBSOLETE */ +/* OBSOLETE void d30v_do_registers_info (int regnum, int fpregs); */ +/* OBSOLETE */ +/* OBSOLETE #define DO_REGISTERS_INFO d30v_do_registers_info */ +/* OBSOLETE */ +/* OBSOLETE /* Store the address of the place in which to copy the structure the */ +/* OBSOLETE subroutine will return. This is called from call_function. */ +/* OBSOLETE */ +/* OBSOLETE We store structs through a pointer passed in R2 */ */ +/* OBSOLETE */ +/* OBSOLETE #define STORE_STRUCT_RETURN(ADDR, SP) \ */ +/* OBSOLETE { write_register (2, (ADDR)); } */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Write into appropriate registers a function return value */ +/* OBSOLETE of type TYPE, given in virtual format. */ +/* OBSOLETE */ +/* OBSOLETE Things always get returned in R2/R3 */ */ +/* OBSOLETE */ +/* OBSOLETE #define STORE_RETURN_VALUE(TYPE,VALBUF) \ */ +/* OBSOLETE write_register_bytes (REGISTER_BYTE(2), VALBUF, TYPE_LENGTH (TYPE)) */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */ +/* OBSOLETE the address in which a function should return its structure value, */ +/* OBSOLETE as a CORE_ADDR (or an expression that can be used as one). */ */ +/* OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (((CORE_ADDR *)(REGBUF))[2]) */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Define other aspects of the stack frame. */ +/* OBSOLETE we keep a copy of the worked out return pc lying around, since it */ +/* OBSOLETE is a useful bit of info */ */ +/* OBSOLETE */ +/* OBSOLETE #define EXTRA_FRAME_INFO \ */ +/* OBSOLETE CORE_ADDR return_pc; \ */ +/* OBSOLETE CORE_ADDR dummy; \ */ +/* OBSOLETE int frameless; \ */ +/* OBSOLETE int size; */ +/* OBSOLETE */ +/* OBSOLETE #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \ */ +/* OBSOLETE d30v_init_extra_frame_info(fromleaf, fi) */ +/* OBSOLETE */ +/* OBSOLETE extern void d30v_init_extra_frame_info (int fromleaf, struct frame_info *fi); */ +/* OBSOLETE */ +/* OBSOLETE /* A macro that tells us whether the function invocation represented */ +/* OBSOLETE by FI does not have a frame on the stack associated with it. If it */ +/* OBSOLETE does not, FRAMELESS is set to 1, else 0. */ */ +/* OBSOLETE */ +/* OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(FI) \ */ +/* OBSOLETE (frameless_look_for_prologue (FI)) */ +/* OBSOLETE */ +/* OBSOLETE CORE_ADDR d30v_frame_chain (struct frame_info *frame); */ +/* OBSOLETE #define FRAME_CHAIN(FRAME) d30v_frame_chain(FRAME) */ +/* OBSOLETE extern int d30v_frame_chain_valid (CORE_ADDR, struct frame_info *); */ +/* OBSOLETE #define FRAME_CHAIN_VALID(chain, thisframe) d30v_frame_chain_valid (chain, thisframe) */ +/* OBSOLETE #define FRAME_SAVED_PC(FRAME) ((FRAME)->return_pc) */ +/* OBSOLETE #define FRAME_ARGS_ADDRESS(fi) (fi)->frame */ +/* OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) (fi)->frame */ +/* OBSOLETE */ +/* OBSOLETE void d30v_init_frame_pc (int fromleaf, struct frame_info *prev); */ +/* OBSOLETE #define INIT_FRAME_PC_FIRST(fromleaf, prev) d30v_init_frame_pc(fromleaf, prev) */ +/* OBSOLETE #define INIT_FRAME_PC(fromleaf, prev) /* nada */ */ +/* OBSOLETE */ +/* OBSOLETE /* Immediately after a function call, return the saved pc. We can't */ */ +/* OBSOLETE /* use frame->return_pc beause that is determined by reading R62 off the */ */ +/* OBSOLETE /* stack and that may not be written yet. */ */ +/* OBSOLETE */ +/* OBSOLETE #define SAVED_PC_AFTER_CALL(frame) (read_register(LR_REGNUM)) */ +/* OBSOLETE */ +/* OBSOLETE /* Set VAL to the number of args passed to frame described by FI. */ +/* OBSOLETE Can set VAL to -1, meaning no way to tell. */ */ +/* OBSOLETE /* We can't tell how many args there are */ */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_NUM_ARGS(fi) (-1) */ +/* OBSOLETE */ +/* OBSOLETE /* Return number of bytes at start of arglist that are not really args. */ */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_ARGS_SKIP 0 */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, */ +/* OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. */ +/* OBSOLETE This includes special registers such as pc and fp saved in special */ +/* OBSOLETE ways in the stack frame. sp is even more special: */ +/* OBSOLETE the address we return for it IS the sp for the next frame. */ */ +/* OBSOLETE */ +/* OBSOLETE #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ */ +/* OBSOLETE d30v_frame_find_saved_regs(frame_info, &(frame_saved_regs)) */ +/* OBSOLETE */ +/* OBSOLETE extern void d30v_frame_find_saved_regs (struct frame_info *, */ +/* OBSOLETE struct frame_saved_regs *); */ +/* OBSOLETE */ +/* OBSOLETE /* DUMMY FRAMES. Need these to support inferior function calls. */ +/* OBSOLETE They work like this on D30V: */ +/* OBSOLETE First we set a breakpoint at 0 or __start. */ +/* OBSOLETE Then we push all the registers onto the stack. */ +/* OBSOLETE Then put the function arguments in the proper registers and set r13 */ +/* OBSOLETE to our breakpoint address. */ +/* OBSOLETE Finally call the function directly. */ +/* OBSOLETE When it hits the breakpoint, clear the break point and pop the old */ +/* OBSOLETE register contents off the stack. */ */ +/* OBSOLETE */ +/* OBSOLETE #define CALL_DUMMY { 0 } */ +/* OBSOLETE #define PUSH_DUMMY_FRAME */ +/* OBSOLETE #define CALL_DUMMY_START_OFFSET 0 */ +/* OBSOLETE #define CALL_DUMMY_LOCATION AT_ENTRY_POINT */ +/* OBSOLETE #define CALL_DUMMY_BREAKPOINT_OFFSET (0) */ +/* OBSOLETE */ +/* OBSOLETE extern CORE_ADDR d30v_call_dummy_address (void); */ +/* OBSOLETE #define CALL_DUMMY_ADDRESS() d30v_call_dummy_address() */ +/* OBSOLETE */ +/* OBSOLETE #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \ */ +/* OBSOLETE sp = d30v_fix_call_dummy (dummyname, pc, fun, nargs, args, type, gcc_p) */ +/* OBSOLETE */ +/* OBSOLETE #define PC_IN_CALL_DUMMY(pc, sp, frame_address) ( pc == IMEM_START + 4 ) */ +/* OBSOLETE */ +/* OBSOLETE extern CORE_ADDR d30v_fix_call_dummy (char *, CORE_ADDR, CORE_ADDR, */ +/* OBSOLETE int, struct value **, */ +/* OBSOLETE struct type *, int); */ +/* OBSOLETE #define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \ */ +/* OBSOLETE (d30v_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr))) */ +/* OBSOLETE extern CORE_ADDR d30v_push_arguments (int, struct value **, CORE_ADDR, int, */ +/* OBSOLETE CORE_ADDR); */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Extract from an array REGBUF containing the (raw) register state */ +/* OBSOLETE a function return value of type TYPE, and copy that, in virtual format, */ +/* OBSOLETE into VALBUF. */ */ +/* OBSOLETE */ +/* OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ */ +/* OBSOLETE d30v_extract_return_value(TYPE, REGBUF, VALBUF) */ +/* OBSOLETE extern void d30v_extract_return_value (struct type *, char *, char *); */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* Discard from the stack the innermost frame, */ +/* OBSOLETE restoring all saved registers. */ */ +/* OBSOLETE #define POP_FRAME d30v_pop_frame(); */ +/* OBSOLETE extern void d30v_pop_frame (void); */ +/* OBSOLETE */ +/* OBSOLETE #define REGISTER_SIZE 4 */ +/* OBSOLETE */ +/* OBSOLETE /* Need to handle SP special, as we need to select between spu and spi. */ */ +/* OBSOLETE #if 0 /* XXX until the simulator is fixed */ */ +/* OBSOLETE #define TARGET_READ_SP() ((read_register (PSW_REGNUM) & PSW_SM) \ */ +/* OBSOLETE ? read_register (SPU_REGNUM) \ */ +/* OBSOLETE : read_register (SPI_REGNUM)) */ +/* OBSOLETE */ +/* OBSOLETE #define TARGET_WRITE_SP(val) ((read_register (PSW_REGNUM) & PSW_SM) \ */ +/* OBSOLETE ? write_register (SPU_REGNUM, (val)) \ */ +/* OBSOLETE : write_register (SPI_REGNUM, (val))) */ +/* OBSOLETE #endif */ +/* OBSOLETE */ +/* OBSOLETE #define STACK_ALIGN(len) (((len) + 7 ) & ~7) */ +/* OBSOLETE */ +/* OBSOLETE /* Turn this on to cause remote-sim.c to use sim_set/clear_breakpoint. */ */ +/* OBSOLETE */ +/* OBSOLETE #define SIM_HAS_BREAKPOINTS */ +/* OBSOLETE */ +/* OBSOLETE #endif /* TM_D30V_H */ */ diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 1217d10..dd48ae5 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -66,7 +66,7 @@ avr-*-*) gdb_target=avr cris*) gdb_target=cris ;; d10v-*-*) gdb_target=d10v ;; -d30v-*-*) gdb_target=d30v ;; +# OBSOLETE d30v-*-*) gdb_target=d30v ;; h8300-*-*) gdb_target=h8300 ;; h8500-*-*) gdb_target=h8500 ;; diff --git a/gdb/d30v-tdep.c b/gdb/d30v-tdep.c index b5d3a3b..0891370 100644 --- a/gdb/d30v-tdep.c +++ b/gdb/d30v-tdep.c @@ -1,1365 +1,1365 @@ -/* Target-dependent code for Mitsubishi D30V, for GDB. - - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 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 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* Contributed by Martin Hunt, hunt@cygnus.com */ - -#include "defs.h" -#include "frame.h" -#include "obstack.h" -#include "symtab.h" -#include "gdbtypes.h" -#include "gdbcmd.h" -#include "gdbcore.h" -#include "gdb_string.h" -#include "value.h" -#include "inferior.h" -#include "dis-asm.h" -#include "symfile.h" -#include "objfiles.h" -#include "regcache.h" - -#include "language.h" /* For local_hex_string() */ - -void d30v_frame_find_saved_regs (struct frame_info *fi, - struct frame_saved_regs *fsr); -void d30v_frame_find_saved_regs_offsets (struct frame_info *fi, - struct frame_saved_regs *fsr); -static void d30v_pop_dummy_frame (struct frame_info *fi); -static void d30v_print_flags (void); -static void print_flags_command (char *, int); - -/* the following defines assume: - fp is r61, lr is r62, sp is r63, and ?? is r22 - if that changes, they will need to be updated */ - -#define OP_MASK_ALL_BUT_RA 0x0ffc0fff /* throw away Ra, keep the rest */ - -#define OP_STW_SPM 0x054c0fc0 /* stw Ra, @(sp-) */ -#define OP_STW_SP_R0 0x05400fc0 /* stw Ra, @(sp,r0) */ -#define OP_STW_SP_IMM0 0x05480fc0 /* st Ra, @(sp, 0x0) */ -#define OP_STW_R22P_R0 0x05440580 /* stw Ra, @(r22+,r0) */ - -#define OP_ST2W_SPM 0x056c0fc0 /* st2w Ra, @(sp-) */ -#define OP_ST2W_SP_R0 0x05600fc0 /* st2w Ra, @(sp, r0) */ -#define OP_ST2W_SP_IMM0 0x05680fc0 /* st2w Ra, @(sp, 0x0) */ -#define OP_ST2W_R22P_R0 0x05640580 /* st2w Ra, @(r22+, r0) */ - -#define OP_MASK_OPCODE 0x0ffc0000 /* just the opcode, ign operands */ -#define OP_NOP 0x00f00000 /* nop */ - -#define OP_MASK_ALL_BUT_IMM 0x0fffffc0 /* throw away imm, keep the rest */ -#define OP_SUB_SP_IMM 0x082bffc0 /* sub sp,sp,imm */ -#define OP_ADD_SP_IMM 0x080bffc0 /* add sp,sp,imm */ -#define OP_ADD_R22_SP_IMM 0x08096fc0 /* add r22,sp,imm */ -#define OP_STW_FP_SP_IMM 0x054bdfc0 /* stw fp,@(sp,imm) */ -#define OP_OR_SP_R0_IMM 0x03abf000 /* or sp,r0,imm */ - -/* no mask */ -#define OP_OR_FP_R0_SP 0x03a3d03f /* or fp,r0,sp */ -#define OP_OR_FP_SP_R0 0x03a3dfc0 /* or fp,sp,r0 */ -#define OP_OR_FP_IMM0_SP 0x03abd03f /* or fp,0x0,sp */ -#define OP_STW_FP_R22P_R0 0x0547d580 /* stw fp,@(r22+,r0) */ -#define OP_STW_LR_R22P_R0 0x0547e580 /* stw lr,@(r22+,r0) */ - -#define OP_MASK_OP_AND_RB 0x0ff80fc0 /* keep op and rb,throw away rest */ -#define OP_STW_SP_IMM 0x05480fc0 /* stw Ra,@(sp,imm) */ -#define OP_ST2W_SP_IMM 0x05680fc0 /* st2w Ra,@(sp,imm) */ -#define OP_STW_FP_IMM 0x05480f40 /* stw Ra,@(fp,imm) */ -#define OP_STW_FP_R0 0x05400f40 /* stw Ra,@(fp,r0) */ - -#define OP_MASK_FM_BIT 0x80000000 -#define OP_MASK_CC_BITS 0x70000000 -#define OP_MASK_SUB_INST 0x0fffffff - -#define EXTRACT_RA(op) (((op) >> 12) & 0x3f) -#define EXTRACT_RB(op) (((op) >> 6) & 0x3f) -#define EXTRACT_RC(op) (((op) & 0x3f) -#define EXTRACT_UIMM6(op) ((op) & 0x3f) -#define EXTRACT_IMM6(op) ((((int)EXTRACT_UIMM6(op)) << 26) >> 26) -#define EXTRACT_IMM26(op) ((((op)&0x0ff00000) >> 2) | ((op)&0x0003ffff)) -#define EXTRACT_IMM32(opl, opr) ((EXTRACT_UIMM6(opl) << 26)|EXTRACT_IMM26(opr)) - - -int -d30v_frame_chain_valid (CORE_ADDR chain, struct frame_info *fi) -{ -#if 0 - return ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0); -#else - return ((chain) != 0 && (fi) != 0 && (fi)->frame <= chain); -#endif -} - -/* Discard from the stack the innermost frame, restoring all saved - registers. */ - -void -d30v_pop_frame (void) -{ - struct frame_info *frame = get_current_frame (); - CORE_ADDR fp; - int regnum; - struct frame_saved_regs fsr; - char raw_buffer[8]; - - fp = FRAME_FP (frame); - if (frame->dummy) - { - d30v_pop_dummy_frame (frame); - return; - } - - /* fill out fsr with the address of where each */ - /* register was stored in the frame */ - get_frame_saved_regs (frame, &fsr); - - /* now update the current registers with the old values */ - for (regnum = A0_REGNUM; regnum < A0_REGNUM + 2; regnum++) - { - if (fsr.regs[regnum]) - { - read_memory (fsr.regs[regnum], raw_buffer, 8); - write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 8); - } - } - for (regnum = 0; regnum < SP_REGNUM; regnum++) - { - if (fsr.regs[regnum]) - { - write_register (regnum, read_memory_unsigned_integer (fsr.regs[regnum], 4)); - } - } - if (fsr.regs[PSW_REGNUM]) - { - write_register (PSW_REGNUM, read_memory_unsigned_integer (fsr.regs[PSW_REGNUM], 4)); - } - - write_register (PC_REGNUM, read_register (LR_REGNUM)); - write_register (SP_REGNUM, fp + frame->size); - target_store_registers (-1); - flush_cached_frames (); -} - -static int -check_prologue (unsigned long op) -{ - /* add sp,sp,imm -- observed */ - if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) - return 1; - - /* add r22,sp,imm -- observed */ - if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) - return 1; - - /* or fp,r0,sp -- observed */ - if (op == OP_OR_FP_R0_SP) - return 1; - - /* nop */ - if ((op & OP_MASK_OPCODE) == OP_NOP) - return 1; - - /* stw Ra,@(sp,r0) */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_R0) - return 1; - - /* stw Ra,@(sp,0x0) */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_IMM0) - return 1; - - /* st2w Ra,@(sp,r0) */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_R0) - return 1; - - /* st2w Ra,@(sp,0x0) */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_IMM0) - return 1; - - /* stw fp, @(r22+,r0) -- observed */ - if (op == OP_STW_FP_R22P_R0) - return 1; - - /* stw r62, @(r22+,r0) -- observed */ - if (op == OP_STW_LR_R22P_R0) - return 1; - - /* stw Ra, @(fp,r0) -- observed */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_FP_R0) - return 1; /* first arg */ - - /* stw Ra, @(fp,imm) -- observed */ - if ((op & OP_MASK_OP_AND_RB) == OP_STW_FP_IMM) - return 1; /* second and subsequent args */ - - /* stw fp,@(sp,imm) -- observed */ - if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM) - return 1; - - /* st2w Ra,@(r22+,r0) */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_R22P_R0) - return 1; - - /* stw Ra, @(sp-) */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SPM) - return 1; - - /* st2w Ra, @(sp-) */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SPM) - return 1; - - /* sub.? sp,sp,imm */ - if ((op & OP_MASK_ALL_BUT_IMM) == OP_SUB_SP_IMM) - return 1; - - return 0; -} - -CORE_ADDR -d30v_skip_prologue (CORE_ADDR pc) -{ - unsigned long op[2]; - unsigned long opl, opr; /* left / right sub operations */ - unsigned long fm0, fm1; /* left / right mode bits */ - unsigned long cc0, cc1; - unsigned long op1, op2; - CORE_ADDR func_addr, func_end; - struct symtab_and_line sal; - - /* If we have line debugging information, then the end of the */ - /* prologue should the first assembly instruction of the first source line */ - if (find_pc_partial_function (pc, NULL, &func_addr, &func_end)) - { - sal = find_pc_line (func_addr, 0); - if (sal.end && sal.end < func_end) - return sal.end; - } - - if (target_read_memory (pc, (char *) &op[0], 8)) - return pc; /* Can't access it -- assume no prologue. */ - - while (1) - { - opl = (unsigned long) read_memory_integer (pc, 4); - opr = (unsigned long) read_memory_integer (pc + 4, 4); - - fm0 = (opl & OP_MASK_FM_BIT); - fm1 = (opr & OP_MASK_FM_BIT); - - cc0 = (opl & OP_MASK_CC_BITS); - cc1 = (opr & OP_MASK_CC_BITS); - - opl = (opl & OP_MASK_SUB_INST); - opr = (opr & OP_MASK_SUB_INST); - - if (fm0 && fm1) - { - /* long instruction (opl contains the opcode) */ - if (((opl & OP_MASK_ALL_BUT_IMM) != OP_ADD_SP_IMM) && /* add sp,sp,imm */ - ((opl & OP_MASK_ALL_BUT_IMM) != OP_ADD_R22_SP_IMM) && /* add r22,sp,imm */ - ((opl & OP_MASK_OP_AND_RB) != OP_STW_SP_IMM) && /* stw Ra, @(sp,imm) */ - ((opl & OP_MASK_OP_AND_RB) != OP_ST2W_SP_IMM)) /* st2w Ra, @(sp,imm) */ - break; - } - else - { - /* short instructions */ - if (fm0 && !fm1) - { - op1 = opr; - op2 = opl; - } - else - { - op1 = opl; - op2 = opr; - } - if (check_prologue (op1)) - { - if (!check_prologue (op2)) - { - /* if the previous opcode was really part of the prologue */ - /* and not just a NOP, then we want to break after both instructions */ - if ((op1 & OP_MASK_OPCODE) != OP_NOP) - pc += 8; - break; - } - } - else - break; - } - pc += 8; - } - return pc; -} - -static int end_of_stack; - -/* Given a GDB frame, determine the address of the calling function's frame. - This will be used to create a new GDB frame struct, and then - INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. - */ - -CORE_ADDR -d30v_frame_chain (struct frame_info *frame) -{ - struct frame_saved_regs fsr; - - d30v_frame_find_saved_regs (frame, &fsr); - - if (end_of_stack) - return (CORE_ADDR) 0; - - if (frame->return_pc == IMEM_START) - return (CORE_ADDR) 0; - - if (!fsr.regs[FP_REGNUM]) - { - if (!fsr.regs[SP_REGNUM] || fsr.regs[SP_REGNUM] == STACK_START) - return (CORE_ADDR) 0; - - return fsr.regs[SP_REGNUM]; - } - - if (!read_memory_unsigned_integer (fsr.regs[FP_REGNUM], 4)) - return (CORE_ADDR) 0; - - return read_memory_unsigned_integer (fsr.regs[FP_REGNUM], 4); -} - -static int next_addr, uses_frame; -static int frame_size; - -static int -prologue_find_regs (unsigned long op, struct frame_saved_regs *fsr, - CORE_ADDR addr) -{ - int n; - int offset; - - /* add sp,sp,imm -- observed */ - if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) - { - offset = EXTRACT_IMM6 (op); - /*next_addr += offset; */ - frame_size += -offset; - return 1; - } - - /* add r22,sp,imm -- observed */ - if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) - { - offset = EXTRACT_IMM6 (op); - next_addr = (offset - frame_size); - return 1; - } - - /* stw Ra, @(fp, offset) -- observed */ - if ((op & OP_MASK_OP_AND_RB) == OP_STW_FP_IMM) - { - n = EXTRACT_RA (op); - offset = EXTRACT_IMM6 (op); - fsr->regs[n] = (offset - frame_size); - return 1; - } - - /* stw Ra, @(fp, r0) -- observed */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_FP_R0) - { - n = EXTRACT_RA (op); - fsr->regs[n] = (-frame_size); - return 1; - } - - /* or fp,0,sp -- observed */ - if ((op == OP_OR_FP_R0_SP) || - (op == OP_OR_FP_SP_R0) || - (op == OP_OR_FP_IMM0_SP)) - { - uses_frame = 1; - return 1; - } - - /* nop */ - if ((op & OP_MASK_OPCODE) == OP_NOP) - return 1; - - /* stw Ra,@(r22+,r0) -- observed */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_R22P_R0) - { - n = EXTRACT_RA (op); - fsr->regs[n] = next_addr; - next_addr += 4; - return 1; - } -#if 0 /* subsumed in pattern above */ - /* stw fp,@(r22+,r0) -- observed */ - if (op == OP_STW_FP_R22P_R0) - { - fsr->regs[FP_REGNUM] = next_addr; /* XXX */ - next_addr += 4; - return 1; - } - - /* stw r62,@(r22+,r0) -- observed */ - if (op == OP_STW_LR_R22P_R0) - { - fsr->regs[LR_REGNUM] = next_addr; - next_addr += 4; - return 1; - } -#endif - /* st2w Ra,@(r22+,r0) -- observed */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_R22P_R0) - { - n = EXTRACT_RA (op); - fsr->regs[n] = next_addr; - fsr->regs[n + 1] = next_addr + 4; - next_addr += 8; - return 1; - } - - /* stw rn, @(sp-) */ - if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SPM) - { - n = EXTRACT_RA (op); - fsr->regs[n] = next_addr; - next_addr -= 4; - return 1; - } - - /* st2w Ra, @(sp-) */ - else if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SPM) - { - n = EXTRACT_RA (op); - fsr->regs[n] = next_addr; - fsr->regs[n + 1] = next_addr + 4; - next_addr -= 8; - return 1; - } - - /* sub sp,sp,imm */ - if ((op & OP_MASK_ALL_BUT_IMM) == OP_SUB_SP_IMM) - { - offset = EXTRACT_IMM6 (op); - frame_size += -offset; - return 1; - } - - /* st rn, @(sp,0) -- observed */ - if (((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_R0) || - ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_IMM0)) - { - n = EXTRACT_RA (op); - fsr->regs[n] = (-frame_size); - return 1; - } - - /* st2w rn, @(sp,0) */ - if (((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_R0) || - ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_IMM0)) - { - n = EXTRACT_RA (op); - fsr->regs[n] = (-frame_size); - fsr->regs[n + 1] = (-frame_size) + 4; - return 1; - } - - /* stw fp,@(sp,imm) -- observed */ - if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM) - { - offset = EXTRACT_IMM6 (op); - fsr->regs[FP_REGNUM] = (offset - frame_size); - return 1; - } - return 0; -} - -/* Put here the code to store, into a struct frame_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. */ -void -d30v_frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr) -{ - CORE_ADDR fp, pc; - unsigned long opl, opr; - unsigned long op1, op2; - unsigned long fm0, fm1; - int i; - - fp = fi->frame; - memset (fsr, 0, sizeof (*fsr)); - next_addr = 0; - frame_size = 0; - end_of_stack = 0; - - uses_frame = 0; - - d30v_frame_find_saved_regs_offsets (fi, fsr); - - fi->size = frame_size; - - if (!fp) - fp = read_register (SP_REGNUM); - - for (i = 0; i < NUM_REGS - 1; i++) - if (fsr->regs[i]) - { - fsr->regs[i] = fsr->regs[i] + fp + frame_size; - } - - if (fsr->regs[LR_REGNUM]) - fi->return_pc = read_memory_unsigned_integer (fsr->regs[LR_REGNUM], 4); - else - fi->return_pc = read_register (LR_REGNUM); - - /* the SP is not normally (ever?) saved, but check anyway */ - if (!fsr->regs[SP_REGNUM]) - { - /* if the FP was saved, that means the current FP is valid, */ - /* otherwise, it isn't being used, so we use the SP instead */ - if (uses_frame) - fsr->regs[SP_REGNUM] = read_register (FP_REGNUM) + fi->size; - else - { - fsr->regs[SP_REGNUM] = fp + fi->size; - fi->frameless = 1; - fsr->regs[FP_REGNUM] = 0; - } - } -} - -void -d30v_frame_find_saved_regs_offsets (struct frame_info *fi, - struct frame_saved_regs *fsr) -{ - CORE_ADDR fp, pc; - unsigned long opl, opr; - unsigned long op1, op2; - unsigned long fm0, fm1; - int i; - - fp = fi->frame; - memset (fsr, 0, sizeof (*fsr)); - next_addr = 0; - frame_size = 0; - end_of_stack = 0; - - pc = get_pc_function_start (fi->pc); - - uses_frame = 0; - while (pc < fi->pc) - { - opl = (unsigned long) read_memory_integer (pc, 4); - opr = (unsigned long) read_memory_integer (pc + 4, 4); - - fm0 = (opl & OP_MASK_FM_BIT); - fm1 = (opr & OP_MASK_FM_BIT); - - opl = (opl & OP_MASK_SUB_INST); - opr = (opr & OP_MASK_SUB_INST); - - if (fm0 && fm1) - { - /* long instruction */ - if ((opl & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) - { - /* add sp,sp,n */ - long offset = EXTRACT_IMM32 (opl, opr); - frame_size += -offset; - } - else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) - { - /* add r22,sp,offset */ - long offset = EXTRACT_IMM32 (opl, opr); - next_addr = (offset - frame_size); - } - else if ((opl & OP_MASK_OP_AND_RB) == OP_STW_SP_IMM) - { - /* st Ra, @(sp,imm) */ - long offset = EXTRACT_IMM32 (opl, opr); - short n = EXTRACT_RA (opl); - fsr->regs[n] = (offset - frame_size); - } - else if ((opl & OP_MASK_OP_AND_RB) == OP_ST2W_SP_IMM) - { - /* st2w Ra, @(sp,offset) */ - long offset = EXTRACT_IMM32 (opl, opr); - short n = EXTRACT_RA (opl); - fsr->regs[n] = (offset - frame_size); - fsr->regs[n + 1] = (offset - frame_size) + 4; - } - else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_OR_SP_R0_IMM) - { - end_of_stack = 1; - } - else - break; - } - else - { - /* short instructions */ - if (fm0 && !fm1) - { - op2 = opl; - op1 = opr; - } - else - { - op1 = opl; - op2 = opr; - } - if (!prologue_find_regs (op1, fsr, pc) || !prologue_find_regs (op2, fsr, pc)) - break; - } - pc += 8; - } - -#if 0 - fi->size = frame_size; - - if (!fp) - fp = read_register (SP_REGNUM); - - for (i = 0; i < NUM_REGS - 1; i++) - if (fsr->regs[i]) - { - fsr->regs[i] = fsr->regs[i] + fp + frame_size; - } - - if (fsr->regs[LR_REGNUM]) - fi->return_pc = read_memory_unsigned_integer (fsr->regs[LR_REGNUM], 4); - else - fi->return_pc = read_register (LR_REGNUM); - - /* the SP is not normally (ever?) saved, but check anyway */ - if (!fsr->regs[SP_REGNUM]) - { - /* if the FP was saved, that means the current FP is valid, */ - /* otherwise, it isn't being used, so we use the SP instead */ - if (uses_frame) - fsr->regs[SP_REGNUM] = read_register (FP_REGNUM) + fi->size; - else - { - fsr->regs[SP_REGNUM] = fp + fi->size; - fi->frameless = 1; - fsr->regs[FP_REGNUM] = 0; - } - } -#endif -} - -void -d30v_init_extra_frame_info (int fromleaf, struct frame_info *fi) -{ - struct frame_saved_regs dummy; - - if (fi->next && (fi->pc == 0)) - fi->pc = fi->next->return_pc; - - d30v_frame_find_saved_regs_offsets (fi, &dummy); - - if (uses_frame == 0) - fi->frameless = 1; - else - fi->frameless = 0; - - if ((fi->next == 0) && (uses_frame == 0)) - /* innermost frame and it's "frameless", - so the fi->frame field is wrong, fix it! */ - fi->frame = read_sp (); - - if (dummy.regs[LR_REGNUM]) - { - /* it was saved, grab it! */ - dummy.regs[LR_REGNUM] += (fi->frame + frame_size); - fi->return_pc = read_memory_unsigned_integer (dummy.regs[LR_REGNUM], 4); - } - else - fi->return_pc = read_register (LR_REGNUM); -} - -void -d30v_init_frame_pc (int fromleaf, struct frame_info *prev) -{ - /* default value, put here so we can breakpoint on it and - see if the default value is really the right thing to use */ - prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ - prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); -} - -static void d30v_print_register (int regnum, int tabular); - -static void -d30v_print_register (int regnum, int tabular) -{ - if (regnum < A0_REGNUM) - { - if (tabular) - printf_filtered ("%08lx", (long) read_register (regnum)); - else - printf_filtered ("0x%lx %ld", - (long) read_register (regnum), - (long) read_register (regnum)); - } - else - { - char regbuf[MAX_REGISTER_RAW_SIZE]; - - frame_register_read (selected_frame, regnum, regbuf); - - val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0, - gdb_stdout, 'x', 1, 0, Val_pretty_default); - - if (!tabular) - { - printf_filtered (" "); - val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0, - gdb_stdout, 'd', 1, 0, Val_pretty_default); - } - } -} - -static void -d30v_print_flags (void) -{ - long psw = read_register (PSW_REGNUM); - printf_filtered ("flags #1"); - printf_filtered (" (sm) %d", (psw & PSW_SM) != 0); - printf_filtered (" (ea) %d", (psw & PSW_EA) != 0); - printf_filtered (" (db) %d", (psw & PSW_DB) != 0); - printf_filtered (" (ds) %d", (psw & PSW_DS) != 0); - printf_filtered (" (ie) %d", (psw & PSW_IE) != 0); - printf_filtered (" (rp) %d", (psw & PSW_RP) != 0); - printf_filtered (" (md) %d\n", (psw & PSW_MD) != 0); - - printf_filtered ("flags #2"); - printf_filtered (" (f0) %d", (psw & PSW_F0) != 0); - printf_filtered (" (f1) %d", (psw & PSW_F1) != 0); - printf_filtered (" (f2) %d", (psw & PSW_F2) != 0); - printf_filtered (" (f3) %d", (psw & PSW_F3) != 0); - printf_filtered (" (s) %d", (psw & PSW_S) != 0); - printf_filtered (" (v) %d", (psw & PSW_V) != 0); - printf_filtered (" (va) %d", (psw & PSW_VA) != 0); - printf_filtered (" (c) %d\n", (psw & PSW_C) != 0); -} - -static void -print_flags_command (char *args, int from_tty) -{ - d30v_print_flags (); -} - -void -d30v_do_registers_info (int regnum, int fpregs) -{ - long long num1, num2; - long psw; - - if (regnum != -1) - { - if (REGISTER_NAME (0) == NULL || REGISTER_NAME (0)[0] == '\000') - return; - - printf_filtered ("%s ", REGISTER_NAME (regnum)); - d30v_print_register (regnum, 0); - - printf_filtered ("\n"); - return; - } - - /* Have to print all the registers. Format them nicely. */ - - printf_filtered ("PC="); - print_address (read_pc (), gdb_stdout); - - printf_filtered (" PSW="); - d30v_print_register (PSW_REGNUM, 1); - - printf_filtered (" BPC="); - print_address (read_register (BPC_REGNUM), gdb_stdout); - - printf_filtered (" BPSW="); - d30v_print_register (BPSW_REGNUM, 1); - printf_filtered ("\n"); - - printf_filtered ("DPC="); - print_address (read_register (DPC_REGNUM), gdb_stdout); - - printf_filtered (" DPSW="); - d30v_print_register (DPSW_REGNUM, 1); - - printf_filtered (" IBA="); - print_address (read_register (IBA_REGNUM), gdb_stdout); - printf_filtered ("\n"); - - printf_filtered ("RPT_C="); - d30v_print_register (RPT_C_REGNUM, 1); - - printf_filtered (" RPT_S="); - print_address (read_register (RPT_S_REGNUM), gdb_stdout); - - printf_filtered (" RPT_E="); - print_address (read_register (RPT_E_REGNUM), gdb_stdout); - printf_filtered ("\n"); - - printf_filtered ("MOD_S="); - print_address (read_register (MOD_S_REGNUM), gdb_stdout); - - printf_filtered (" MOD_E="); - print_address (read_register (MOD_E_REGNUM), gdb_stdout); - printf_filtered ("\n"); - - printf_filtered ("EIT_VB="); - print_address (read_register (EIT_VB_REGNUM), gdb_stdout); - - printf_filtered (" INT_S="); - d30v_print_register (INT_S_REGNUM, 1); - - printf_filtered (" INT_M="); - d30v_print_register (INT_M_REGNUM, 1); - printf_filtered ("\n"); - - d30v_print_flags (); - for (regnum = 0; regnum <= 63;) - { - int i; - - printf_filtered ("R%d-R%d ", regnum, regnum + 7); - if (regnum < 10) - printf_filtered (" "); - if (regnum + 7 < 10) - printf_filtered (" "); - - for (i = 0; i < 8; i++) - { - printf_filtered (" "); - d30v_print_register (regnum++, 1); - } - - printf_filtered ("\n"); - } - - printf_filtered ("A0-A1 "); - - d30v_print_register (A0_REGNUM, 1); - printf_filtered (" "); - d30v_print_register (A1_REGNUM, 1); - printf_filtered ("\n"); -} - -CORE_ADDR -d30v_fix_call_dummy (char *dummyname, CORE_ADDR start_sp, CORE_ADDR fun, - int nargs, struct value **args, - struct type *type, int gcc_p) -{ - int regnum; - CORE_ADDR sp; - char buffer[MAX_REGISTER_RAW_SIZE]; - struct frame_info *frame = get_current_frame (); - frame->dummy = start_sp; - /*start_sp |= DMEM_START; */ - - sp = start_sp; - for (regnum = 0; regnum < NUM_REGS; regnum++) - { - sp -= REGISTER_RAW_SIZE (regnum); - store_address (buffer, REGISTER_RAW_SIZE (regnum), read_register (regnum)); - write_memory (sp, buffer, REGISTER_RAW_SIZE (regnum)); - } - write_register (SP_REGNUM, (LONGEST) sp); - /* now we need to load LR with the return address */ - write_register (LR_REGNUM, (LONGEST) d30v_call_dummy_address ()); - return sp; -} - -static void -d30v_pop_dummy_frame (struct frame_info *fi) -{ - CORE_ADDR sp = fi->dummy; - int regnum; - - for (regnum = 0; regnum < NUM_REGS; regnum++) - { - sp -= REGISTER_RAW_SIZE (regnum); - write_register (regnum, read_memory_unsigned_integer (sp, REGISTER_RAW_SIZE (regnum))); - } - flush_cached_frames (); /* needed? */ -} - - -CORE_ADDR -d30v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, - int struct_return, CORE_ADDR struct_addr) -{ - int i, len, index = 0, regnum = 2; - char buffer[4], *contents; - LONGEST val; - CORE_ADDR ptrs[10]; - -#if 0 - /* Pass 1. Put all large args on stack */ - for (i = 0; i < nargs; i++) - { - struct value *arg = args[i]; - struct type *arg_type = check_typedef (VALUE_TYPE (arg)); - len = TYPE_LENGTH (arg_type); - contents = VALUE_CONTENTS (arg); - val = extract_signed_integer (contents, len); - if (len > 4) - { - /* put on stack and pass pointers */ - sp -= len; - write_memory (sp, contents, len); - ptrs[index++] = sp; - } - } -#endif - index = 0; - - for (i = 0; i < nargs; i++) - { - struct value *arg = args[i]; - struct type *arg_type = check_typedef (VALUE_TYPE (arg)); - len = TYPE_LENGTH (arg_type); - contents = VALUE_CONTENTS (arg); - if (len > 4) - { - /* we need multiple registers */ - int ndx; - - for (ndx = 0; len > 0; ndx += 8, len -= 8) - { - if (regnum & 1) - regnum++; /* all args > 4 bytes start in even register */ - - if (regnum < 18) - { - val = extract_signed_integer (&contents[ndx], 4); - write_register (regnum++, val); - - if (len >= 8) - val = extract_signed_integer (&contents[ndx + 4], 4); - else - val = extract_signed_integer (&contents[ndx + 4], len - 4); - write_register (regnum++, val); - } - else - { - /* no more registers available. put it on the stack */ - - /* all args > 4 bytes are padded to a multiple of 8 bytes - and start on an 8 byte boundary */ - if (sp & 7) - sp -= (sp & 7); /* align it */ - - sp -= ((len + 7) & ~7); /* allocate space */ - write_memory (sp, &contents[ndx], len); - break; - } - } - } - else - { - if (regnum < 18) - { - val = extract_signed_integer (contents, len); - write_register (regnum++, val); - } - else - { - /* all args are padded to a multiple of 4 bytes (at least) */ - sp -= ((len + 3) & ~3); - write_memory (sp, contents, len); - } - } - } - if (sp & 7) - /* stack pointer is not on an 8 byte boundary -- align it */ - sp -= (sp & 7); - return sp; -} - - -/* pick an out-of-the-way place to set the return value */ -/* for an inferior function call. The link register is set to this */ -/* value and a momentary breakpoint is set there. When the breakpoint */ -/* is hit, the dummy frame is popped and the previous environment is */ -/* restored. */ - -CORE_ADDR -d30v_call_dummy_address (void) -{ - CORE_ADDR entry; - struct minimal_symbol *sym; - - entry = entry_point_address (); - - if (entry != 0) - return entry; - - sym = lookup_minimal_symbol ("_start", NULL, symfile_objfile); - - if (!sym || MSYMBOL_TYPE (sym) != mst_text) - return 0; - else - return SYMBOL_VALUE_ADDRESS (sym); -} - -/* Given a return value in `regbuf' with a type `valtype', - extract and copy its value into `valbuf'. */ - -void -d30v_extract_return_value (struct type *valtype, char regbuf[REGISTER_BYTES], - char *valbuf) -{ - memcpy (valbuf, regbuf + REGISTER_BYTE (2), TYPE_LENGTH (valtype)); -} - -/* The following code implements access to, and display of, the D30V's - instruction trace buffer. The buffer consists of 64K or more - 4-byte words of data, of which each words includes an 8-bit count, - an 8-bit segment number, and a 16-bit instruction address. - - In theory, the trace buffer is continuously capturing instruction - data that the CPU presents on its "debug bus", but in practice, the - ROMified GDB stub only enables tracing when it continues or steps - the program, and stops tracing when the program stops; so it - actually works for GDB to read the buffer counter out of memory and - then read each trace word. The counter records where the tracing - stops, but there is no record of where it started, so we remember - the PC when we resumed and then search backwards in the trace - buffer for a word that includes that address. This is not perfect, - because you will miss trace data if the resumption PC is the target - of a branch. (The value of the buffer counter is semi-random, any - trace data from a previous program stop is gone.) */ - -/* The address of the last word recorded in the trace buffer. */ - -#define DBBC_ADDR (0xd80000) - -/* The base of the trace buffer, at least for the "Board_0". */ - -#define TRACE_BUFFER_BASE (0xf40000) - -static void trace_command (char *, int); - -static void untrace_command (char *, int); - -static void trace_info (char *, int); - -static void tdisassemble_command (char *, int); - -static void display_trace (int, int); - -/* True when instruction traces are being collected. */ - -static int tracing; - -/* Remembered PC. */ - -static CORE_ADDR last_pc; - -/* True when trace output should be displayed whenever program stops. */ - -static int trace_display; - -/* True when trace listing should include source lines. */ - -static int default_trace_show_source = 1; - -struct trace_buffer - { - int size; - short *counts; - CORE_ADDR *addrs; - } -trace_data; - -static void -trace_command (char *args, int from_tty) -{ - /* Clear the host-side trace buffer, allocating space if needed. */ - trace_data.size = 0; - if (trace_data.counts == NULL) - trace_data.counts = (short *) xmalloc (65536 * sizeof (short)); - if (trace_data.addrs == NULL) - trace_data.addrs = (CORE_ADDR *) xmalloc (65536 * sizeof (CORE_ADDR)); - - tracing = 1; - - printf_filtered ("Tracing is now on.\n"); -} - -static void -untrace_command (char *args, int from_tty) -{ - tracing = 0; - - printf_filtered ("Tracing is now off.\n"); -} - -static void -trace_info (char *args, int from_tty) -{ - int i; - - if (trace_data.size) - { - printf_filtered ("%d entries in trace buffer:\n", trace_data.size); - - for (i = 0; i < trace_data.size; ++i) - { - printf_filtered ("%d: %d instruction%s at 0x%s\n", - i, trace_data.counts[i], - (trace_data.counts[i] == 1 ? "" : "s"), - paddr_nz (trace_data.addrs[i])); - } - } - else - printf_filtered ("No entries in trace buffer.\n"); - - printf_filtered ("Tracing is currently %s.\n", (tracing ? "on" : "off")); -} - -/* Print the instruction at address MEMADDR in debugged memory, - on STREAM. Returns length of the instruction, in bytes. */ - -static int -print_insn (CORE_ADDR memaddr, struct ui_file *stream) -{ - /* If there's no disassembler, something is very wrong. */ - if (tm_print_insn == NULL) - internal_error (__FILE__, __LINE__, - "print_insn: no disassembler"); - - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - tm_print_insn_info.endian = BFD_ENDIAN_BIG; - else - tm_print_insn_info.endian = BFD_ENDIAN_LITTLE; - return TARGET_PRINT_INSN (memaddr, &tm_print_insn_info); -} - -void -d30v_eva_prepare_to_trace (void) -{ - if (!tracing) - return; - - last_pc = read_register (PC_REGNUM); -} - -/* Collect trace data from the target board and format it into a form - more useful for display. */ - -void -d30v_eva_get_trace_data (void) -{ - int count, i, j, oldsize; - int trace_addr, trace_seg, trace_cnt, next_cnt; - unsigned int last_trace, trace_word, next_word; - unsigned int *tmpspace; - - if (!tracing) - return; - - tmpspace = xmalloc (65536 * sizeof (unsigned int)); - - last_trace = read_memory_unsigned_integer (DBBC_ADDR, 2) << 2; - - /* Collect buffer contents from the target, stopping when we reach - the word recorded when execution resumed. */ - - count = 0; - while (last_trace > 0) - { - QUIT; - trace_word = - read_memory_unsigned_integer (TRACE_BUFFER_BASE + last_trace, 4); - trace_addr = trace_word & 0xffff; - last_trace -= 4; - /* Ignore an apparently nonsensical entry. */ - if (trace_addr == 0xffd5) - continue; - tmpspace[count++] = trace_word; - if (trace_addr == last_pc) - break; - if (count > 65535) - break; - } - - /* Move the data to the host-side trace buffer, adjusting counts to - include the last instruction executed and transforming the address - into something that GDB likes. */ - - for (i = 0; i < count; ++i) - { - trace_word = tmpspace[i]; - next_word = ((i == 0) ? 0 : tmpspace[i - 1]); - trace_addr = trace_word & 0xffff; - next_cnt = (next_word >> 24) & 0xff; - j = trace_data.size + count - i - 1; - trace_data.addrs[j] = (trace_addr << 2) + 0x1000000; - trace_data.counts[j] = next_cnt + 1; - } - - oldsize = trace_data.size; - trace_data.size += count; - - xfree (tmpspace); - - if (trace_display) - display_trace (oldsize, trace_data.size); -} - -static void -tdisassemble_command (char *arg, int from_tty) -{ - int i, count; - CORE_ADDR low, high; - char *space_index; - - if (!arg) - { - low = 0; - high = trace_data.size; - } - else if (!(space_index = (char *) strchr (arg, ' '))) - { - low = parse_and_eval_address (arg); - high = low + 5; - } - else - { - /* Two arguments. */ - *space_index = '\0'; - low = parse_and_eval_address (arg); - high = parse_and_eval_address (space_index + 1); - if (high < low) - high = low; - } - - printf_filtered ("Dump of trace from %s to %s:\n", - paddr_u (low), - paddr_u (high)); - - display_trace (low, high); - - printf_filtered ("End of trace dump.\n"); - gdb_flush (gdb_stdout); -} - -static void -display_trace (int low, int high) -{ - int i, count, trace_show_source, first, suppress; - CORE_ADDR next_address; - - trace_show_source = default_trace_show_source; - if (!have_full_symbols () && !have_partial_symbols ()) - { - trace_show_source = 0; - printf_filtered ("No symbol table is loaded. Use the \"file\" command.\n"); - printf_filtered ("Trace will not display any source.\n"); - } - - first = 1; - suppress = 0; - for (i = low; i < high; ++i) - { - next_address = trace_data.addrs[i]; - count = trace_data.counts[i]; - while (count-- > 0) - { - QUIT; - if (trace_show_source) - { - struct symtab_and_line sal, sal_prev; - - sal_prev = find_pc_line (next_address - 4, 0); - sal = find_pc_line (next_address, 0); - - if (sal.symtab) - { - if (first || sal.line != sal_prev.line) - print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); - suppress = 0; - } - else - { - if (!suppress) - /* FIXME-32x64--assumes sal.pc fits in long. */ - printf_filtered ("No source file for address %s.\n", - local_hex_string ((unsigned long) sal.pc)); - suppress = 1; - } - } - first = 0; - print_address (next_address, gdb_stdout); - printf_filtered (":"); - printf_filtered ("\t"); - wrap_here (" "); - next_address = next_address + print_insn (next_address, gdb_stdout); - printf_filtered ("\n"); - gdb_flush (gdb_stdout); - } - } -} - -extern void (*target_resume_hook) (void); -extern void (*target_wait_loop_hook) (void); - -void -_initialize_d30v_tdep (void) -{ - tm_print_insn = print_insn_d30v; - - target_resume_hook = d30v_eva_prepare_to_trace; - target_wait_loop_hook = d30v_eva_get_trace_data; - - add_info ("flags", print_flags_command, "Print d30v flags."); - - add_com ("trace", class_support, trace_command, - "Enable tracing of instruction execution."); - - add_com ("untrace", class_support, untrace_command, - "Disable tracing of instruction execution."); - - add_com ("tdisassemble", class_vars, tdisassemble_command, - "Disassemble the trace buffer.\n\ -Two optional arguments specify a range of trace buffer entries\n\ -as reported by info trace (NOT addresses!)."); - - add_info ("trace", trace_info, - "Display info about the trace data buffer."); - - add_show_from_set (add_set_cmd ("tracedisplay", no_class, - var_integer, (char *) &trace_display, - "Set automatic display of trace.\n", &setlist), - &showlist); - add_show_from_set (add_set_cmd ("tracesource", no_class, - var_integer, (char *) &default_trace_show_source, - "Set display of source code with trace.\n", &setlist), - &showlist); - -} +/* OBSOLETE /* Target-dependent code for Mitsubishi D30V, for GDB. */ +/* OBSOLETE */ +/* OBSOLETE Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software */ +/* OBSOLETE Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */ +/* OBSOLETE Boston, MA 02111-1307, USA. */ */ +/* OBSOLETE */ +/* OBSOLETE /* Contributed by Martin Hunt, hunt@cygnus.com */ */ +/* OBSOLETE */ +/* OBSOLETE #include "defs.h" */ +/* OBSOLETE #include "frame.h" */ +/* OBSOLETE #include "obstack.h" */ +/* OBSOLETE #include "symtab.h" */ +/* OBSOLETE #include "gdbtypes.h" */ +/* OBSOLETE #include "gdbcmd.h" */ +/* OBSOLETE #include "gdbcore.h" */ +/* OBSOLETE #include "gdb_string.h" */ +/* OBSOLETE #include "value.h" */ +/* OBSOLETE #include "inferior.h" */ +/* OBSOLETE #include "dis-asm.h" */ +/* OBSOLETE #include "symfile.h" */ +/* OBSOLETE #include "objfiles.h" */ +/* OBSOLETE #include "regcache.h" */ +/* OBSOLETE */ +/* OBSOLETE #include "language.h" /* For local_hex_string() */ */ +/* OBSOLETE */ +/* OBSOLETE void d30v_frame_find_saved_regs (struct frame_info *fi, */ +/* OBSOLETE struct frame_saved_regs *fsr); */ +/* OBSOLETE void d30v_frame_find_saved_regs_offsets (struct frame_info *fi, */ +/* OBSOLETE struct frame_saved_regs *fsr); */ +/* OBSOLETE static void d30v_pop_dummy_frame (struct frame_info *fi); */ +/* OBSOLETE static void d30v_print_flags (void); */ +/* OBSOLETE static void print_flags_command (char *, int); */ +/* OBSOLETE */ +/* OBSOLETE /* the following defines assume: */ +/* OBSOLETE fp is r61, lr is r62, sp is r63, and ?? is r22 */ +/* OBSOLETE if that changes, they will need to be updated */ */ +/* OBSOLETE */ +/* OBSOLETE #define OP_MASK_ALL_BUT_RA 0x0ffc0fff /* throw away Ra, keep the rest */ */ +/* OBSOLETE */ +/* OBSOLETE #define OP_STW_SPM 0x054c0fc0 /* stw Ra, @(sp-) */ */ +/* OBSOLETE #define OP_STW_SP_R0 0x05400fc0 /* stw Ra, @(sp,r0) */ */ +/* OBSOLETE #define OP_STW_SP_IMM0 0x05480fc0 /* st Ra, @(sp, 0x0) */ */ +/* OBSOLETE #define OP_STW_R22P_R0 0x05440580 /* stw Ra, @(r22+,r0) */ */ +/* OBSOLETE */ +/* OBSOLETE #define OP_ST2W_SPM 0x056c0fc0 /* st2w Ra, @(sp-) */ */ +/* OBSOLETE #define OP_ST2W_SP_R0 0x05600fc0 /* st2w Ra, @(sp, r0) */ */ +/* OBSOLETE #define OP_ST2W_SP_IMM0 0x05680fc0 /* st2w Ra, @(sp, 0x0) */ */ +/* OBSOLETE #define OP_ST2W_R22P_R0 0x05640580 /* st2w Ra, @(r22+, r0) */ */ +/* OBSOLETE */ +/* OBSOLETE #define OP_MASK_OPCODE 0x0ffc0000 /* just the opcode, ign operands */ */ +/* OBSOLETE #define OP_NOP 0x00f00000 /* nop */ */ +/* OBSOLETE */ +/* OBSOLETE #define OP_MASK_ALL_BUT_IMM 0x0fffffc0 /* throw away imm, keep the rest */ */ +/* OBSOLETE #define OP_SUB_SP_IMM 0x082bffc0 /* sub sp,sp,imm */ */ +/* OBSOLETE #define OP_ADD_SP_IMM 0x080bffc0 /* add sp,sp,imm */ */ +/* OBSOLETE #define OP_ADD_R22_SP_IMM 0x08096fc0 /* add r22,sp,imm */ */ +/* OBSOLETE #define OP_STW_FP_SP_IMM 0x054bdfc0 /* stw fp,@(sp,imm) */ */ +/* OBSOLETE #define OP_OR_SP_R0_IMM 0x03abf000 /* or sp,r0,imm */ */ +/* OBSOLETE */ +/* OBSOLETE /* no mask */ */ +/* OBSOLETE #define OP_OR_FP_R0_SP 0x03a3d03f /* or fp,r0,sp */ */ +/* OBSOLETE #define OP_OR_FP_SP_R0 0x03a3dfc0 /* or fp,sp,r0 */ */ +/* OBSOLETE #define OP_OR_FP_IMM0_SP 0x03abd03f /* or fp,0x0,sp */ */ +/* OBSOLETE #define OP_STW_FP_R22P_R0 0x0547d580 /* stw fp,@(r22+,r0) */ */ +/* OBSOLETE #define OP_STW_LR_R22P_R0 0x0547e580 /* stw lr,@(r22+,r0) */ */ +/* OBSOLETE */ +/* OBSOLETE #define OP_MASK_OP_AND_RB 0x0ff80fc0 /* keep op and rb,throw away rest */ */ +/* OBSOLETE #define OP_STW_SP_IMM 0x05480fc0 /* stw Ra,@(sp,imm) */ */ +/* OBSOLETE #define OP_ST2W_SP_IMM 0x05680fc0 /* st2w Ra,@(sp,imm) */ */ +/* OBSOLETE #define OP_STW_FP_IMM 0x05480f40 /* stw Ra,@(fp,imm) */ */ +/* OBSOLETE #define OP_STW_FP_R0 0x05400f40 /* stw Ra,@(fp,r0) */ */ +/* OBSOLETE */ +/* OBSOLETE #define OP_MASK_FM_BIT 0x80000000 */ +/* OBSOLETE #define OP_MASK_CC_BITS 0x70000000 */ +/* OBSOLETE #define OP_MASK_SUB_INST 0x0fffffff */ +/* OBSOLETE */ +/* OBSOLETE #define EXTRACT_RA(op) (((op) >> 12) & 0x3f) */ +/* OBSOLETE #define EXTRACT_RB(op) (((op) >> 6) & 0x3f) */ +/* OBSOLETE #define EXTRACT_RC(op) (((op) & 0x3f) */ +/* OBSOLETE #define EXTRACT_UIMM6(op) ((op) & 0x3f) */ +/* OBSOLETE #define EXTRACT_IMM6(op) ((((int)EXTRACT_UIMM6(op)) << 26) >> 26) */ +/* OBSOLETE #define EXTRACT_IMM26(op) ((((op)&0x0ff00000) >> 2) | ((op)&0x0003ffff)) */ +/* OBSOLETE #define EXTRACT_IMM32(opl, opr) ((EXTRACT_UIMM6(opl) << 26)|EXTRACT_IMM26(opr)) */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE int */ +/* OBSOLETE d30v_frame_chain_valid (CORE_ADDR chain, struct frame_info *fi) */ +/* OBSOLETE { */ +/* OBSOLETE #if 0 */ +/* OBSOLETE return ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0); */ +/* OBSOLETE #else */ +/* OBSOLETE return ((chain) != 0 && (fi) != 0 && (fi)->frame <= chain); */ +/* OBSOLETE #endif */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Discard from the stack the innermost frame, restoring all saved */ +/* OBSOLETE registers. */ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE d30v_pop_frame (void) */ +/* OBSOLETE { */ +/* OBSOLETE struct frame_info *frame = get_current_frame (); */ +/* OBSOLETE CORE_ADDR fp; */ +/* OBSOLETE int regnum; */ +/* OBSOLETE struct frame_saved_regs fsr; */ +/* OBSOLETE char raw_buffer[8]; */ +/* OBSOLETE */ +/* OBSOLETE fp = FRAME_FP (frame); */ +/* OBSOLETE if (frame->dummy) */ +/* OBSOLETE { */ +/* OBSOLETE d30v_pop_dummy_frame (frame); */ +/* OBSOLETE return; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* fill out fsr with the address of where each */ */ +/* OBSOLETE /* register was stored in the frame */ */ +/* OBSOLETE get_frame_saved_regs (frame, &fsr); */ +/* OBSOLETE */ +/* OBSOLETE /* now update the current registers with the old values */ */ +/* OBSOLETE for (regnum = A0_REGNUM; regnum < A0_REGNUM + 2; regnum++) */ +/* OBSOLETE { */ +/* OBSOLETE if (fsr.regs[regnum]) */ +/* OBSOLETE { */ +/* OBSOLETE read_memory (fsr.regs[regnum], raw_buffer, 8); */ +/* OBSOLETE write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, 8); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE for (regnum = 0; regnum < SP_REGNUM; regnum++) */ +/* OBSOLETE { */ +/* OBSOLETE if (fsr.regs[regnum]) */ +/* OBSOLETE { */ +/* OBSOLETE write_register (regnum, read_memory_unsigned_integer (fsr.regs[regnum], 4)); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE if (fsr.regs[PSW_REGNUM]) */ +/* OBSOLETE { */ +/* OBSOLETE write_register (PSW_REGNUM, read_memory_unsigned_integer (fsr.regs[PSW_REGNUM], 4)); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE write_register (PC_REGNUM, read_register (LR_REGNUM)); */ +/* OBSOLETE write_register (SP_REGNUM, fp + frame->size); */ +/* OBSOLETE target_store_registers (-1); */ +/* OBSOLETE flush_cached_frames (); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE check_prologue (unsigned long op) */ +/* OBSOLETE { */ +/* OBSOLETE /* add sp,sp,imm -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* add r22,sp,imm -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* or fp,r0,sp -- observed */ */ +/* OBSOLETE if (op == OP_OR_FP_R0_SP) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* nop */ */ +/* OBSOLETE if ((op & OP_MASK_OPCODE) == OP_NOP) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* stw Ra,@(sp,r0) */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_R0) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* stw Ra,@(sp,0x0) */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_IMM0) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* st2w Ra,@(sp,r0) */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_R0) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* st2w Ra,@(sp,0x0) */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_IMM0) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* stw fp, @(r22+,r0) -- observed */ */ +/* OBSOLETE if (op == OP_STW_FP_R22P_R0) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* stw r62, @(r22+,r0) -- observed */ */ +/* OBSOLETE if (op == OP_STW_LR_R22P_R0) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* stw Ra, @(fp,r0) -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_FP_R0) */ +/* OBSOLETE return 1; /* first arg */ */ +/* OBSOLETE */ +/* OBSOLETE /* stw Ra, @(fp,imm) -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_OP_AND_RB) == OP_STW_FP_IMM) */ +/* OBSOLETE return 1; /* second and subsequent args */ */ +/* OBSOLETE */ +/* OBSOLETE /* stw fp,@(sp,imm) -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* st2w Ra,@(r22+,r0) */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_R22P_R0) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* stw Ra, @(sp-) */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SPM) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* st2w Ra, @(sp-) */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SPM) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* sub.? sp,sp,imm */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_IMM) == OP_SUB_SP_IMM) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE CORE_ADDR */ +/* OBSOLETE d30v_skip_prologue (CORE_ADDR pc) */ +/* OBSOLETE { */ +/* OBSOLETE unsigned long op[2]; */ +/* OBSOLETE unsigned long opl, opr; /* left / right sub operations */ */ +/* OBSOLETE unsigned long fm0, fm1; /* left / right mode bits */ */ +/* OBSOLETE unsigned long cc0, cc1; */ +/* OBSOLETE unsigned long op1, op2; */ +/* OBSOLETE CORE_ADDR func_addr, func_end; */ +/* OBSOLETE struct symtab_and_line sal; */ +/* OBSOLETE */ +/* OBSOLETE /* If we have line debugging information, then the end of the */ */ +/* OBSOLETE /* prologue should the first assembly instruction of the first source line */ */ +/* OBSOLETE if (find_pc_partial_function (pc, NULL, &func_addr, &func_end)) */ +/* OBSOLETE { */ +/* OBSOLETE sal = find_pc_line (func_addr, 0); */ +/* OBSOLETE if (sal.end && sal.end < func_end) */ +/* OBSOLETE return sal.end; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (target_read_memory (pc, (char *) &op[0], 8)) */ +/* OBSOLETE return pc; /* Can't access it -- assume no prologue. */ */ +/* OBSOLETE */ +/* OBSOLETE while (1) */ +/* OBSOLETE { */ +/* OBSOLETE opl = (unsigned long) read_memory_integer (pc, 4); */ +/* OBSOLETE opr = (unsigned long) read_memory_integer (pc + 4, 4); */ +/* OBSOLETE */ +/* OBSOLETE fm0 = (opl & OP_MASK_FM_BIT); */ +/* OBSOLETE fm1 = (opr & OP_MASK_FM_BIT); */ +/* OBSOLETE */ +/* OBSOLETE cc0 = (opl & OP_MASK_CC_BITS); */ +/* OBSOLETE cc1 = (opr & OP_MASK_CC_BITS); */ +/* OBSOLETE */ +/* OBSOLETE opl = (opl & OP_MASK_SUB_INST); */ +/* OBSOLETE opr = (opr & OP_MASK_SUB_INST); */ +/* OBSOLETE */ +/* OBSOLETE if (fm0 && fm1) */ +/* OBSOLETE { */ +/* OBSOLETE /* long instruction (opl contains the opcode) */ */ +/* OBSOLETE if (((opl & OP_MASK_ALL_BUT_IMM) != OP_ADD_SP_IMM) && /* add sp,sp,imm */ */ +/* OBSOLETE ((opl & OP_MASK_ALL_BUT_IMM) != OP_ADD_R22_SP_IMM) && /* add r22,sp,imm */ */ +/* OBSOLETE ((opl & OP_MASK_OP_AND_RB) != OP_STW_SP_IMM) && /* stw Ra, @(sp,imm) */ */ +/* OBSOLETE ((opl & OP_MASK_OP_AND_RB) != OP_ST2W_SP_IMM)) /* st2w Ra, @(sp,imm) */ */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE /* short instructions */ */ +/* OBSOLETE if (fm0 && !fm1) */ +/* OBSOLETE { */ +/* OBSOLETE op1 = opr; */ +/* OBSOLETE op2 = opl; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE op1 = opl; */ +/* OBSOLETE op2 = opr; */ +/* OBSOLETE } */ +/* OBSOLETE if (check_prologue (op1)) */ +/* OBSOLETE { */ +/* OBSOLETE if (!check_prologue (op2)) */ +/* OBSOLETE { */ +/* OBSOLETE /* if the previous opcode was really part of the prologue */ */ +/* OBSOLETE /* and not just a NOP, then we want to break after both instructions */ */ +/* OBSOLETE if ((op1 & OP_MASK_OPCODE) != OP_NOP) */ +/* OBSOLETE pc += 8; */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE pc += 8; */ +/* OBSOLETE } */ +/* OBSOLETE return pc; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static int end_of_stack; */ +/* OBSOLETE */ +/* OBSOLETE /* Given a GDB frame, determine the address of the calling function's frame. */ +/* OBSOLETE This will be used to create a new GDB frame struct, and then */ +/* OBSOLETE INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. */ +/* OBSOLETE */ */ +/* OBSOLETE */ +/* OBSOLETE CORE_ADDR */ +/* OBSOLETE d30v_frame_chain (struct frame_info *frame) */ +/* OBSOLETE { */ +/* OBSOLETE struct frame_saved_regs fsr; */ +/* OBSOLETE */ +/* OBSOLETE d30v_frame_find_saved_regs (frame, &fsr); */ +/* OBSOLETE */ +/* OBSOLETE if (end_of_stack) */ +/* OBSOLETE return (CORE_ADDR) 0; */ +/* OBSOLETE */ +/* OBSOLETE if (frame->return_pc == IMEM_START) */ +/* OBSOLETE return (CORE_ADDR) 0; */ +/* OBSOLETE */ +/* OBSOLETE if (!fsr.regs[FP_REGNUM]) */ +/* OBSOLETE { */ +/* OBSOLETE if (!fsr.regs[SP_REGNUM] || fsr.regs[SP_REGNUM] == STACK_START) */ +/* OBSOLETE return (CORE_ADDR) 0; */ +/* OBSOLETE */ +/* OBSOLETE return fsr.regs[SP_REGNUM]; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (!read_memory_unsigned_integer (fsr.regs[FP_REGNUM], 4)) */ +/* OBSOLETE return (CORE_ADDR) 0; */ +/* OBSOLETE */ +/* OBSOLETE return read_memory_unsigned_integer (fsr.regs[FP_REGNUM], 4); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static int next_addr, uses_frame; */ +/* OBSOLETE static int frame_size; */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE prologue_find_regs (unsigned long op, struct frame_saved_regs *fsr, */ +/* OBSOLETE CORE_ADDR addr) */ +/* OBSOLETE { */ +/* OBSOLETE int n; */ +/* OBSOLETE int offset; */ +/* OBSOLETE */ +/* OBSOLETE /* add sp,sp,imm -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE offset = EXTRACT_IMM6 (op); */ +/* OBSOLETE /*next_addr += offset; */ */ +/* OBSOLETE frame_size += -offset; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* add r22,sp,imm -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE offset = EXTRACT_IMM6 (op); */ +/* OBSOLETE next_addr = (offset - frame_size); */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* stw Ra, @(fp, offset) -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_OP_AND_RB) == OP_STW_FP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE n = EXTRACT_RA (op); */ +/* OBSOLETE offset = EXTRACT_IMM6 (op); */ +/* OBSOLETE fsr->regs[n] = (offset - frame_size); */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* stw Ra, @(fp, r0) -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_FP_R0) */ +/* OBSOLETE { */ +/* OBSOLETE n = EXTRACT_RA (op); */ +/* OBSOLETE fsr->regs[n] = (-frame_size); */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* or fp,0,sp -- observed */ */ +/* OBSOLETE if ((op == OP_OR_FP_R0_SP) || */ +/* OBSOLETE (op == OP_OR_FP_SP_R0) || */ +/* OBSOLETE (op == OP_OR_FP_IMM0_SP)) */ +/* OBSOLETE { */ +/* OBSOLETE uses_frame = 1; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* nop */ */ +/* OBSOLETE if ((op & OP_MASK_OPCODE) == OP_NOP) */ +/* OBSOLETE return 1; */ +/* OBSOLETE */ +/* OBSOLETE /* stw Ra,@(r22+,r0) -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_R22P_R0) */ +/* OBSOLETE { */ +/* OBSOLETE n = EXTRACT_RA (op); */ +/* OBSOLETE fsr->regs[n] = next_addr; */ +/* OBSOLETE next_addr += 4; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE #if 0 /* subsumed in pattern above */ */ +/* OBSOLETE /* stw fp,@(r22+,r0) -- observed */ */ +/* OBSOLETE if (op == OP_STW_FP_R22P_R0) */ +/* OBSOLETE { */ +/* OBSOLETE fsr->regs[FP_REGNUM] = next_addr; /* XXX */ */ +/* OBSOLETE next_addr += 4; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* stw r62,@(r22+,r0) -- observed */ */ +/* OBSOLETE if (op == OP_STW_LR_R22P_R0) */ +/* OBSOLETE { */ +/* OBSOLETE fsr->regs[LR_REGNUM] = next_addr; */ +/* OBSOLETE next_addr += 4; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE #endif */ +/* OBSOLETE /* st2w Ra,@(r22+,r0) -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_R22P_R0) */ +/* OBSOLETE { */ +/* OBSOLETE n = EXTRACT_RA (op); */ +/* OBSOLETE fsr->regs[n] = next_addr; */ +/* OBSOLETE fsr->regs[n + 1] = next_addr + 4; */ +/* OBSOLETE next_addr += 8; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* stw rn, @(sp-) */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SPM) */ +/* OBSOLETE { */ +/* OBSOLETE n = EXTRACT_RA (op); */ +/* OBSOLETE fsr->regs[n] = next_addr; */ +/* OBSOLETE next_addr -= 4; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* st2w Ra, @(sp-) */ */ +/* OBSOLETE else if ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SPM) */ +/* OBSOLETE { */ +/* OBSOLETE n = EXTRACT_RA (op); */ +/* OBSOLETE fsr->regs[n] = next_addr; */ +/* OBSOLETE fsr->regs[n + 1] = next_addr + 4; */ +/* OBSOLETE next_addr -= 8; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* sub sp,sp,imm */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_IMM) == OP_SUB_SP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE offset = EXTRACT_IMM6 (op); */ +/* OBSOLETE frame_size += -offset; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* st rn, @(sp,0) -- observed */ */ +/* OBSOLETE if (((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_R0) || */ +/* OBSOLETE ((op & OP_MASK_ALL_BUT_RA) == OP_STW_SP_IMM0)) */ +/* OBSOLETE { */ +/* OBSOLETE n = EXTRACT_RA (op); */ +/* OBSOLETE fsr->regs[n] = (-frame_size); */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* st2w rn, @(sp,0) */ */ +/* OBSOLETE if (((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_R0) || */ +/* OBSOLETE ((op & OP_MASK_ALL_BUT_RA) == OP_ST2W_SP_IMM0)) */ +/* OBSOLETE { */ +/* OBSOLETE n = EXTRACT_RA (op); */ +/* OBSOLETE fsr->regs[n] = (-frame_size); */ +/* OBSOLETE fsr->regs[n + 1] = (-frame_size) + 4; */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* stw fp,@(sp,imm) -- observed */ */ +/* OBSOLETE if ((op & OP_MASK_ALL_BUT_IMM) == OP_STW_FP_SP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE offset = EXTRACT_IMM6 (op); */ +/* OBSOLETE fsr->regs[FP_REGNUM] = (offset - frame_size); */ +/* OBSOLETE return 1; */ +/* OBSOLETE } */ +/* OBSOLETE return 0; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, the */ +/* OBSOLETE addresses of the saved registers of frame described by FRAME_INFO. */ +/* OBSOLETE This includes special registers such as pc and fp saved in special */ +/* OBSOLETE ways in the stack frame. sp is even more special: the address we */ +/* OBSOLETE return for it IS the sp for the next frame. */ */ +/* OBSOLETE void */ +/* OBSOLETE d30v_frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr) */ +/* OBSOLETE { */ +/* OBSOLETE CORE_ADDR fp, pc; */ +/* OBSOLETE unsigned long opl, opr; */ +/* OBSOLETE unsigned long op1, op2; */ +/* OBSOLETE unsigned long fm0, fm1; */ +/* OBSOLETE int i; */ +/* OBSOLETE */ +/* OBSOLETE fp = fi->frame; */ +/* OBSOLETE memset (fsr, 0, sizeof (*fsr)); */ +/* OBSOLETE next_addr = 0; */ +/* OBSOLETE frame_size = 0; */ +/* OBSOLETE end_of_stack = 0; */ +/* OBSOLETE */ +/* OBSOLETE uses_frame = 0; */ +/* OBSOLETE */ +/* OBSOLETE d30v_frame_find_saved_regs_offsets (fi, fsr); */ +/* OBSOLETE */ +/* OBSOLETE fi->size = frame_size; */ +/* OBSOLETE */ +/* OBSOLETE if (!fp) */ +/* OBSOLETE fp = read_register (SP_REGNUM); */ +/* OBSOLETE */ +/* OBSOLETE for (i = 0; i < NUM_REGS - 1; i++) */ +/* OBSOLETE if (fsr->regs[i]) */ +/* OBSOLETE { */ +/* OBSOLETE fsr->regs[i] = fsr->regs[i] + fp + frame_size; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (fsr->regs[LR_REGNUM]) */ +/* OBSOLETE fi->return_pc = read_memory_unsigned_integer (fsr->regs[LR_REGNUM], 4); */ +/* OBSOLETE else */ +/* OBSOLETE fi->return_pc = read_register (LR_REGNUM); */ +/* OBSOLETE */ +/* OBSOLETE /* the SP is not normally (ever?) saved, but check anyway */ */ +/* OBSOLETE if (!fsr->regs[SP_REGNUM]) */ +/* OBSOLETE { */ +/* OBSOLETE /* if the FP was saved, that means the current FP is valid, */ */ +/* OBSOLETE /* otherwise, it isn't being used, so we use the SP instead */ */ +/* OBSOLETE if (uses_frame) */ +/* OBSOLETE fsr->regs[SP_REGNUM] = read_register (FP_REGNUM) + fi->size; */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE fsr->regs[SP_REGNUM] = fp + fi->size; */ +/* OBSOLETE fi->frameless = 1; */ +/* OBSOLETE fsr->regs[FP_REGNUM] = 0; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE d30v_frame_find_saved_regs_offsets (struct frame_info *fi, */ +/* OBSOLETE struct frame_saved_regs *fsr) */ +/* OBSOLETE { */ +/* OBSOLETE CORE_ADDR fp, pc; */ +/* OBSOLETE unsigned long opl, opr; */ +/* OBSOLETE unsigned long op1, op2; */ +/* OBSOLETE unsigned long fm0, fm1; */ +/* OBSOLETE int i; */ +/* OBSOLETE */ +/* OBSOLETE fp = fi->frame; */ +/* OBSOLETE memset (fsr, 0, sizeof (*fsr)); */ +/* OBSOLETE next_addr = 0; */ +/* OBSOLETE frame_size = 0; */ +/* OBSOLETE end_of_stack = 0; */ +/* OBSOLETE */ +/* OBSOLETE pc = get_pc_function_start (fi->pc); */ +/* OBSOLETE */ +/* OBSOLETE uses_frame = 0; */ +/* OBSOLETE while (pc < fi->pc) */ +/* OBSOLETE { */ +/* OBSOLETE opl = (unsigned long) read_memory_integer (pc, 4); */ +/* OBSOLETE opr = (unsigned long) read_memory_integer (pc + 4, 4); */ +/* OBSOLETE */ +/* OBSOLETE fm0 = (opl & OP_MASK_FM_BIT); */ +/* OBSOLETE fm1 = (opr & OP_MASK_FM_BIT); */ +/* OBSOLETE */ +/* OBSOLETE opl = (opl & OP_MASK_SUB_INST); */ +/* OBSOLETE opr = (opr & OP_MASK_SUB_INST); */ +/* OBSOLETE */ +/* OBSOLETE if (fm0 && fm1) */ +/* OBSOLETE { */ +/* OBSOLETE /* long instruction */ */ +/* OBSOLETE if ((opl & OP_MASK_ALL_BUT_IMM) == OP_ADD_SP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE /* add sp,sp,n */ */ +/* OBSOLETE long offset = EXTRACT_IMM32 (opl, opr); */ +/* OBSOLETE frame_size += -offset; */ +/* OBSOLETE } */ +/* OBSOLETE else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_ADD_R22_SP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE /* add r22,sp,offset */ */ +/* OBSOLETE long offset = EXTRACT_IMM32 (opl, opr); */ +/* OBSOLETE next_addr = (offset - frame_size); */ +/* OBSOLETE } */ +/* OBSOLETE else if ((opl & OP_MASK_OP_AND_RB) == OP_STW_SP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE /* st Ra, @(sp,imm) */ */ +/* OBSOLETE long offset = EXTRACT_IMM32 (opl, opr); */ +/* OBSOLETE short n = EXTRACT_RA (opl); */ +/* OBSOLETE fsr->regs[n] = (offset - frame_size); */ +/* OBSOLETE } */ +/* OBSOLETE else if ((opl & OP_MASK_OP_AND_RB) == OP_ST2W_SP_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE /* st2w Ra, @(sp,offset) */ */ +/* OBSOLETE long offset = EXTRACT_IMM32 (opl, opr); */ +/* OBSOLETE short n = EXTRACT_RA (opl); */ +/* OBSOLETE fsr->regs[n] = (offset - frame_size); */ +/* OBSOLETE fsr->regs[n + 1] = (offset - frame_size) + 4; */ +/* OBSOLETE } */ +/* OBSOLETE else if ((opl & OP_MASK_ALL_BUT_IMM) == OP_OR_SP_R0_IMM) */ +/* OBSOLETE { */ +/* OBSOLETE end_of_stack = 1; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE /* short instructions */ */ +/* OBSOLETE if (fm0 && !fm1) */ +/* OBSOLETE { */ +/* OBSOLETE op2 = opl; */ +/* OBSOLETE op1 = opr; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE op1 = opl; */ +/* OBSOLETE op2 = opr; */ +/* OBSOLETE } */ +/* OBSOLETE if (!prologue_find_regs (op1, fsr, pc) || !prologue_find_regs (op2, fsr, pc)) */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE pc += 8; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE #if 0 */ +/* OBSOLETE fi->size = frame_size; */ +/* OBSOLETE */ +/* OBSOLETE if (!fp) */ +/* OBSOLETE fp = read_register (SP_REGNUM); */ +/* OBSOLETE */ +/* OBSOLETE for (i = 0; i < NUM_REGS - 1; i++) */ +/* OBSOLETE if (fsr->regs[i]) */ +/* OBSOLETE { */ +/* OBSOLETE fsr->regs[i] = fsr->regs[i] + fp + frame_size; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE if (fsr->regs[LR_REGNUM]) */ +/* OBSOLETE fi->return_pc = read_memory_unsigned_integer (fsr->regs[LR_REGNUM], 4); */ +/* OBSOLETE else */ +/* OBSOLETE fi->return_pc = read_register (LR_REGNUM); */ +/* OBSOLETE */ +/* OBSOLETE /* the SP is not normally (ever?) saved, but check anyway */ */ +/* OBSOLETE if (!fsr->regs[SP_REGNUM]) */ +/* OBSOLETE { */ +/* OBSOLETE /* if the FP was saved, that means the current FP is valid, */ */ +/* OBSOLETE /* otherwise, it isn't being used, so we use the SP instead */ */ +/* OBSOLETE if (uses_frame) */ +/* OBSOLETE fsr->regs[SP_REGNUM] = read_register (FP_REGNUM) + fi->size; */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE fsr->regs[SP_REGNUM] = fp + fi->size; */ +/* OBSOLETE fi->frameless = 1; */ +/* OBSOLETE fsr->regs[FP_REGNUM] = 0; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE #endif */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE d30v_init_extra_frame_info (int fromleaf, struct frame_info *fi) */ +/* OBSOLETE { */ +/* OBSOLETE struct frame_saved_regs dummy; */ +/* OBSOLETE */ +/* OBSOLETE if (fi->next && (fi->pc == 0)) */ +/* OBSOLETE fi->pc = fi->next->return_pc; */ +/* OBSOLETE */ +/* OBSOLETE d30v_frame_find_saved_regs_offsets (fi, &dummy); */ +/* OBSOLETE */ +/* OBSOLETE if (uses_frame == 0) */ +/* OBSOLETE fi->frameless = 1; */ +/* OBSOLETE else */ +/* OBSOLETE fi->frameless = 0; */ +/* OBSOLETE */ +/* OBSOLETE if ((fi->next == 0) && (uses_frame == 0)) */ +/* OBSOLETE /* innermost frame and it's "frameless", */ +/* OBSOLETE so the fi->frame field is wrong, fix it! */ */ +/* OBSOLETE fi->frame = read_sp (); */ +/* OBSOLETE */ +/* OBSOLETE if (dummy.regs[LR_REGNUM]) */ +/* OBSOLETE { */ +/* OBSOLETE /* it was saved, grab it! */ */ +/* OBSOLETE dummy.regs[LR_REGNUM] += (fi->frame + frame_size); */ +/* OBSOLETE fi->return_pc = read_memory_unsigned_integer (dummy.regs[LR_REGNUM], 4); */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE fi->return_pc = read_register (LR_REGNUM); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE d30v_init_frame_pc (int fromleaf, struct frame_info *prev) */ +/* OBSOLETE { */ +/* OBSOLETE /* default value, put here so we can breakpoint on it and */ +/* OBSOLETE see if the default value is really the right thing to use */ */ +/* OBSOLETE prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \ */ +/* OBSOLETE prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ()); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void d30v_print_register (int regnum, int tabular); */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE d30v_print_register (int regnum, int tabular) */ +/* OBSOLETE { */ +/* OBSOLETE if (regnum < A0_REGNUM) */ +/* OBSOLETE { */ +/* OBSOLETE if (tabular) */ +/* OBSOLETE printf_filtered ("%08lx", (long) read_register (regnum)); */ +/* OBSOLETE else */ +/* OBSOLETE printf_filtered ("0x%lx %ld", */ +/* OBSOLETE (long) read_register (regnum), */ +/* OBSOLETE (long) read_register (regnum)); */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE char regbuf[MAX_REGISTER_RAW_SIZE]; */ +/* OBSOLETE */ +/* OBSOLETE frame_register_read (selected_frame, regnum, regbuf); */ +/* OBSOLETE */ +/* OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0, */ +/* OBSOLETE gdb_stdout, 'x', 1, 0, Val_pretty_default); */ +/* OBSOLETE */ +/* OBSOLETE if (!tabular) */ +/* OBSOLETE { */ +/* OBSOLETE printf_filtered (" "); */ +/* OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (regnum), regbuf, 0, 0, */ +/* OBSOLETE gdb_stdout, 'd', 1, 0, Val_pretty_default); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE d30v_print_flags (void) */ +/* OBSOLETE { */ +/* OBSOLETE long psw = read_register (PSW_REGNUM); */ +/* OBSOLETE printf_filtered ("flags #1"); */ +/* OBSOLETE printf_filtered (" (sm) %d", (psw & PSW_SM) != 0); */ +/* OBSOLETE printf_filtered (" (ea) %d", (psw & PSW_EA) != 0); */ +/* OBSOLETE printf_filtered (" (db) %d", (psw & PSW_DB) != 0); */ +/* OBSOLETE printf_filtered (" (ds) %d", (psw & PSW_DS) != 0); */ +/* OBSOLETE printf_filtered (" (ie) %d", (psw & PSW_IE) != 0); */ +/* OBSOLETE printf_filtered (" (rp) %d", (psw & PSW_RP) != 0); */ +/* OBSOLETE printf_filtered (" (md) %d\n", (psw & PSW_MD) != 0); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("flags #2"); */ +/* OBSOLETE printf_filtered (" (f0) %d", (psw & PSW_F0) != 0); */ +/* OBSOLETE printf_filtered (" (f1) %d", (psw & PSW_F1) != 0); */ +/* OBSOLETE printf_filtered (" (f2) %d", (psw & PSW_F2) != 0); */ +/* OBSOLETE printf_filtered (" (f3) %d", (psw & PSW_F3) != 0); */ +/* OBSOLETE printf_filtered (" (s) %d", (psw & PSW_S) != 0); */ +/* OBSOLETE printf_filtered (" (v) %d", (psw & PSW_V) != 0); */ +/* OBSOLETE printf_filtered (" (va) %d", (psw & PSW_VA) != 0); */ +/* OBSOLETE printf_filtered (" (c) %d\n", (psw & PSW_C) != 0); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE print_flags_command (char *args, int from_tty) */ +/* OBSOLETE { */ +/* OBSOLETE d30v_print_flags (); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE d30v_do_registers_info (int regnum, int fpregs) */ +/* OBSOLETE { */ +/* OBSOLETE long long num1, num2; */ +/* OBSOLETE long psw; */ +/* OBSOLETE */ +/* OBSOLETE if (regnum != -1) */ +/* OBSOLETE { */ +/* OBSOLETE if (REGISTER_NAME (0) == NULL || REGISTER_NAME (0)[0] == '\000') */ +/* OBSOLETE return; */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("%s ", REGISTER_NAME (regnum)); */ +/* OBSOLETE d30v_print_register (regnum, 0); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE return; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Have to print all the registers. Format them nicely. */ */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("PC="); */ +/* OBSOLETE print_address (read_pc (), gdb_stdout); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" PSW="); */ +/* OBSOLETE d30v_print_register (PSW_REGNUM, 1); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" BPC="); */ +/* OBSOLETE print_address (read_register (BPC_REGNUM), gdb_stdout); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" BPSW="); */ +/* OBSOLETE d30v_print_register (BPSW_REGNUM, 1); */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("DPC="); */ +/* OBSOLETE print_address (read_register (DPC_REGNUM), gdb_stdout); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" DPSW="); */ +/* OBSOLETE d30v_print_register (DPSW_REGNUM, 1); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" IBA="); */ +/* OBSOLETE print_address (read_register (IBA_REGNUM), gdb_stdout); */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("RPT_C="); */ +/* OBSOLETE d30v_print_register (RPT_C_REGNUM, 1); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" RPT_S="); */ +/* OBSOLETE print_address (read_register (RPT_S_REGNUM), gdb_stdout); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" RPT_E="); */ +/* OBSOLETE print_address (read_register (RPT_E_REGNUM), gdb_stdout); */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("MOD_S="); */ +/* OBSOLETE print_address (read_register (MOD_S_REGNUM), gdb_stdout); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" MOD_E="); */ +/* OBSOLETE print_address (read_register (MOD_E_REGNUM), gdb_stdout); */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("EIT_VB="); */ +/* OBSOLETE print_address (read_register (EIT_VB_REGNUM), gdb_stdout); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" INT_S="); */ +/* OBSOLETE d30v_print_register (INT_S_REGNUM, 1); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered (" INT_M="); */ +/* OBSOLETE d30v_print_register (INT_M_REGNUM, 1); */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE */ +/* OBSOLETE d30v_print_flags (); */ +/* OBSOLETE for (regnum = 0; regnum <= 63;) */ +/* OBSOLETE { */ +/* OBSOLETE int i; */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("R%d-R%d ", regnum, regnum + 7); */ +/* OBSOLETE if (regnum < 10) */ +/* OBSOLETE printf_filtered (" "); */ +/* OBSOLETE if (regnum + 7 < 10) */ +/* OBSOLETE printf_filtered (" "); */ +/* OBSOLETE */ +/* OBSOLETE for (i = 0; i < 8; i++) */ +/* OBSOLETE { */ +/* OBSOLETE printf_filtered (" "); */ +/* OBSOLETE d30v_print_register (regnum++, 1); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("A0-A1 "); */ +/* OBSOLETE */ +/* OBSOLETE d30v_print_register (A0_REGNUM, 1); */ +/* OBSOLETE printf_filtered (" "); */ +/* OBSOLETE d30v_print_register (A1_REGNUM, 1); */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE CORE_ADDR */ +/* OBSOLETE d30v_fix_call_dummy (char *dummyname, CORE_ADDR start_sp, CORE_ADDR fun, */ +/* OBSOLETE int nargs, struct value **args, */ +/* OBSOLETE struct type *type, int gcc_p) */ +/* OBSOLETE { */ +/* OBSOLETE int regnum; */ +/* OBSOLETE CORE_ADDR sp; */ +/* OBSOLETE char buffer[MAX_REGISTER_RAW_SIZE]; */ +/* OBSOLETE struct frame_info *frame = get_current_frame (); */ +/* OBSOLETE frame->dummy = start_sp; */ +/* OBSOLETE /*start_sp |= DMEM_START; */ */ +/* OBSOLETE */ +/* OBSOLETE sp = start_sp; */ +/* OBSOLETE for (regnum = 0; regnum < NUM_REGS; regnum++) */ +/* OBSOLETE { */ +/* OBSOLETE sp -= REGISTER_RAW_SIZE (regnum); */ +/* OBSOLETE store_address (buffer, REGISTER_RAW_SIZE (regnum), read_register (regnum)); */ +/* OBSOLETE write_memory (sp, buffer, REGISTER_RAW_SIZE (regnum)); */ +/* OBSOLETE } */ +/* OBSOLETE write_register (SP_REGNUM, (LONGEST) sp); */ +/* OBSOLETE /* now we need to load LR with the return address */ */ +/* OBSOLETE write_register (LR_REGNUM, (LONGEST) d30v_call_dummy_address ()); */ +/* OBSOLETE return sp; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE d30v_pop_dummy_frame (struct frame_info *fi) */ +/* OBSOLETE { */ +/* OBSOLETE CORE_ADDR sp = fi->dummy; */ +/* OBSOLETE int regnum; */ +/* OBSOLETE */ +/* OBSOLETE for (regnum = 0; regnum < NUM_REGS; regnum++) */ +/* OBSOLETE { */ +/* OBSOLETE sp -= REGISTER_RAW_SIZE (regnum); */ +/* OBSOLETE write_register (regnum, read_memory_unsigned_integer (sp, REGISTER_RAW_SIZE (regnum))); */ +/* OBSOLETE } */ +/* OBSOLETE flush_cached_frames (); /* needed? */ */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE CORE_ADDR */ +/* OBSOLETE d30v_push_arguments (int nargs, struct value **args, CORE_ADDR sp, */ +/* OBSOLETE int struct_return, CORE_ADDR struct_addr) */ +/* OBSOLETE { */ +/* OBSOLETE int i, len, index = 0, regnum = 2; */ +/* OBSOLETE char buffer[4], *contents; */ +/* OBSOLETE LONGEST val; */ +/* OBSOLETE CORE_ADDR ptrs[10]; */ +/* OBSOLETE */ +/* OBSOLETE #if 0 */ +/* OBSOLETE /* Pass 1. Put all large args on stack */ */ +/* OBSOLETE for (i = 0; i < nargs; i++) */ +/* OBSOLETE { */ +/* OBSOLETE struct value *arg = args[i]; */ +/* OBSOLETE struct type *arg_type = check_typedef (VALUE_TYPE (arg)); */ +/* OBSOLETE len = TYPE_LENGTH (arg_type); */ +/* OBSOLETE contents = VALUE_CONTENTS (arg); */ +/* OBSOLETE val = extract_signed_integer (contents, len); */ +/* OBSOLETE if (len > 4) */ +/* OBSOLETE { */ +/* OBSOLETE /* put on stack and pass pointers */ */ +/* OBSOLETE sp -= len; */ +/* OBSOLETE write_memory (sp, contents, len); */ +/* OBSOLETE ptrs[index++] = sp; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE #endif */ +/* OBSOLETE index = 0; */ +/* OBSOLETE */ +/* OBSOLETE for (i = 0; i < nargs; i++) */ +/* OBSOLETE { */ +/* OBSOLETE struct value *arg = args[i]; */ +/* OBSOLETE struct type *arg_type = check_typedef (VALUE_TYPE (arg)); */ +/* OBSOLETE len = TYPE_LENGTH (arg_type); */ +/* OBSOLETE contents = VALUE_CONTENTS (arg); */ +/* OBSOLETE if (len > 4) */ +/* OBSOLETE { */ +/* OBSOLETE /* we need multiple registers */ */ +/* OBSOLETE int ndx; */ +/* OBSOLETE */ +/* OBSOLETE for (ndx = 0; len > 0; ndx += 8, len -= 8) */ +/* OBSOLETE { */ +/* OBSOLETE if (regnum & 1) */ +/* OBSOLETE regnum++; /* all args > 4 bytes start in even register */ */ +/* OBSOLETE */ +/* OBSOLETE if (regnum < 18) */ +/* OBSOLETE { */ +/* OBSOLETE val = extract_signed_integer (&contents[ndx], 4); */ +/* OBSOLETE write_register (regnum++, val); */ +/* OBSOLETE */ +/* OBSOLETE if (len >= 8) */ +/* OBSOLETE val = extract_signed_integer (&contents[ndx + 4], 4); */ +/* OBSOLETE else */ +/* OBSOLETE val = extract_signed_integer (&contents[ndx + 4], len - 4); */ +/* OBSOLETE write_register (regnum++, val); */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE /* no more registers available. put it on the stack */ */ +/* OBSOLETE */ +/* OBSOLETE /* all args > 4 bytes are padded to a multiple of 8 bytes */ +/* OBSOLETE and start on an 8 byte boundary */ */ +/* OBSOLETE if (sp & 7) */ +/* OBSOLETE sp -= (sp & 7); /* align it */ */ +/* OBSOLETE */ +/* OBSOLETE sp -= ((len + 7) & ~7); /* allocate space */ */ +/* OBSOLETE write_memory (sp, &contents[ndx], len); */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE if (regnum < 18) */ +/* OBSOLETE { */ +/* OBSOLETE val = extract_signed_integer (contents, len); */ +/* OBSOLETE write_register (regnum++, val); */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE /* all args are padded to a multiple of 4 bytes (at least) */ */ +/* OBSOLETE sp -= ((len + 3) & ~3); */ +/* OBSOLETE write_memory (sp, contents, len); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE if (sp & 7) */ +/* OBSOLETE /* stack pointer is not on an 8 byte boundary -- align it */ */ +/* OBSOLETE sp -= (sp & 7); */ +/* OBSOLETE return sp; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE */ +/* OBSOLETE /* pick an out-of-the-way place to set the return value */ */ +/* OBSOLETE /* for an inferior function call. The link register is set to this */ */ +/* OBSOLETE /* value and a momentary breakpoint is set there. When the breakpoint */ */ +/* OBSOLETE /* is hit, the dummy frame is popped and the previous environment is */ */ +/* OBSOLETE /* restored. */ */ +/* OBSOLETE */ +/* OBSOLETE CORE_ADDR */ +/* OBSOLETE d30v_call_dummy_address (void) */ +/* OBSOLETE { */ +/* OBSOLETE CORE_ADDR entry; */ +/* OBSOLETE struct minimal_symbol *sym; */ +/* OBSOLETE */ +/* OBSOLETE entry = entry_point_address (); */ +/* OBSOLETE */ +/* OBSOLETE if (entry != 0) */ +/* OBSOLETE return entry; */ +/* OBSOLETE */ +/* OBSOLETE sym = lookup_minimal_symbol ("_start", NULL, symfile_objfile); */ +/* OBSOLETE */ +/* OBSOLETE if (!sym || MSYMBOL_TYPE (sym) != mst_text) */ +/* OBSOLETE return 0; */ +/* OBSOLETE else */ +/* OBSOLETE return SYMBOL_VALUE_ADDRESS (sym); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Given a return value in `regbuf' with a type `valtype', */ +/* OBSOLETE extract and copy its value into `valbuf'. */ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE d30v_extract_return_value (struct type *valtype, char regbuf[REGISTER_BYTES], */ +/* OBSOLETE char *valbuf) */ +/* OBSOLETE { */ +/* OBSOLETE memcpy (valbuf, regbuf + REGISTER_BYTE (2), TYPE_LENGTH (valtype)); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* The following code implements access to, and display of, the D30V's */ +/* OBSOLETE instruction trace buffer. The buffer consists of 64K or more */ +/* OBSOLETE 4-byte words of data, of which each words includes an 8-bit count, */ +/* OBSOLETE an 8-bit segment number, and a 16-bit instruction address. */ +/* OBSOLETE */ +/* OBSOLETE In theory, the trace buffer is continuously capturing instruction */ +/* OBSOLETE data that the CPU presents on its "debug bus", but in practice, the */ +/* OBSOLETE ROMified GDB stub only enables tracing when it continues or steps */ +/* OBSOLETE the program, and stops tracing when the program stops; so it */ +/* OBSOLETE actually works for GDB to read the buffer counter out of memory and */ +/* OBSOLETE then read each trace word. The counter records where the tracing */ +/* OBSOLETE stops, but there is no record of where it started, so we remember */ +/* OBSOLETE the PC when we resumed and then search backwards in the trace */ +/* OBSOLETE buffer for a word that includes that address. This is not perfect, */ +/* OBSOLETE because you will miss trace data if the resumption PC is the target */ +/* OBSOLETE of a branch. (The value of the buffer counter is semi-random, any */ +/* OBSOLETE trace data from a previous program stop is gone.) */ */ +/* OBSOLETE */ +/* OBSOLETE /* The address of the last word recorded in the trace buffer. */ */ +/* OBSOLETE */ +/* OBSOLETE #define DBBC_ADDR (0xd80000) */ +/* OBSOLETE */ +/* OBSOLETE /* The base of the trace buffer, at least for the "Board_0". */ */ +/* OBSOLETE */ +/* OBSOLETE #define TRACE_BUFFER_BASE (0xf40000) */ +/* OBSOLETE */ +/* OBSOLETE static void trace_command (char *, int); */ +/* OBSOLETE */ +/* OBSOLETE static void untrace_command (char *, int); */ +/* OBSOLETE */ +/* OBSOLETE static void trace_info (char *, int); */ +/* OBSOLETE */ +/* OBSOLETE static void tdisassemble_command (char *, int); */ +/* OBSOLETE */ +/* OBSOLETE static void display_trace (int, int); */ +/* OBSOLETE */ +/* OBSOLETE /* True when instruction traces are being collected. */ */ +/* OBSOLETE */ +/* OBSOLETE static int tracing; */ +/* OBSOLETE */ +/* OBSOLETE /* Remembered PC. */ */ +/* OBSOLETE */ +/* OBSOLETE static CORE_ADDR last_pc; */ +/* OBSOLETE */ +/* OBSOLETE /* True when trace output should be displayed whenever program stops. */ */ +/* OBSOLETE */ +/* OBSOLETE static int trace_display; */ +/* OBSOLETE */ +/* OBSOLETE /* True when trace listing should include source lines. */ */ +/* OBSOLETE */ +/* OBSOLETE static int default_trace_show_source = 1; */ +/* OBSOLETE */ +/* OBSOLETE struct trace_buffer */ +/* OBSOLETE { */ +/* OBSOLETE int size; */ +/* OBSOLETE short *counts; */ +/* OBSOLETE CORE_ADDR *addrs; */ +/* OBSOLETE } */ +/* OBSOLETE trace_data; */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE trace_command (char *args, int from_tty) */ +/* OBSOLETE { */ +/* OBSOLETE /* Clear the host-side trace buffer, allocating space if needed. */ */ +/* OBSOLETE trace_data.size = 0; */ +/* OBSOLETE if (trace_data.counts == NULL) */ +/* OBSOLETE trace_data.counts = (short *) xmalloc (65536 * sizeof (short)); */ +/* OBSOLETE if (trace_data.addrs == NULL) */ +/* OBSOLETE trace_data.addrs = (CORE_ADDR *) xmalloc (65536 * sizeof (CORE_ADDR)); */ +/* OBSOLETE */ +/* OBSOLETE tracing = 1; */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("Tracing is now on.\n"); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE untrace_command (char *args, int from_tty) */ +/* OBSOLETE { */ +/* OBSOLETE tracing = 0; */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("Tracing is now off.\n"); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE trace_info (char *args, int from_tty) */ +/* OBSOLETE { */ +/* OBSOLETE int i; */ +/* OBSOLETE */ +/* OBSOLETE if (trace_data.size) */ +/* OBSOLETE { */ +/* OBSOLETE printf_filtered ("%d entries in trace buffer:\n", trace_data.size); */ +/* OBSOLETE */ +/* OBSOLETE for (i = 0; i < trace_data.size; ++i) */ +/* OBSOLETE { */ +/* OBSOLETE printf_filtered ("%d: %d instruction%s at 0x%s\n", */ +/* OBSOLETE i, trace_data.counts[i], */ +/* OBSOLETE (trace_data.counts[i] == 1 ? "" : "s"), */ +/* OBSOLETE paddr_nz (trace_data.addrs[i])); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE printf_filtered ("No entries in trace buffer.\n"); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("Tracing is currently %s.\n", (tracing ? "on" : "off")); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Print the instruction at address MEMADDR in debugged memory, */ +/* OBSOLETE on STREAM. Returns length of the instruction, in bytes. */ */ +/* OBSOLETE */ +/* OBSOLETE static int */ +/* OBSOLETE print_insn (CORE_ADDR memaddr, struct ui_file *stream) */ +/* OBSOLETE { */ +/* OBSOLETE /* If there's no disassembler, something is very wrong. */ */ +/* OBSOLETE if (tm_print_insn == NULL) */ +/* OBSOLETE internal_error (__FILE__, __LINE__, */ +/* OBSOLETE "print_insn: no disassembler"); */ +/* OBSOLETE */ +/* OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) */ +/* OBSOLETE tm_print_insn_info.endian = BFD_ENDIAN_BIG; */ +/* OBSOLETE else */ +/* OBSOLETE tm_print_insn_info.endian = BFD_ENDIAN_LITTLE; */ +/* OBSOLETE return TARGET_PRINT_INSN (memaddr, &tm_print_insn_info); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE d30v_eva_prepare_to_trace (void) */ +/* OBSOLETE { */ +/* OBSOLETE if (!tracing) */ +/* OBSOLETE return; */ +/* OBSOLETE */ +/* OBSOLETE last_pc = read_register (PC_REGNUM); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Collect trace data from the target board and format it into a form */ +/* OBSOLETE more useful for display. */ */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE d30v_eva_get_trace_data (void) */ +/* OBSOLETE { */ +/* OBSOLETE int count, i, j, oldsize; */ +/* OBSOLETE int trace_addr, trace_seg, trace_cnt, next_cnt; */ +/* OBSOLETE unsigned int last_trace, trace_word, next_word; */ +/* OBSOLETE unsigned int *tmpspace; */ +/* OBSOLETE */ +/* OBSOLETE if (!tracing) */ +/* OBSOLETE return; */ +/* OBSOLETE */ +/* OBSOLETE tmpspace = xmalloc (65536 * sizeof (unsigned int)); */ +/* OBSOLETE */ +/* OBSOLETE last_trace = read_memory_unsigned_integer (DBBC_ADDR, 2) << 2; */ +/* OBSOLETE */ +/* OBSOLETE /* Collect buffer contents from the target, stopping when we reach */ +/* OBSOLETE the word recorded when execution resumed. */ */ +/* OBSOLETE */ +/* OBSOLETE count = 0; */ +/* OBSOLETE while (last_trace > 0) */ +/* OBSOLETE { */ +/* OBSOLETE QUIT; */ +/* OBSOLETE trace_word = */ +/* OBSOLETE read_memory_unsigned_integer (TRACE_BUFFER_BASE + last_trace, 4); */ +/* OBSOLETE trace_addr = trace_word & 0xffff; */ +/* OBSOLETE last_trace -= 4; */ +/* OBSOLETE /* Ignore an apparently nonsensical entry. */ */ +/* OBSOLETE if (trace_addr == 0xffd5) */ +/* OBSOLETE continue; */ +/* OBSOLETE tmpspace[count++] = trace_word; */ +/* OBSOLETE if (trace_addr == last_pc) */ +/* OBSOLETE break; */ +/* OBSOLETE if (count > 65535) */ +/* OBSOLETE break; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Move the data to the host-side trace buffer, adjusting counts to */ +/* OBSOLETE include the last instruction executed and transforming the address */ +/* OBSOLETE into something that GDB likes. */ */ +/* OBSOLETE */ +/* OBSOLETE for (i = 0; i < count; ++i) */ +/* OBSOLETE { */ +/* OBSOLETE trace_word = tmpspace[i]; */ +/* OBSOLETE next_word = ((i == 0) ? 0 : tmpspace[i - 1]); */ +/* OBSOLETE trace_addr = trace_word & 0xffff; */ +/* OBSOLETE next_cnt = (next_word >> 24) & 0xff; */ +/* OBSOLETE j = trace_data.size + count - i - 1; */ +/* OBSOLETE trace_data.addrs[j] = (trace_addr << 2) + 0x1000000; */ +/* OBSOLETE trace_data.counts[j] = next_cnt + 1; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE oldsize = trace_data.size; */ +/* OBSOLETE trace_data.size += count; */ +/* OBSOLETE */ +/* OBSOLETE xfree (tmpspace); */ +/* OBSOLETE */ +/* OBSOLETE if (trace_display) */ +/* OBSOLETE display_trace (oldsize, trace_data.size); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE tdisassemble_command (char *arg, int from_tty) */ +/* OBSOLETE { */ +/* OBSOLETE int i, count; */ +/* OBSOLETE CORE_ADDR low, high; */ +/* OBSOLETE char *space_index; */ +/* OBSOLETE */ +/* OBSOLETE if (!arg) */ +/* OBSOLETE { */ +/* OBSOLETE low = 0; */ +/* OBSOLETE high = trace_data.size; */ +/* OBSOLETE } */ +/* OBSOLETE else if (!(space_index = (char *) strchr (arg, ' '))) */ +/* OBSOLETE { */ +/* OBSOLETE low = parse_and_eval_address (arg); */ +/* OBSOLETE high = low + 5; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE /* Two arguments. */ */ +/* OBSOLETE *space_index = '\0'; */ +/* OBSOLETE low = parse_and_eval_address (arg); */ +/* OBSOLETE high = parse_and_eval_address (space_index + 1); */ +/* OBSOLETE if (high < low) */ +/* OBSOLETE high = low; */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("Dump of trace from %s to %s:\n", */ +/* OBSOLETE paddr_u (low), */ +/* OBSOLETE paddr_u (high)); */ +/* OBSOLETE */ +/* OBSOLETE display_trace (low, high); */ +/* OBSOLETE */ +/* OBSOLETE printf_filtered ("End of trace dump.\n"); */ +/* OBSOLETE gdb_flush (gdb_stdout); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE static void */ +/* OBSOLETE display_trace (int low, int high) */ +/* OBSOLETE { */ +/* OBSOLETE int i, count, trace_show_source, first, suppress; */ +/* OBSOLETE CORE_ADDR next_address; */ +/* OBSOLETE */ +/* OBSOLETE trace_show_source = default_trace_show_source; */ +/* OBSOLETE if (!have_full_symbols () && !have_partial_symbols ()) */ +/* OBSOLETE { */ +/* OBSOLETE trace_show_source = 0; */ +/* OBSOLETE printf_filtered ("No symbol table is loaded. Use the \"file\" command.\n"); */ +/* OBSOLETE printf_filtered ("Trace will not display any source.\n"); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE first = 1; */ +/* OBSOLETE suppress = 0; */ +/* OBSOLETE for (i = low; i < high; ++i) */ +/* OBSOLETE { */ +/* OBSOLETE next_address = trace_data.addrs[i]; */ +/* OBSOLETE count = trace_data.counts[i]; */ +/* OBSOLETE while (count-- > 0) */ +/* OBSOLETE { */ +/* OBSOLETE QUIT; */ +/* OBSOLETE if (trace_show_source) */ +/* OBSOLETE { */ +/* OBSOLETE struct symtab_and_line sal, sal_prev; */ +/* OBSOLETE */ +/* OBSOLETE sal_prev = find_pc_line (next_address - 4, 0); */ +/* OBSOLETE sal = find_pc_line (next_address, 0); */ +/* OBSOLETE */ +/* OBSOLETE if (sal.symtab) */ +/* OBSOLETE { */ +/* OBSOLETE if (first || sal.line != sal_prev.line) */ +/* OBSOLETE print_source_lines (sal.symtab, sal.line, sal.line + 1, 0); */ +/* OBSOLETE suppress = 0; */ +/* OBSOLETE } */ +/* OBSOLETE else */ +/* OBSOLETE { */ +/* OBSOLETE if (!suppress) */ +/* OBSOLETE /* FIXME-32x64--assumes sal.pc fits in long. */ */ +/* OBSOLETE printf_filtered ("No source file for address %s.\n", */ +/* OBSOLETE local_hex_string ((unsigned long) sal.pc)); */ +/* OBSOLETE suppress = 1; */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE first = 0; */ +/* OBSOLETE print_address (next_address, gdb_stdout); */ +/* OBSOLETE printf_filtered (":"); */ +/* OBSOLETE printf_filtered ("\t"); */ +/* OBSOLETE wrap_here (" "); */ +/* OBSOLETE next_address = next_address + print_insn (next_address, gdb_stdout); */ +/* OBSOLETE printf_filtered ("\n"); */ +/* OBSOLETE gdb_flush (gdb_stdout); */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE extern void (*target_resume_hook) (void); */ +/* OBSOLETE extern void (*target_wait_loop_hook) (void); */ +/* OBSOLETE */ +/* OBSOLETE void */ +/* OBSOLETE _initialize_d30v_tdep (void) */ +/* OBSOLETE { */ +/* OBSOLETE tm_print_insn = print_insn_d30v; */ +/* OBSOLETE */ +/* OBSOLETE target_resume_hook = d30v_eva_prepare_to_trace; */ +/* OBSOLETE target_wait_loop_hook = d30v_eva_get_trace_data; */ +/* OBSOLETE */ +/* OBSOLETE add_info ("flags", print_flags_command, "Print d30v flags."); */ +/* OBSOLETE */ +/* OBSOLETE add_com ("trace", class_support, trace_command, */ +/* OBSOLETE "Enable tracing of instruction execution."); */ +/* OBSOLETE */ +/* OBSOLETE add_com ("untrace", class_support, untrace_command, */ +/* OBSOLETE "Disable tracing of instruction execution."); */ +/* OBSOLETE */ +/* OBSOLETE add_com ("tdisassemble", class_vars, tdisassemble_command, */ +/* OBSOLETE "Disassemble the trace buffer.\n\ */ +/* OBSOLETE Two optional arguments specify a range of trace buffer entries\n\ */ +/* OBSOLETE as reported by info trace (NOT addresses!)."); */ +/* OBSOLETE */ +/* OBSOLETE add_info ("trace", trace_info, */ +/* OBSOLETE "Display info about the trace data buffer."); */ +/* OBSOLETE */ +/* OBSOLETE add_show_from_set (add_set_cmd ("tracedisplay", no_class, */ +/* OBSOLETE var_integer, (char *) &trace_display, */ +/* OBSOLETE "Set automatic display of trace.\n", &setlist), */ +/* OBSOLETE &showlist); */ +/* OBSOLETE add_show_from_set (add_set_cmd ("tracesource", no_class, */ +/* OBSOLETE var_integer, (char *) &default_trace_show_source, */ +/* OBSOLETE "Set display of source code with trace.\n", &setlist), */ +/* OBSOLETE &showlist); */ +/* OBSOLETE */ +/* OBSOLETE } */ |