2001-12-13 14:34:41 +01:00
|
|
|
/* Target-dependent code for the Sanyo Xstormy16a (LC590000) processor.
|
2002-04-18 20:09:09 +02:00
|
|
|
|
2003-01-04 23:37:49 +01:00
|
|
|
Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "value.h"
|
|
|
|
#include "inferior.h"
|
|
|
|
#include "symfile.h"
|
|
|
|
#include "arch-utils.h"
|
|
|
|
#include "regcache.h"
|
|
|
|
#include "gdbcore.h"
|
|
|
|
#include "objfiles.h"
|
|
|
|
|
|
|
|
struct gdbarch_tdep
|
|
|
|
{
|
|
|
|
/* gdbarch target dependent data here. Currently unused for Xstormy16. */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Extra info which is saved in each frame_info. */
|
|
|
|
struct frame_extra_info
|
|
|
|
{
|
|
|
|
int framesize;
|
|
|
|
int frameless_p;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum gdb_regnum
|
|
|
|
{
|
|
|
|
/* Xstormy16 has 16 general purpose registers (R0-R15) plus PC.
|
|
|
|
Functions will return their values in register R2-R7 as they fit.
|
|
|
|
Otherwise a hidden pointer to an big enough area is given as argument
|
|
|
|
to the function in r2. Further arguments are beginning in r3 then.
|
|
|
|
R13 is used as frame pointer when GCC compiles w/o optimization
|
|
|
|
R14 is used as "PSW", displaying the CPU status.
|
|
|
|
R15 is used implicitely as stack pointer. */
|
|
|
|
E_R0_REGNUM,
|
|
|
|
E_R1_REGNUM,
|
|
|
|
E_R2_REGNUM, E_1ST_ARG_REGNUM = E_R2_REGNUM, E_PTR_RET_REGNUM = E_R2_REGNUM,
|
|
|
|
E_R3_REGNUM,
|
|
|
|
E_R4_REGNUM,
|
|
|
|
E_R5_REGNUM,
|
|
|
|
E_R6_REGNUM,
|
|
|
|
E_R7_REGNUM, E_LST_ARG_REGNUM = E_R7_REGNUM,
|
|
|
|
E_R8_REGNUM,
|
|
|
|
E_R9_REGNUM,
|
|
|
|
E_R10_REGNUM,
|
|
|
|
E_R11_REGNUM,
|
|
|
|
E_R12_REGNUM,
|
|
|
|
E_R13_REGNUM, E_FP_REGNUM = E_R13_REGNUM,
|
|
|
|
E_R14_REGNUM, E_PSW_REGNUM = E_R14_REGNUM,
|
|
|
|
E_R15_REGNUM, E_SP_REGNUM = E_R15_REGNUM,
|
|
|
|
E_PC_REGNUM,
|
|
|
|
E_NUM_REGS
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Size of instructions, registers, etc. */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
xstormy16_inst_size = 2,
|
|
|
|
xstormy16_reg_size = 2,
|
|
|
|
xstormy16_pc_size = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Size of return datatype which fits into the remaining return registers. */
|
|
|
|
#define E_MAX_RETTYPE_SIZE(regnum) ((E_LST_ARG_REGNUM - (regnum) + 1) \
|
|
|
|
* xstormy16_reg_size)
|
|
|
|
|
|
|
|
/* Size of return datatype which fits into all return registers. */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
E_MAX_RETTYPE_SIZE_IN_REGS = E_MAX_RETTYPE_SIZE (E_R2_REGNUM)
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Size of all registers as a whole. */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
E_ALL_REGS_SIZE = (E_NUM_REGS - 1) * xstormy16_reg_size + xstormy16_pc_size
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Function: xstormy16_register_name
|
|
|
|
Returns the name of the standard Xstormy16 register N. */
|
|
|
|
|
2002-06-18 01:32:36 +02:00
|
|
|
static const char *
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_register_name (int regnum)
|
|
|
|
{
|
|
|
|
static char *register_names[] = {
|
|
|
|
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
|
|
"r8", "r9", "r10", "r11", "r12", "r13",
|
|
|
|
"psw", "sp", "pc"
|
|
|
|
};
|
|
|
|
|
|
|
|
if (regnum < 0 ||
|
|
|
|
regnum >= sizeof (register_names) / sizeof (register_names[0]))
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
"xstormy16_register_name: illegal register number %d",
|
|
|
|
regnum);
|
|
|
|
else
|
|
|
|
return register_names[regnum];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_register_byte
|
|
|
|
Returns the byte position in the register cache for register N. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
xstormy16_register_byte (int regnum)
|
|
|
|
{
|
|
|
|
if (regnum < 0 || regnum >= E_NUM_REGS)
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
"xstormy16_register_byte: illegal register number %d",
|
|
|
|
regnum);
|
|
|
|
else
|
|
|
|
/* All registers occupy 2 bytes in the regcache except for PC
|
|
|
|
which is the last one. Therefore the byte position is still
|
|
|
|
simply a multiple of 2. */
|
|
|
|
return regnum * xstormy16_reg_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_register_raw_size
|
|
|
|
Returns the number of bytes occupied by the register on the target. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
xstormy16_register_raw_size (int regnum)
|
|
|
|
{
|
|
|
|
if (regnum < 0 || regnum >= E_NUM_REGS)
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
"xstormy16_register_raw_size: illegal register number %d",
|
|
|
|
regnum);
|
|
|
|
/* Only the PC has 4 Byte, all other registers 2 Byte. */
|
|
|
|
else if (regnum == E_PC_REGNUM)
|
|
|
|
return xstormy16_pc_size;
|
|
|
|
else
|
|
|
|
return xstormy16_reg_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_register_virtual_size
|
|
|
|
Returns the number of bytes occupied by the register as represented
|
|
|
|
internally by gdb. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
xstormy16_register_virtual_size (int regnum)
|
|
|
|
{
|
|
|
|
return xstormy16_register_raw_size (regnum);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_reg_virtual_type
|
|
|
|
Returns the default type for register N. */
|
|
|
|
|
|
|
|
static struct type *
|
|
|
|
xstormy16_reg_virtual_type (int regnum)
|
|
|
|
{
|
|
|
|
if (regnum < 0 || regnum >= E_NUM_REGS)
|
|
|
|
internal_error (__FILE__, __LINE__,
|
|
|
|
"xstormy16_register_virtual_type: illegal register number %d",
|
|
|
|
regnum);
|
|
|
|
else if (regnum == E_PC_REGNUM)
|
|
|
|
return builtin_type_uint32;
|
|
|
|
else
|
|
|
|
return builtin_type_uint16;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_get_saved_register
|
|
|
|
Find a register's saved value on the call stack. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
xstormy16_get_saved_register (char *raw_buffer,
|
|
|
|
int *optimized,
|
|
|
|
CORE_ADDR *addrp,
|
|
|
|
struct frame_info *fi,
|
|
|
|
int regnum, enum lval_type *lval)
|
|
|
|
{
|
2002-11-01 22:21:49 +01:00
|
|
|
deprecated_generic_get_saved_register (raw_buffer, optimized, addrp, fi, regnum, lval);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_type_is_scalar
|
|
|
|
Makes the decision if a given type is a scalar types. Scalar
|
|
|
|
types are returned in the registers r2-r7 as they fit. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
xstormy16_type_is_scalar (struct type *t)
|
|
|
|
{
|
|
|
|
return (TYPE_CODE(t) != TYPE_CODE_STRUCT
|
|
|
|
&& TYPE_CODE(t) != TYPE_CODE_UNION
|
|
|
|
&& TYPE_CODE(t) != TYPE_CODE_ARRAY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_extract_return_value
|
|
|
|
Copy the function's return value into VALBUF.
|
|
|
|
This function is called only in the context of "target function calls",
|
|
|
|
ie. when the debugger forces a function to be called in the child, and
|
|
|
|
when the debugger forces a function to return prematurely via the
|
|
|
|
"return" command. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
xstormy16_extract_return_value (struct type *type, char *regbuf, char *valbuf)
|
|
|
|
{
|
|
|
|
CORE_ADDR return_buffer;
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
if (xstormy16_type_is_scalar (type)
|
|
|
|
&& TYPE_LENGTH (type) <= E_MAX_RETTYPE_SIZE_IN_REGS)
|
|
|
|
{
|
|
|
|
/* Scalar return values of <= 12 bytes are returned in
|
|
|
|
E_1ST_ARG_REGNUM to E_LST_ARG_REGNUM. */
|
|
|
|
memcpy (valbuf,
|
|
|
|
®buf[REGISTER_BYTE (E_1ST_ARG_REGNUM)] + offset,
|
|
|
|
TYPE_LENGTH (type));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Aggregates and return values > 12 bytes are returned in memory,
|
|
|
|
pointed to by R2. */
|
|
|
|
return_buffer =
|
2003-06-02 04:09:40 +02:00
|
|
|
extract_unsigned_integer (regbuf + REGISTER_BYTE (E_PTR_RET_REGNUM),
|
|
|
|
REGISTER_RAW_SIZE (E_PTR_RET_REGNUM));
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_push_arguments
|
|
|
|
Setup the function arguments for GDB to call a function in the inferior.
|
|
|
|
Called only in the context of a target function call from the debugger.
|
|
|
|
Returns the value of the SP register after the args are pushed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|
|
|
int struct_return, CORE_ADDR struct_addr)
|
|
|
|
{
|
|
|
|
CORE_ADDR stack_dest = sp;
|
|
|
|
int argreg = E_1ST_ARG_REGNUM;
|
|
|
|
int i, j;
|
|
|
|
int typelen, slacklen;
|
|
|
|
char *val;
|
|
|
|
|
|
|
|
/* If struct_return is true, then the struct return address will
|
|
|
|
consume one argument-passing register. */
|
|
|
|
if (struct_return)
|
|
|
|
argreg++;
|
|
|
|
|
|
|
|
/* Arguments are passed in R2-R7 as they fit. If an argument doesn't
|
|
|
|
fit in the remaining registers we're switching over to the stack.
|
|
|
|
No argument is put on stack partially and as soon as we switched
|
|
|
|
over to stack no further argument is put in a register even if it
|
|
|
|
would fit in the remaining unused registers. */
|
|
|
|
for (i = 0; i < nargs && argreg <= E_LST_ARG_REGNUM; i++)
|
|
|
|
{
|
|
|
|
typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[i]));
|
|
|
|
if (typelen > E_MAX_RETTYPE_SIZE (argreg))
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Put argument into registers wordwise. */
|
|
|
|
val = VALUE_CONTENTS (args[i]);
|
|
|
|
for (j = 0; j < typelen; j += xstormy16_reg_size)
|
|
|
|
write_register (argreg++,
|
|
|
|
extract_unsigned_integer (val + j,
|
|
|
|
typelen - j ==
|
|
|
|
1 ? 1 :
|
|
|
|
xstormy16_reg_size));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Align SP */
|
|
|
|
if (stack_dest & 1)
|
|
|
|
++stack_dest;
|
|
|
|
|
|
|
|
/* Loop backwards through remaining arguments and push them on the stack,
|
|
|
|
wordaligned. */
|
|
|
|
for (j = nargs - 1; j >= i; j--)
|
|
|
|
{
|
|
|
|
typelen = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (args[j]));
|
|
|
|
slacklen = typelen & 1;
|
|
|
|
val = alloca (typelen + slacklen);
|
|
|
|
memcpy (val, VALUE_CONTENTS (args[j]), typelen);
|
|
|
|
memset (val + typelen, 0, slacklen);
|
|
|
|
|
|
|
|
/* Now write this data to the stack. The stack grows upwards. */
|
|
|
|
write_memory (stack_dest, val, typelen + slacklen);
|
|
|
|
stack_dest += typelen + slacklen;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* And that should do it. Return the new stack pointer. */
|
|
|
|
return stack_dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_push_return_address (pc)
|
|
|
|
Setup the return address for GDB to call a function in the inferior.
|
|
|
|
Called only in the context of a target function call from the debugger.
|
|
|
|
Returns the value of the SP register when the operation is finished
|
|
|
|
(which may or may not be the same as before).
|
|
|
|
*/
|
|
|
|
|
2003-06-11 15:16:30 +02:00
|
|
|
static CORE_ADDR
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
|
|
|
|
{
|
|
|
|
unsigned char buf[xstormy16_pc_size];
|
|
|
|
|
|
|
|
store_unsigned_integer (buf, xstormy16_pc_size, CALL_DUMMY_ADDRESS ());
|
|
|
|
write_memory (sp, buf, xstormy16_pc_size);
|
|
|
|
return sp + xstormy16_pc_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_pop_frame
|
|
|
|
Destroy the innermost (Top-Of-Stack) stack frame, restoring the
|
|
|
|
machine state that was in effect before the frame was created.
|
|
|
|
Used in the contexts of the "return" command, and of
|
|
|
|
target function calls from the debugger.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
xstormy16_pop_frame (void)
|
|
|
|
{
|
|
|
|
struct frame_info *fi = get_current_frame ();
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (fi == NULL)
|
|
|
|
return; /* paranoia */
|
|
|
|
|
2003-01-07 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_base.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10200-tdep.c: Ditto.
* mn10300-tdep.c, ns32k-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c: Ditto.
* x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* config/h8500/tm-h8500.h, config/mn10200/tm-mn10200.h: Ditto.
* config/sparc/tm-sparc.h: Ditto.
2003-01-08 02:53:38 +01:00
|
|
|
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
|
|
|
|
get_frame_base (fi)))
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
|
|
|
generic_pop_dummy_frame ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Restore the saved regs. */
|
|
|
|
for (i = 0; i < NUM_REGS; i++)
|
2003-01-03 Andrew Cagney <ac131313@redhat.com>
* alpha-tdep.c: Use get_frame_saved_regs.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-04 00:53:48 +01:00
|
|
|
if (get_frame_saved_regs (fi)[i])
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
|
|
|
if (i == SP_REGNUM)
|
2003-01-03 Andrew Cagney <ac131313@redhat.com>
* alpha-tdep.c: Use get_frame_saved_regs.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-04 00:53:48 +01:00
|
|
|
write_register (i, get_frame_saved_regs (fi)[i]);
|
2001-12-13 14:34:41 +01:00
|
|
|
else if (i == E_PC_REGNUM)
|
2003-01-03 Andrew Cagney <ac131313@redhat.com>
* alpha-tdep.c: Use get_frame_saved_regs.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-04 00:53:48 +01:00
|
|
|
write_register (i, read_memory_integer (get_frame_saved_regs (fi)[i],
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_pc_size));
|
|
|
|
else
|
2003-01-03 Andrew Cagney <ac131313@redhat.com>
* alpha-tdep.c: Use get_frame_saved_regs.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-04 00:53:48 +01:00
|
|
|
write_register (i, read_memory_integer (get_frame_saved_regs (fi)[i],
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_reg_size));
|
|
|
|
}
|
|
|
|
/* Restore the PC */
|
2003-03-12 17:50:47 +01:00
|
|
|
write_register (PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (fi));
|
2001-12-13 14:34:41 +01:00
|
|
|
flush_cached_frames ();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_store_struct_return
|
|
|
|
Copy the (struct) function return value to its destined location.
|
|
|
|
Called only in the context of a target function call from the debugger.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
xstormy16_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
|
|
|
|
{
|
|
|
|
write_register (E_PTR_RET_REGNUM, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_store_return_value
|
|
|
|
Copy the function return value from VALBUF into the
|
|
|
|
proper location for a function return.
|
|
|
|
Called only in the context of the "return" command.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
xstormy16_store_return_value (struct type *type, char *valbuf)
|
|
|
|
{
|
|
|
|
CORE_ADDR return_buffer;
|
|
|
|
char buf[xstormy16_reg_size];
|
|
|
|
|
|
|
|
if (xstormy16_type_is_scalar (type) && TYPE_LENGTH (type) == 1)
|
|
|
|
{
|
|
|
|
/* Add leading zeros to the value. */
|
|
|
|
memset (buf, 0, xstormy16_reg_size);
|
|
|
|
memcpy (buf, valbuf, 1);
|
2002-11-02 15:59:10 +01:00
|
|
|
deprecated_write_register_gen (E_1ST_ARG_REGNUM, buf);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
else if (xstormy16_type_is_scalar (type) &&
|
|
|
|
TYPE_LENGTH (type) <= E_MAX_RETTYPE_SIZE_IN_REGS)
|
2002-11-13 Andrew Cagney <cagney@redhat.com>
* regcache.h (deprecated_read_register_bytes): Rename
read_register_bytes.
(deprecated_write_register_bytes): Rename write_register_bytes.
* alpha-tdep.c, arm-tdep.c, cris-tdep.c, d10v-tdep.c: Update.
* dwarf2cfi.c, frv-tdep.c, hppa-tdep.c, ia64-tdep.c: Update.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Update.
* ns32k-tdep.c, regcache.c, remote-sds.c, remote-vx.c: Update.
* remote.c, rs6000-tdep.c, s390-tdep.c, sh-tdep.c: Update.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c, x86-64-tdep.c: Update.
* xstormy16-tdep.c, z8k-tdep.c, config/nm-gnu.h: Update.
* config/nm-m3.h, config/h8500/tm-h8500.h: Update.
* config/i386/nm-ptx4.h, config/i386/nm-symmetry.h: Update.
* config/m32r/tm-m32r.h, config/m68k/nm-sun3.h: Update.
* config/m68k/tm-delta68.h, config/m68k/tm-linux.h: Update.
* config/mn10200/tm-mn10200.h, config/pa/tm-hppa64.h: Update.
* config/sparc/nm-nbsd.h, config/sparc/nm-sun4os4.h: Update.
* config/sparc/nm-sun4sol2.h, config/sparc/tm-sparclet.h: Update.
2002-11-13 Andrew Cagney <ac131313@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Use
deprecated_write_register_bytes instead of write_register_bytes.
2002-11-14 01:25:05 +01:00
|
|
|
deprecated_write_register_bytes (REGISTER_BYTE (E_1ST_ARG_REGNUM),
|
|
|
|
valbuf, TYPE_LENGTH (type));
|
2001-12-13 14:34:41 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return_buffer = read_register (E_PTR_RET_REGNUM);
|
|
|
|
write_memory (return_buffer, valbuf, TYPE_LENGTH (type));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_extract_struct_value_address
|
|
|
|
Returns the address in which a function should return a struct value.
|
|
|
|
Used in the contexts of the "return" command, and of
|
|
|
|
target function calls from the debugger.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_extract_struct_value_address (char *regbuf)
|
|
|
|
{
|
2003-06-02 04:09:40 +02:00
|
|
|
return extract_unsigned_integer (regbuf + xstormy16_register_byte (E_PTR_RET_REGNUM),
|
|
|
|
xstormy16_reg_size);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_use_struct_convention
|
|
|
|
Returns non-zero if the given struct type will be returned using
|
|
|
|
a special convention, rather than the normal function return method.
|
|
|
|
7sed in the contexts of the "return" command, and of
|
|
|
|
target function calls from the debugger.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
xstormy16_use_struct_convention (int gcc_p, struct type *type)
|
|
|
|
{
|
|
|
|
return !xstormy16_type_is_scalar (type)
|
|
|
|
|| TYPE_LENGTH (type) > E_MAX_RETTYPE_SIZE_IN_REGS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: frame_saved_register
|
|
|
|
Returns the value that regnum had in frame fi
|
|
|
|
(saved in fi or in one of its children).
|
|
|
|
*/
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_frame_saved_register (struct frame_info *fi, int regnum)
|
|
|
|
{
|
|
|
|
int size = xstormy16_register_raw_size (regnum);
|
|
|
|
char *buf = (char *) alloca (size);
|
|
|
|
|
2002-11-01 22:21:49 +01:00
|
|
|
deprecated_generic_get_saved_register (buf, NULL, NULL, fi, regnum, NULL);
|
2001-12-13 14:34:41 +01:00
|
|
|
return (CORE_ADDR) extract_unsigned_integer (buf, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_scan_prologue
|
|
|
|
Decode the instructions within the given address range.
|
|
|
|
Decide when we must have reached the end of the function prologue.
|
|
|
|
If a frame_info pointer is provided, fill in its saved_regs etc.
|
|
|
|
|
|
|
|
Returns the address of the first instruction after the prologue.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static CORE_ADDR
|
2002-01-22 12:22:23 +01:00
|
|
|
xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
|
|
|
|
struct frame_info *fi, int *frameless)
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
|
|
|
CORE_ADDR sp = 0, fp = 0;
|
|
|
|
CORE_ADDR next_addr;
|
|
|
|
ULONGEST inst, inst2;
|
|
|
|
LONGEST offset;
|
|
|
|
int regnum;
|
|
|
|
|
2002-01-22 12:22:23 +01:00
|
|
|
if (frameless)
|
|
|
|
*frameless = 1;
|
2001-12-13 14:34:41 +01:00
|
|
|
if (fi)
|
|
|
|
{
|
|
|
|
/* In a call dummy, don't touch the frame. */
|
2003-01-07 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_base.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10200-tdep.c: Ditto.
* mn10300-tdep.c, ns32k-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c: Ditto.
* x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* config/h8500/tm-h8500.h, config/mn10200/tm-mn10200.h: Ditto.
* config/sparc/tm-sparc.h: Ditto.
2003-01-08 02:53:38 +01:00
|
|
|
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
|
|
|
|
get_frame_base (fi)))
|
2001-12-13 14:34:41 +01:00
|
|
|
return start_addr;
|
|
|
|
|
|
|
|
/* Grab the frame-relative values of SP and FP, needed below.
|
|
|
|
The frame_saved_register function will find them on the
|
|
|
|
stack or in the registers as appropriate. */
|
|
|
|
sp = xstormy16_frame_saved_register (fi, E_SP_REGNUM);
|
|
|
|
fp = xstormy16_frame_saved_register (fi, E_FP_REGNUM);
|
|
|
|
|
|
|
|
/* Initialize framesize with size of PC put on stack by CALLF inst. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_extra_info (fi)->framesize = xstormy16_pc_size;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
for (next_addr = start_addr;
|
|
|
|
next_addr < end_addr; next_addr += xstormy16_inst_size)
|
|
|
|
{
|
|
|
|
inst = read_memory_unsigned_integer (next_addr, xstormy16_inst_size);
|
|
|
|
inst2 = read_memory_unsigned_integer (next_addr + xstormy16_inst_size,
|
|
|
|
xstormy16_inst_size);
|
|
|
|
|
|
|
|
if (inst >= 0x0082 && inst <= 0x008d) /* push r2 .. push r13 */
|
|
|
|
{
|
|
|
|
if (fi)
|
|
|
|
{
|
|
|
|
regnum = inst & 0x000f;
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize;
|
|
|
|
get_frame_extra_info (fi)->framesize += xstormy16_reg_size;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* optional stack allocation for args and local vars <= 4 byte */
|
|
|
|
else if (inst == 0x301f || inst == 0x303f) /* inc r15, #0x1/#0x3 */
|
|
|
|
{
|
|
|
|
if (fi) /* Record the frame size. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_extra_info (fi)->framesize += ((inst & 0x0030) >> 4) + 1;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* optional stack allocation for args and local vars > 4 && < 16 byte */
|
|
|
|
else if ((inst & 0xff0f) == 0x510f) /* 51Hf add r15, #0xH */
|
|
|
|
{
|
|
|
|
if (fi) /* Record the frame size. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_extra_info (fi)->framesize += (inst & 0x00f0) >> 4;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* optional stack allocation for args and local vars >= 16 byte */
|
|
|
|
else if (inst == 0x314f && inst2 >= 0x0010) /* 314f HHHH add r15, #0xH */
|
|
|
|
{
|
|
|
|
if (fi) /* Record the frame size. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_extra_info (fi)->framesize += inst2;
|
2001-12-13 14:34:41 +01:00
|
|
|
next_addr += xstormy16_inst_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (inst == 0x46fd) /* mov r13, r15 */
|
|
|
|
{
|
|
|
|
if (fi) /* Record that the frame pointer is in use. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_extra_info (fi)->frameless_p = 0;
|
2002-01-22 12:22:23 +01:00
|
|
|
if (frameless)
|
|
|
|
*frameless = 0;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* optional copying of args in r2-r7 to r10-r13 */
|
|
|
|
/* Probably only in optimized case but legal action for prologue */
|
|
|
|
else if ((inst & 0xff00) == 0x4600 /* 46SD mov rD, rS */
|
|
|
|
&& (inst & 0x00f0) >= 0x0020 && (inst & 0x00f0) <= 0x0070
|
|
|
|
&& (inst & 0x000f) >= 0x00a0 && (inst & 0x000f) <= 0x000d)
|
|
|
|
;
|
|
|
|
|
|
|
|
/* optional copying of args in r2-r7 to stack */
|
|
|
|
/* 72DS HHHH mov.b (rD, 0xHHHH), r(S-8) (bit3 always 1, bit2-0 = reg) */
|
|
|
|
/* 73DS HHHH mov.w (rD, 0xHHHH), r(S-8) */
|
|
|
|
else if ((inst & 0xfed8) == 0x72d8 && (inst & 0x0007) >= 2)
|
|
|
|
{
|
|
|
|
if (fi)
|
|
|
|
{
|
|
|
|
regnum = inst & 0x0007;
|
|
|
|
/* Only 12 of 16 bits of the argument are used for the
|
|
|
|
signed offset. */
|
|
|
|
offset = (LONGEST) (inst2 & 0x0fff);
|
|
|
|
if (offset & 0x0800)
|
|
|
|
offset -= 0x1000;
|
|
|
|
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_saved_regs (fi)[regnum] = get_frame_extra_info (fi)->framesize + offset;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
next_addr += xstormy16_inst_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* 2001-08-10: Not part of the prologue anymore due to change in
|
|
|
|
ABI. r8 and r9 are not used for argument passing anymore. */
|
|
|
|
|
|
|
|
/* optional copying of r8, r9 to stack */
|
|
|
|
/* 46S7; 73Df HHHH mov.w r7,rS; mov.w (rD, 0xHHHH), r7 D=8,9; S=13,15 */
|
|
|
|
/* 46S7; 72df HHHH mov.w r7,rS; mov.b (rD, 0xHHHH), r7 D=8,9; S=13,15 */
|
|
|
|
else if ((inst & 0xffef) == 0x4687 && (inst2 & 0xfedf) == 0x72df)
|
|
|
|
{
|
|
|
|
next_addr += xstormy16_inst_size;
|
|
|
|
if (fi)
|
|
|
|
{
|
|
|
|
regnum = (inst & 0x00f0) >> 4;
|
|
|
|
inst = inst2;
|
|
|
|
inst2 = read_memory_unsigned_integer (next_addr
|
|
|
|
+ xstormy16_inst_size,
|
|
|
|
xstormy16_inst_size);
|
|
|
|
/* Only 12 of 16 bits of the argument are used for the
|
|
|
|
signed offset. */
|
|
|
|
offset = (LONGEST) (inst2 & 0x0fff);
|
|
|
|
if (offset & 0x0800)
|
|
|
|
offset -= 0x1000;
|
|
|
|
|
|
|
|
fi->saved_regs[regnum] = fi->extra_info->framesize + offset;
|
|
|
|
}
|
|
|
|
next_addr += xstormy16_inst_size;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
else /* Not a prologue instruction. */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fi)
|
|
|
|
{
|
|
|
|
/* Special handling for the "saved" address of the SP:
|
|
|
|
The SP is of course never saved on the stack at all, so
|
|
|
|
by convention what we put here is simply the previous
|
|
|
|
_value_ of the SP (as opposed to an address where the
|
|
|
|
previous value would have been pushed). */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
if (get_frame_extra_info (fi)->frameless_p)
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_saved_regs (fi)[E_SP_REGNUM] = sp - get_frame_extra_info (fi)->framesize;
|
2003-01-07 17:22:29 +01:00
|
|
|
deprecated_update_frame_base_hack (fi, sp);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_saved_regs (fi)[E_SP_REGNUM] = fp - get_frame_extra_info (fi)->framesize;
|
2003-01-07 17:22:29 +01:00
|
|
|
deprecated_update_frame_base_hack (fi, fp);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* So far only offsets to the beginning of the frame are
|
|
|
|
saved in the saved_regs. Now we now the relation between
|
|
|
|
sp, fp and framesize. We know the beginning of the frame
|
|
|
|
so we can translate the register offsets to real addresses. */
|
|
|
|
for (regnum = 0; regnum < E_SP_REGNUM; ++regnum)
|
2003-01-03 Andrew Cagney <ac131313@redhat.com>
* alpha-tdep.c: Use get_frame_saved_regs.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-04 00:53:48 +01:00
|
|
|
if (get_frame_saved_regs (fi)[regnum])
|
|
|
|
get_frame_saved_regs (fi)[regnum] += get_frame_saved_regs (fi)[E_SP_REGNUM];
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
/* Save address of PC on stack. */
|
2003-01-03 Andrew Cagney <ac131313@redhat.com>
* alpha-tdep.c: Use get_frame_saved_regs.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-04 00:53:48 +01:00
|
|
|
get_frame_saved_regs (fi)[E_PC_REGNUM] = get_frame_saved_regs (fi)[E_SP_REGNUM];
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return next_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_skip_prologue
|
|
|
|
If the input address is in a function prologue,
|
|
|
|
returns the address of the end of the prologue;
|
|
|
|
else returns the input address.
|
|
|
|
|
|
|
|
Note: the input address is likely to be the function start,
|
|
|
|
since this function is mainly used for advancing a breakpoint
|
|
|
|
to the first line, or stepping to the first line when we have
|
|
|
|
stepped into a function call. */
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_skip_prologue (CORE_ADDR pc)
|
|
|
|
{
|
|
|
|
CORE_ADDR func_addr = 0, func_end = 0;
|
|
|
|
char *func_name;
|
|
|
|
|
|
|
|
if (find_pc_partial_function (pc, &func_name, &func_addr, &func_end))
|
|
|
|
{
|
|
|
|
struct symtab_and_line sal;
|
|
|
|
struct symbol *sym;
|
|
|
|
|
2002-01-22 12:22:23 +01:00
|
|
|
/* Don't trust line number debug info in frameless functions. */
|
|
|
|
int frameless = 1;
|
|
|
|
CORE_ADDR plg_end = xstormy16_scan_prologue (func_addr, func_end,
|
|
|
|
NULL, &frameless);
|
|
|
|
if (frameless)
|
|
|
|
return plg_end;
|
|
|
|
|
2001-12-13 14:34:41 +01:00
|
|
|
/* Found a function. */
|
2003-05-14 Elena Zannoni <ezannoni@redhat.com>
* symtab.h (enum domain_enum): Rename from namespace_enum.
(UNDEF_DOMAIN, VAR_DOMAIN, STRUCT_DOMAIN, LABEL_DOMAIN,
VARIABLES_DOMAIN, FUNCTIONS_DOMAIN, TYPES_DOMAIN, METHODS_DOMAIN):
Rename from UNDEF_NAMESPACE, VAR_NAMESPACE, STRUCT_NAMESPACE,
LABEL_NAMESPACE, VARIABLES_NAMESPACE, FUNCTIONS_NAMESPACE,
TYPES_NAMESPACE, METHODS_NAMESPACE.
(SYMBOL_NAMESPACE): Rename to SYMBOL_DOMAIN.
(struct symbol, struct partial_symbol): Rename field
'namespace_enum namespace' to 'domain_enum domain'.
(PSYMBOL_NAMESPACE): Rename to PSYMBOL_DOMAIN.
Delete old define kludge for namespace.
* ada-exp.y, ada-lang.c, ada-lang.h, alpha-tdep.c, arm-tdep.c,
blockframe.c, c-exp.y, c-valprint.c, coffread.c, dbxread.c,
dwarf2read.c, dwarfread.c, f-exp.y, gdbtypes.c, gdbtypes.h,
gnu-v3-abi.c, hppa-tdep.c, hpread.c, jv-exp.y, jv-lang.c,
language.c, linespec.c, m2-exp.y, m3-nat.c, mdebugread.c,
mips-tdep.c, nlmread.c, objc-exp.y, objc-lang.c, objfiles.c,
p-exp.y, p-valprint.c, parse.c, printcmd.c, scm-lang.c, source.c,
stabsread.c, stack.c, symfile.c, symfile.h, symmisc.c, symtab.c,
valops.c, values.c, xcoffread.c, xstormy16-tdep.c: Replace all
occurrences of the above.
2003-05-12 Elena Zannoni <ezannoni@redhat.com>
* mi-mi-cmd-stack.c (list_args_or_locals): Rename VAR_NAMESPACE to
VAR_DOMAIN.
2003-05-14 19:43:20 +02:00
|
|
|
sym = lookup_symbol (func_name, NULL, VAR_DOMAIN, NULL, NULL);
|
2002-01-22 12:22:23 +01:00
|
|
|
/* Don't use line number debug info for assembly source files. */
|
2001-12-13 14:34:41 +01:00
|
|
|
if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
|
|
|
|
{
|
|
|
|
sal = find_pc_line (func_addr, 0);
|
|
|
|
if (sal.end && sal.end < func_end)
|
|
|
|
{
|
|
|
|
/* Found a line number, use it as end of prologue. */
|
|
|
|
return sal.end;
|
|
|
|
}
|
|
|
|
}
|
2002-01-22 12:22:23 +01:00
|
|
|
/* No useable line symbol. Use result of prologue parsing method. */
|
|
|
|
return plg_end;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* No function symbol -- just return the PC. */
|
|
|
|
|
|
|
|
return (CORE_ADDR) pc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The epilogue is defined here as the area at the end of a function,
|
|
|
|
either on the `ret' instruction itself or after an instruction which
|
|
|
|
destroys the function's stack frame. */
|
|
|
|
static int
|
|
|
|
xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|
|
|
{
|
|
|
|
CORE_ADDR addr, func_addr = 0, func_end = 0;
|
|
|
|
|
|
|
|
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
|
|
|
|
{
|
|
|
|
ULONGEST inst, inst2;
|
|
|
|
CORE_ADDR addr = func_end - xstormy16_inst_size;
|
|
|
|
|
|
|
|
/* The Xstormy16 epilogue is max. 14 bytes long. */
|
|
|
|
if (pc < func_end - 7 * xstormy16_inst_size)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Check if we're on a `ret' instruction. Otherwise it's
|
|
|
|
too dangerous to proceed. */
|
|
|
|
inst = read_memory_unsigned_integer (addr, xstormy16_inst_size);
|
|
|
|
if (inst != 0x0003)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
while ((addr -= xstormy16_inst_size) >= func_addr)
|
|
|
|
{
|
|
|
|
inst = read_memory_unsigned_integer (addr, xstormy16_inst_size);
|
|
|
|
if (inst >= 0x009a && inst <= 0x009d) /* pop r10...r13 */
|
|
|
|
continue;
|
|
|
|
if (inst == 0x305f || inst == 0x307f) /* dec r15, #0x1/#0x3 */
|
|
|
|
break;
|
|
|
|
inst2 = read_memory_unsigned_integer (addr - xstormy16_inst_size,
|
|
|
|
xstormy16_inst_size);
|
|
|
|
if (inst2 == 0x314f && inst >= 0x8000) /* add r15, neg. value */
|
|
|
|
{
|
|
|
|
addr -= xstormy16_inst_size;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (pc > addr)
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_frame_init_saved_regs
|
|
|
|
Set up the 'saved_regs' array.
|
|
|
|
This is a data structure containing the addresses on the stack
|
|
|
|
where each register has been saved, for each stack frame.
|
|
|
|
Registers that have not been saved will have zero here.
|
|
|
|
The stack register is special: rather than the address where the
|
|
|
|
stack register has been saved, saved_regs[SP_REGNUM] will have the
|
|
|
|
actual value of the previous frame's stack register.
|
|
|
|
|
|
|
|
This function may be called in any context where the saved register
|
2003-03-14 18:07:01 +01:00
|
|
|
values may be needed (backtrace, frame_info, frame_register). On
|
|
|
|
many targets, it is called directly by init_extra_frame_info, in
|
|
|
|
part because the information may be needed immediately by
|
|
|
|
frame_chain. */
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
static void
|
|
|
|
xstormy16_frame_init_saved_regs (struct frame_info *fi)
|
|
|
|
{
|
|
|
|
CORE_ADDR func_addr, func_end;
|
|
|
|
|
2003-01-03 Andrew Cagney <ac131313@redhat.com>
* alpha-tdep.c: Use get_frame_saved_regs.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-04 00:53:48 +01:00
|
|
|
if (!get_frame_saved_regs (fi))
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
|
|
|
frame_saved_regs_zalloc (fi);
|
|
|
|
|
|
|
|
/* Find the beginning of this function, so we can analyze its
|
|
|
|
prologue. */
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 23:20:47 +01:00
|
|
|
if (find_pc_partial_function (get_frame_pc (fi), NULL, &func_addr, &func_end))
|
|
|
|
xstormy16_scan_prologue (func_addr, get_frame_pc (fi), fi, NULL);
|
2001-12-13 14:34:41 +01:00
|
|
|
/* Else we're out of luck (can't debug completely stripped code).
|
|
|
|
FIXME. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_frame_saved_pc
|
|
|
|
Returns the return address for the selected frame.
|
2003-04-06 20:36:23 +02:00
|
|
|
Called by frame_info, legacy_frame_chain_valid, and sometimes by
|
|
|
|
get_prev_frame. */
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_frame_saved_pc (struct frame_info *fi)
|
|
|
|
{
|
|
|
|
CORE_ADDR saved_pc;
|
|
|
|
|
2003-01-07 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_base.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10200-tdep.c: Ditto.
* mn10300-tdep.c, ns32k-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c: Ditto.
* x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* config/h8500/tm-h8500.h, config/mn10200/tm-mn10200.h: Ditto.
* config/sparc/tm-sparc.h: Ditto.
2003-01-08 02:53:38 +01:00
|
|
|
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
|
|
|
|
get_frame_base (fi)))
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
2003-01-07 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_base.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10200-tdep.c: Ditto.
* mn10300-tdep.c, ns32k-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c: Ditto.
* x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* config/h8500/tm-h8500.h, config/mn10200/tm-mn10200.h: Ditto.
* config/sparc/tm-sparc.h: Ditto.
2003-01-08 02:53:38 +01:00
|
|
|
saved_pc = deprecated_read_register_dummy (get_frame_pc (fi),
|
|
|
|
get_frame_base (fi),
|
2002-09-17 22:42:01 +02:00
|
|
|
E_PC_REGNUM);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-01-03 Andrew Cagney <ac131313@redhat.com>
* alpha-tdep.c: Use get_frame_saved_regs.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-04 00:53:48 +01:00
|
|
|
saved_pc = read_memory_unsigned_integer (get_frame_saved_regs (fi)[E_PC_REGNUM],
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_pc_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return saved_pc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_init_extra_frame_info
|
|
|
|
This is the constructor function for the frame_info struct,
|
|
|
|
called whenever a new frame_info is created (from create_new_frame,
|
|
|
|
and from get_prev_frame).
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
xstormy16_init_extra_frame_info (int fromleaf, struct frame_info *fi)
|
|
|
|
{
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
if (!get_frame_extra_info (fi))
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
2003-01-07 15:51:11 +01:00
|
|
|
frame_extra_info_zalloc (fi, sizeof (struct frame_extra_info));
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
get_frame_extra_info (fi)->framesize = 0;
|
|
|
|
get_frame_extra_info (fi)->frameless_p = 1; /* Default frameless, detect framed */
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
/* By default, the fi->frame is set to the value of the FP reg by gdb.
|
|
|
|
This may not always be right; we may be in a frameless function,
|
|
|
|
or we may be in the prologue, before the FP has been set up.
|
|
|
|
Unfortunately, we can't make this determination without first
|
|
|
|
calling scan_prologue, and we can't do that unles we know the
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 23:20:47 +01:00
|
|
|
get_frame_pc (fi). */
|
2001-12-13 14:34:41 +01:00
|
|
|
|
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* arm-tdep.c: Use get_frame_pc and deprecated_update_frame_pc_hack
frame accessor methods.
* alpha-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c, mips-tdep.c: Ditto.
* mn10200-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Ditto.
* s390-tdep.c, sh-tdep.c, sparc-tdep.c, v850-tdep.c: Ditto.
* vax-tdep.c, x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* z8k-tdep.c: Ditto.
2003-01-02 23:20:47 +01:00
|
|
|
if (!get_frame_pc (fi))
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
|
|
|
/* Sometimes we are called from get_prev_frame without
|
|
|
|
the PC being set up first. Long history, don't ask.
|
|
|
|
Fortunately this will never happen from the outermost
|
|
|
|
frame, so we should be able to get the saved pc from
|
|
|
|
the next frame. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_next_frame.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* dwarf2cfi.c, h8300-tdep.c, i386-tdep.c, ia64-tdep.c: Ditto.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10200-tdep.c, mn10300-tdep.c: Ditto.
* ns32k-tdep.c, s390-tdep.c, sh-tdep.c, sparc-tdep.c: Ditto.
* v850-tdep.c, vax-tdep.c, x86-64-linux-tdep.c: Ditto.
* xstormy16-tdep.c: Ditto.
2003-01-08 16:56:38 +01:00
|
|
|
if (get_next_frame (fi))
|
|
|
|
deprecated_update_frame_pc_hack (fi, xstormy16_frame_saved_pc (get_next_frame (fi)));
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Take care of the saved_regs right here (non-lazy). */
|
|
|
|
xstormy16_frame_init_saved_regs (fi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_frame_chain
|
|
|
|
Returns a pointer to the stack frame of the calling function.
|
|
|
|
Called only from get_prev_frame. Needed for backtrace, "up", etc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_frame_chain (struct frame_info *fi)
|
|
|
|
{
|
2003-01-07 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_base.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10200-tdep.c: Ditto.
* mn10300-tdep.c, ns32k-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c: Ditto.
* x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* config/h8500/tm-h8500.h, config/mn10200/tm-mn10200.h: Ditto.
* config/sparc/tm-sparc.h: Ditto.
2003-01-08 02:53:38 +01:00
|
|
|
if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), get_frame_base (fi),
|
|
|
|
get_frame_base (fi)))
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
|
|
|
/* Call dummy's frame is the same as caller's. */
|
2003-01-07 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_base.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, i386-tdep.c, ia64-tdep.c, m68hc11-tdep.c: Ditto.
* m68k-tdep.c, mcore-tdep.c, mips-tdep.c, mn10200-tdep.c: Ditto.
* mn10300-tdep.c, ns32k-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, v850-tdep.c, vax-tdep.c: Ditto.
* x86-64-linux-tdep.c, xstormy16-tdep.c: Ditto.
* config/h8500/tm-h8500.h, config/mn10200/tm-mn10200.h: Ditto.
* config/sparc/tm-sparc.h: Ditto.
2003-01-08 02:53:38 +01:00
|
|
|
return get_frame_base (fi);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Return computed offset from this frame's fp. */
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
return get_frame_base (fi) - get_frame_extra_info (fi)->framesize;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xstormy16_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
|
|
|
|
{
|
2003-03-12 17:50:47 +01:00
|
|
|
return chain < 0x8000 && DEPRECATED_FRAME_SAVED_PC (thisframe) >= 0x8000 &&
|
2003-01-08 Andrew Cagney <cagney@redhat.com>
* alpha-tdep.c: Use get_frame_extra_info.
* arm-tdep.c, avr-tdep.c, cris-tdep.c, d10v-tdep.c: Ditto.
* h8300-tdep.c, ia64-tdep.c, m68hc11-tdep.c, mcore-tdep.c: Ditto.
* mips-tdep.c, mn10300-tdep.c, s390-tdep.c, sh-tdep.c: Ditto.
* sparc-tdep.c, xstormy16-tdep.c: Ditto.
2003-01-08 18:21:30 +01:00
|
|
|
(get_frame_extra_info (thisframe)->frameless_p ||
|
|
|
|
get_frame_base (thisframe) - get_frame_extra_info (thisframe)->framesize == chain);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
2003-03-14 18:07:01 +01:00
|
|
|
/* Function: xstormy16_saved_pc_after_call Returns the previous PC
|
|
|
|
immediately after a function call. This function is meant to
|
|
|
|
bypass the regular frame_register() mechanism, ie. it is meant to
|
|
|
|
work even if the frame isn't complete. Called by
|
|
|
|
step_over_function, and sometimes by get_prev_frame. */
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_saved_pc_after_call (struct frame_info *ignore)
|
|
|
|
{
|
|
|
|
CORE_ADDR sp, pc, tmp;
|
|
|
|
|
|
|
|
sp = read_register (E_SP_REGNUM) - xstormy16_pc_size;
|
|
|
|
pc = read_memory_integer (sp, xstormy16_pc_size);
|
|
|
|
|
|
|
|
/* Skip over jump table entry if necessary. */
|
|
|
|
if ((tmp = SKIP_TRAMPOLINE_CODE (pc)))
|
|
|
|
pc = tmp;
|
|
|
|
|
|
|
|
return pc;
|
|
|
|
}
|
|
|
|
|
2002-04-18 20:09:09 +02:00
|
|
|
const static unsigned char *
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
|
|
|
|
{
|
|
|
|
static unsigned char breakpoint[] = { 0x06, 0x0 };
|
|
|
|
*lenptr = sizeof (breakpoint);
|
|
|
|
return breakpoint;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given a pointer to a jump table entry, return the address
|
|
|
|
of the function it jumps to. Return 0 if not found. */
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_resolve_jmp_table_entry (CORE_ADDR faddr)
|
|
|
|
{
|
|
|
|
struct obj_section *faddr_sect = find_pc_section (faddr);
|
|
|
|
|
|
|
|
if (faddr_sect)
|
|
|
|
{
|
|
|
|
LONGEST inst, inst2, addr;
|
|
|
|
char buf[2 * xstormy16_inst_size];
|
|
|
|
|
|
|
|
/* Return faddr if it's not pointing into the jump table. */
|
|
|
|
if (strcmp (faddr_sect->the_bfd_section->name, ".plt"))
|
|
|
|
return faddr;
|
|
|
|
|
|
|
|
if (!target_read_memory (faddr, buf, sizeof buf))
|
|
|
|
{
|
|
|
|
inst = extract_unsigned_integer (buf, xstormy16_inst_size);
|
|
|
|
inst2 = extract_unsigned_integer (buf + xstormy16_inst_size,
|
|
|
|
xstormy16_inst_size);
|
|
|
|
addr = inst2 << 8 | (inst & 0xff);
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given a function's address, attempt to find (and return) the
|
|
|
|
address of the corresponding jump table entry. Return 0 if
|
|
|
|
not found. */
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_find_jmp_table_entry (CORE_ADDR faddr)
|
|
|
|
{
|
|
|
|
struct obj_section *faddr_sect = find_pc_section (faddr);
|
|
|
|
|
|
|
|
if (faddr_sect)
|
|
|
|
{
|
|
|
|
struct obj_section *osect;
|
|
|
|
|
|
|
|
/* Return faddr if it's already a pointer to a jump table entry. */
|
|
|
|
if (!strcmp (faddr_sect->the_bfd_section->name, ".plt"))
|
|
|
|
return faddr;
|
|
|
|
|
|
|
|
ALL_OBJFILE_OSECTIONS (faddr_sect->objfile, osect)
|
|
|
|
{
|
|
|
|
if (!strcmp (osect->the_bfd_section->name, ".plt"))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (osect < faddr_sect->objfile->sections_end)
|
|
|
|
{
|
|
|
|
CORE_ADDR addr;
|
|
|
|
for (addr = osect->addr;
|
|
|
|
addr < osect->endaddr; addr += 2 * xstormy16_inst_size)
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
LONGEST inst, inst2, faddr2;
|
|
|
|
char buf[2 * xstormy16_inst_size];
|
|
|
|
|
|
|
|
if (target_read_memory (addr, buf, sizeof buf))
|
|
|
|
return 0;
|
|
|
|
inst = extract_unsigned_integer (buf, xstormy16_inst_size);
|
|
|
|
inst2 = extract_unsigned_integer (buf + xstormy16_inst_size,
|
|
|
|
xstormy16_inst_size);
|
|
|
|
faddr2 = inst2 << 8 | (inst & 0xff);
|
|
|
|
if (faddr == faddr2)
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_skip_trampoline_code (CORE_ADDR pc)
|
|
|
|
{
|
|
|
|
int tmp = xstormy16_resolve_jmp_table_entry (pc);
|
|
|
|
|
|
|
|
if (tmp && tmp != pc)
|
|
|
|
return tmp;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xstormy16_in_solib_call_trampoline (CORE_ADDR pc, char *name)
|
|
|
|
{
|
|
|
|
return xstormy16_skip_trampoline_code (pc) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static CORE_ADDR
|
2003-01-06 19:49:09 +01:00
|
|
|
xstormy16_pointer_to_address (struct type *type, const void *buf)
|
2001-12-13 14:34:41 +01:00
|
|
|
{
|
|
|
|
enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
|
2003-06-02 04:09:40 +02:00
|
|
|
CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
|
|
|
|
{
|
|
|
|
CORE_ADDR addr2 = xstormy16_resolve_jmp_table_entry (addr);
|
|
|
|
if (addr2)
|
|
|
|
addr = addr2;
|
|
|
|
}
|
|
|
|
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
xstormy16_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
|
|
|
|
|
|
|
|
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
|
|
|
|
{
|
|
|
|
CORE_ADDR addr2 = xstormy16_find_jmp_table_entry (addr);
|
|
|
|
if (addr2)
|
|
|
|
addr = addr2;
|
|
|
|
}
|
2003-05-13 21:27:28 +02:00
|
|
|
store_unsigned_integer (buf, TYPE_LENGTH (type), addr);
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static CORE_ADDR
|
|
|
|
xstormy16_stack_align (CORE_ADDR addr)
|
|
|
|
{
|
|
|
|
if (addr & 1)
|
|
|
|
++addr;
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
2003-06-11 15:16:30 +02:00
|
|
|
static void
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_save_dummy_frame_tos (CORE_ADDR sp)
|
|
|
|
{
|
|
|
|
generic_save_dummy_frame_tos (sp - xstormy16_pc_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: xstormy16_gdbarch_init
|
|
|
|
Initializer function for the xstormy16 gdbarch vector.
|
|
|
|
Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
|
|
|
|
|
|
|
|
static struct gdbarch *
|
|
|
|
xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|
|
|
{
|
|
|
|
static LONGEST call_dummy_words[1] = { 0 };
|
|
|
|
struct gdbarch_tdep *tdep = NULL;
|
|
|
|
struct gdbarch *gdbarch;
|
|
|
|
|
|
|
|
/* find a candidate among the list of pre-declared architectures. */
|
|
|
|
arches = gdbarch_list_lookup_by_info (arches, &info);
|
|
|
|
if (arches != NULL)
|
|
|
|
return (arches->gdbarch);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
gdbarch = gdbarch_alloc (&info, 0);
|
|
|
|
|
2002-12-11 03:26:38 +01:00
|
|
|
/* NOTE: cagney/2002-12-06: This can be deleted when this arch is
|
|
|
|
ready to unwind the PC first (see frame.c:get_prev_frame()). */
|
|
|
|
set_gdbarch_deprecated_init_frame_pc (gdbarch, init_frame_pc_default);
|
|
|
|
|
2001-12-13 14:34:41 +01:00
|
|
|
/*
|
|
|
|
* Basic register fields and methods.
|
|
|
|
*/
|
|
|
|
|
|
|
|
set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
|
|
|
|
set_gdbarch_num_pseudo_regs (gdbarch, 0);
|
|
|
|
set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
|
2003-04-28 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_TARGET_READ_FP): Replace TARGET_READ_FP.
(DEPRECATED_FP_REGNUM): Replace FP_REGNUM.
* gdbarch.h, gdbarch.c: Re-generate.
* infcall.c (call_function_by_hand): Use DEPRECATED_FP_REGNUM,
DEPRECATED_TARGET_READ_FP, or "sp" to create the dummy frame ID.
* inferior.h (deprecated_read_fp): Rename read_fp.
(generic_target_read_fp): Delete declaration.
* regcache.c (generic_target_read_fp): Delete function.
(deprecated_read_fp): Replace read_fp, use
DEPRECATED_TARGET_READ_FP or DEPRECATED_FP_REGNUM.
* d10v-tdep.c (d10v_read_fp): Delete function.
(d10v_gdbarch_init): Do not set deprecated_read_fp.
* sparc-tdep.c (sparc_gdbarch_init): Do not set
deprecated_target_read_fp to generic_target_read_fp.
* sh-tdep.c (sh_gdbarch_init): Ditto.
* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
* frv-tdep.c (frv_gdbarch_init): Ditto.
* xstormy16-tdep.c (xstormy16_gdbarch_init): Set
deprecated_fp_regnum.
* x86-64-tdep.c (x86_64_init_abi): Ditto.
* vax-tdep.c (vax_gdbarch_init): Ditto.
* v850-tdep.c (v850_gdbarch_init): Ditto.
* sparc-tdep.c (sparc_gdbarch_init): Ditto.
* sh-tdep.c (sh_gdbarch_init): Ditto.
* s390-tdep.c (s390_gdbarch_init): Ditto.
* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
* mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
* mcore-tdep.c (mcore_gdbarch_init): Ditto.
* m68k-tdep.c (m68k_gdbarch_init): Ditto.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
* ia64-tdep.c (ia64_gdbarch_init): Ditto.
* i386-tdep.c (i386_gdbarch_init): Ditto.
* hppa-tdep.c (hppa_gdbarch_init): Ditto.
* h8300-tdep.c (h8300_gdbarch_init): Ditto.
* frv-tdep.c (frv_gdbarch_init): Ditto.
* cris-tdep.c (cris_gdbarch_init): Ditto.
* avr-tdep.c (avr_gdbarch_init): Ditto.
* arm-tdep.c (arm_gdbarch_init): Ditto.
* alpha-tdep.c (alpha_gdbarch_init): Ditto.
* x86-64-tdep.c (x86_64_init_abi): Set deprecated_target_read_fp.
* v850-tdep.c (v850_gdbarch_init): Ditto.
* sparc-tdep.c (sparc_gdbarch_init): Ditto.
* sh-tdep.c (sh_gdbarch_init): Ditto.
* s390-tdep.c (s390_gdbarch_init): Ditto.
* rs6000-tdep.c (rs6000_gdbarch_init): Ditto.
* mn10300-tdep.c (mn10300_gdbarch_init): Ditto.
* mips-tdep.c (mips_gdbarch_init): Ditto.
* m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto.
* ia64-tdep.c (ia64_gdbarch_init): Ditto.
* hppa-tdep.c (hppa_gdbarch_init): Ditto.
* frv-tdep.c (frv_gdbarch_init): Ditto.
* avr-tdep.c (avr_gdbarch_init): Ditto.
* arm-tdep.c (arm_gdbarch_init): Ditto.
* vax-tdep.c (vax_frame_init_saved_regs): Replace FP_REGNUM with
DEPRECATED_FP_REGNUM.
(vax_push_dummy_frame, vax_pop_frame): Ditto.
* std-regs.c (value_of_builtin_frame_fp_reg): Ditto.
* sparc-tdep.c (sparc_init_extra_frame_info): Ditto.
(sparc_push_dummy_frame, sparc64_read_fp): Ditto.
(sparc32_register_virtual_type): Ditto.
* sh-tdep.c (sh64_frame_chain): Ditto.
(sh64_get_saved_register, sh64_pop_frame): Ditto.
(sh_nofp_frame_init_saved_regs): Ditto.
(sh64_nofp_frame_init_saved_regs): Ditto.
(sh_fp_frame_init_saved_regs): Ditto.
* remote-mips.c (mips_wait, mips_fetch_registers): Ditto.
* remote-e7000.c (fetch_regs_from_dump): Ditto.
* procfs.c (procfs_fetch_registers): Ditto.
(procfs_store_registers): Ditto.
* ns32knbsd-nat.c (fetch_inferior_registers): Ditto.
(store_inferior_registers, fetch_core_registers): Ditto.
(fetch_kcore_registers, clear_regs): Ditto.
* ns32k-tdep.c (ns32k_frame_init_saved_regs): Ditto.
(ns32k_push_dummy_frame, ns32k_pop_frame): Ditto.
* nlm/i386.h (DEPRECATED_FP_REGNUM): Ditto.
* nlm/i386.c (do_status): Ditto.
* mipsv4-nat.c (supply_gregset): Ditto.
* mips-tdep.c: Ditto for comments.
* mips-nat.c (fetch_inferior_registers): Ditto.
(store_inferior_registers, fetch_core_registers): Ditto.
* m68k-tdep.c (m68k_push_dummy_frame): Ditto.
(m68k_pop_frame, m68k_frame_init_saved_regs): Ditto.
* i386-tdep.c (i386_frame_init_saved_regs): Ditto.
(i386_do_pop_frame, i386_register_type): Ditto.
* hppa-tdep.c (hppa_frame_chain): Ditto.
(hppa_push_dummy_frame, find_dummy_frame_regs): Ditto.
(hppa_pop_frame, hppa_read_fp): Ditto.
(skip_prologue_hard_way, hppa_frame_find_saved_regs): Ditto.
* cris-tdep.c (cris_examine, cris_pop_frame): Ditto.
* config/vax/nm-vax.h (REGISTER_U_ADDR): Ditto.
* config/sparc/tm-sparc.h (DEPRECATED_FP_REGNUM): Ditto.
* config/sparc/tm-sp64.h (DEPRECATED_FP_REGNUM): Ditto.
* config/s390/tm-s390.h (DEPRECATED_FP_REGNUM): Ditto.
* config/pa/tm-hppa64.h (DEPRECATED_FP_REGNUM): Ditto.
* config/ia64/tm-ia64.h (DEPRECATED_FP_REGNUM): Ditto.
* blockframe.c: Ditto for comments.
* arch-utils.h: Ditto for comments.
* arch-utils.c (legacy_virtual_frame_pointer): Ditto.
* alphanbsd-tdep.c (fetch_core_registers): Ditto.
* alphabsd-nat.c (fetch_inferior_registers): Ditto.
* alpha-tdep.h: Ditto for comments.
* alpha-tdep.c (alpha_cannot_fetch_register): Ditto.
(alpha_cannot_store_register): Ditto.
(alpha_push_dummy_frame): Ditto.
* alpha-nat.c (supply_gregset): Ditto.
* config/sparc/tm-sp64.h (DEPRECATED_TARGET_READ_FP): Update.
* config/pa/tm-hppa64.h (DEPRECATED_TARGET_READ_FP): Update.
* config/sparc/tm-sparc.h: Update comment.
* hppa-tdep.c (hppa_init_extra_frame_info): Use
deprecated_read_fp instead of TARGET_READ_FP.
(hppa_init_extra_frame_info, hppa_frame_chain): Ditto.
(hppa_push_dummy_frame, hppa_read_fp): Ditto.
* sparc-tdep.c (sparc_init_extra_frame_info): Use
deprecated_read_fp instead of read_fp.
* s390-tdep.c (s390_push_arguments): Ditto.
* ia64-tdep.c (ia64_gdbarch_init): Ditto.
* frame.h: Ditto in comments.
* frame.c (legacy_get_prev_frame): Ditto.
* dummy-frame.c (dummy_frame_this_id): Ditto.
* arm-tdep.c (arm_init_extra_frame_info): Ditto.
2003-04-28 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Replace
read_fp, TARGET_READ_FP and FP_REGNUM, with deprecated_read_fp,
DEPRECATED_TARGET_READ_FP and DEPRECATED_REGNUM.
2003-04-29 03:49:49 +02:00
|
|
|
set_gdbarch_deprecated_fp_regnum (gdbarch, E_FP_REGNUM);
|
2001-12-13 14:34:41 +01:00
|
|
|
set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
|
|
|
|
set_gdbarch_register_name (gdbarch, xstormy16_register_name);
|
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_SIZE): Rename REGISTER_SIZE.
(DEPRECATED_SIZEOF_CALL_DUMMY_WORDS): Rename
SIZEOF_CALL_DUMMY_WORDS.
(DEPRECATED_CALL_DUMMY_WORDS): Rename CALL_DUMMY_WORDS.
(DEPRECATED_FIX_CALL_DUMMY): Rename FIX_CALL_DUMMY.
(DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET): Rename
CALL_DUMMY_BREAKPOINT_OFFSET.
(DEPRECATED_CALL_DUMMY_START_OFFSET): Rename
CALL_DUMMY_START_OFFSET.
(DEPRECATED_CALL_DUMMY_LENGTH): Rename CALL_DUMMY_LENGTH.
* gdbarch.h, gdbarch.c: Re-generate.
* alpha-tdep.c, alphafbsd-tdep.c, arm-linux-tdep.c: Update.
* arm-tdep.c, avr-tdep.c, breakpoint.c, cris-tdep.c: Update.
* dummy-frame.c, dummy-frame.h, frv-tdep.c, gdbarch.c: Update.
* gdbarch.h, gdbarch.sh, h8300-tdep.c, hppa-tdep.c: Update.
* i386-tdep.c, ia64-tdep.c, infcall.c, inferior.h: Update.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Update.
* mips-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* rs6000-tdep.c, s390-tdep.c, sh-tdep.c, sol-thread.c: Update.
* sparc-tdep.c, target.c, v850-tdep.c, valops.c: Update.
* vax-tdep.c, x86-64-tdep.c, xstormy16-tdep.c: Update.
* config/ia64/tm-ia64.h, config/m68k/tm-vx68.h: Update.
* config/mips/tm-mips.h, config/pa/nm-hppah.h: Update.
* config/pa/tm-hppa.h, config/pa/tm-hppa64.h: Update.
* config/s390/tm-s390.h, config/sparc/tm-sp64.h: Update.
* config/sparc/tm-sparc.h: Update.
Index: doc/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Make
CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_LENGTH,
FIX_CALL_DUMMY, CALL_DUMMY_BREAKPOINT_OFFSET and
CALL_DUMMY_BREAKPOINT_OFFSET deprecated.
Index: mi/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Replace
REGISTER_SIZE with DEPRECATED_REGISTER_SIZE.
Index: testsuite/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdb.base/watchpoint.exp: Rename CALL_DUMMY_BREAKPOINT_OFFSET to
DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET in comments.
2003-05-05 19:56:57 +02:00
|
|
|
set_gdbarch_deprecated_register_size (gdbarch, xstormy16_reg_size);
|
2003-05-17 08:00:01 +02:00
|
|
|
set_gdbarch_deprecated_register_bytes (gdbarch, E_ALL_REGS_SIZE);
|
2001-12-13 14:34:41 +01:00
|
|
|
set_gdbarch_register_byte (gdbarch, xstormy16_register_byte);
|
|
|
|
set_gdbarch_register_raw_size (gdbarch, xstormy16_register_raw_size);
|
2003-03-03 21:50:20 +01:00
|
|
|
set_gdbarch_deprecated_max_register_raw_size (gdbarch, xstormy16_pc_size);
|
2001-12-13 14:34:41 +01:00
|
|
|
set_gdbarch_register_virtual_size (gdbarch, xstormy16_register_raw_size);
|
2003-03-03 21:50:20 +01:00
|
|
|
set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 4);
|
2001-12-13 14:34:41 +01:00
|
|
|
set_gdbarch_register_virtual_type (gdbarch, xstormy16_reg_virtual_type);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Frame Info
|
|
|
|
*/
|
2003-03-02 01:11:43 +01:00
|
|
|
set_gdbarch_deprecated_init_extra_frame_info (gdbarch,
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_init_extra_frame_info);
|
2003-03-02 05:02:25 +01:00
|
|
|
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch,
|
2001-12-13 14:34:41 +01:00
|
|
|
xstormy16_frame_init_saved_regs);
|
2003-03-24 04:54:51 +01:00
|
|
|
set_gdbarch_deprecated_frame_chain (gdbarch, xstormy16_frame_chain);
|
2003-03-14 17:05:36 +01:00
|
|
|
set_gdbarch_deprecated_get_saved_register (gdbarch, xstormy16_get_saved_register);
|
2003-04-11 20:15:40 +02:00
|
|
|
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, xstormy16_saved_pc_after_call);
|
2003-03-12 17:50:47 +01:00
|
|
|
set_gdbarch_deprecated_frame_saved_pc (gdbarch, xstormy16_frame_saved_pc);
|
2001-12-13 14:34:41 +01:00
|
|
|
set_gdbarch_skip_prologue (gdbarch, xstormy16_skip_prologue);
|
2003-03-24 04:54:51 +01:00
|
|
|
set_gdbarch_deprecated_frame_chain_valid (gdbarch, xstormy16_frame_chain_valid);
|
2001-12-13 14:34:41 +01:00
|
|
|
|
|
|
|
set_gdbarch_in_function_epilogue_p (gdbarch,
|
|
|
|
xstormy16_in_function_epilogue_p);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Miscelany
|
|
|
|
*/
|
|
|
|
/* Stack grows up. */
|
|
|
|
set_gdbarch_inner_than (gdbarch, core_addr_greaterthan);
|
|
|
|
/* PC stops zero byte after a trap instruction
|
|
|
|
(which means: exactly on trap instruction). */
|
|
|
|
set_gdbarch_decr_pc_after_break (gdbarch, 0);
|
|
|
|
/* This value is almost never non-zero... */
|
|
|
|
set_gdbarch_function_start_offset (gdbarch, 0);
|
|
|
|
/* This value is almost never non-zero... */
|
|
|
|
set_gdbarch_frame_args_skip (gdbarch, 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call Dummies
|
|
|
|
*
|
|
|
|
* These values and methods are used when gdb calls a target function. */
|
2003-03-30 16:32:09 +02:00
|
|
|
set_gdbarch_deprecated_push_return_address (gdbarch, xstormy16_push_return_address);
|
2002-06-15 00:55:51 +02:00
|
|
|
set_gdbarch_deprecated_extract_return_value (gdbarch, xstormy16_extract_return_value);
|
2003-03-26 23:39:53 +01:00
|
|
|
set_gdbarch_deprecated_push_arguments (gdbarch, xstormy16_push_arguments);
|
2003-03-13 22:45:43 +01:00
|
|
|
set_gdbarch_deprecated_pop_frame (gdbarch, xstormy16_pop_frame);
|
2003-03-25 21:38:47 +01:00
|
|
|
set_gdbarch_deprecated_store_struct_return (gdbarch, xstormy16_store_struct_return);
|
2002-08-24 02:21:37 +02:00
|
|
|
set_gdbarch_deprecated_store_return_value (gdbarch, xstormy16_store_return_value);
|
2002-06-15 00:55:51 +02:00
|
|
|
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, xstormy16_extract_struct_value_address);
|
2001-12-13 14:34:41 +01:00
|
|
|
set_gdbarch_use_struct_convention (gdbarch,
|
|
|
|
xstormy16_use_struct_convention);
|
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_REGISTER_SIZE): Rename REGISTER_SIZE.
(DEPRECATED_SIZEOF_CALL_DUMMY_WORDS): Rename
SIZEOF_CALL_DUMMY_WORDS.
(DEPRECATED_CALL_DUMMY_WORDS): Rename CALL_DUMMY_WORDS.
(DEPRECATED_FIX_CALL_DUMMY): Rename FIX_CALL_DUMMY.
(DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET): Rename
CALL_DUMMY_BREAKPOINT_OFFSET.
(DEPRECATED_CALL_DUMMY_START_OFFSET): Rename
CALL_DUMMY_START_OFFSET.
(DEPRECATED_CALL_DUMMY_LENGTH): Rename CALL_DUMMY_LENGTH.
* gdbarch.h, gdbarch.c: Re-generate.
* alpha-tdep.c, alphafbsd-tdep.c, arm-linux-tdep.c: Update.
* arm-tdep.c, avr-tdep.c, breakpoint.c, cris-tdep.c: Update.
* dummy-frame.c, dummy-frame.h, frv-tdep.c, gdbarch.c: Update.
* gdbarch.h, gdbarch.sh, h8300-tdep.c, hppa-tdep.c: Update.
* i386-tdep.c, ia64-tdep.c, infcall.c, inferior.h: Update.
* m68hc11-tdep.c, m68k-tdep.c, mcore-tdep.c: Update.
* mips-tdep.c, mn10300-tdep.c, ns32k-tdep.c: Update.
* rs6000-tdep.c, s390-tdep.c, sh-tdep.c, sol-thread.c: Update.
* sparc-tdep.c, target.c, v850-tdep.c, valops.c: Update.
* vax-tdep.c, x86-64-tdep.c, xstormy16-tdep.c: Update.
* config/ia64/tm-ia64.h, config/m68k/tm-vx68.h: Update.
* config/mips/tm-mips.h, config/pa/nm-hppah.h: Update.
* config/pa/tm-hppa.h, config/pa/tm-hppa64.h: Update.
* config/s390/tm-s390.h, config/sparc/tm-sp64.h: Update.
* config/sparc/tm-sparc.h: Update.
Index: doc/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Make
CALL_DUMMY_WORDS, SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_LENGTH,
FIX_CALL_DUMMY, CALL_DUMMY_BREAKPOINT_OFFSET and
CALL_DUMMY_BREAKPOINT_OFFSET deprecated.
Index: mi/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* mi-main.c (mi_cmd_data_write_register_values): Replace
REGISTER_SIZE with DEPRECATED_REGISTER_SIZE.
Index: testsuite/ChangeLog
2003-05-03 Andrew Cagney <cagney@redhat.com>
* gdb.base/watchpoint.exp: Rename CALL_DUMMY_BREAKPOINT_OFFSET to
DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET in comments.
2003-05-05 19:56:57 +02:00
|
|
|
set_gdbarch_deprecated_call_dummy_words (gdbarch, call_dummy_words);
|
|
|
|
set_gdbarch_deprecated_sizeof_call_dummy_words (gdbarch, 0);
|
2001-12-13 14:34:41 +01:00
|
|
|
set_gdbarch_breakpoint_from_pc (gdbarch, xstormy16_breakpoint_from_pc);
|
|
|
|
|
2003-03-25 17:12:56 +01:00
|
|
|
set_gdbarch_char_signed (gdbarch, 0);
|
2001-12-13 14:34:41 +01:00
|
|
|
set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
|
|
|
|
set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
|
|
|
|
set_gdbarch_addr_bit (gdbarch, 4 * TARGET_CHAR_BIT);
|
|
|
|
set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
|
|
|
|
|
|
|
|
set_gdbarch_address_to_pointer (gdbarch, xstormy16_address_to_pointer);
|
|
|
|
set_gdbarch_pointer_to_address (gdbarch, xstormy16_pointer_to_address);
|
|
|
|
|
|
|
|
set_gdbarch_stack_align (gdbarch, xstormy16_stack_align);
|
|
|
|
|
|
|
|
set_gdbarch_save_dummy_frame_tos (gdbarch, xstormy16_save_dummy_frame_tos);
|
|
|
|
|
|
|
|
set_gdbarch_skip_trampoline_code (gdbarch, xstormy16_skip_trampoline_code);
|
|
|
|
|
|
|
|
set_gdbarch_in_solib_call_trampoline (gdbarch,
|
|
|
|
xstormy16_in_solib_call_trampoline);
|
|
|
|
|
2003-03-30 16:59:02 +02:00
|
|
|
/* Should be using push_dummy_call. */
|
2003-06-08 00:38:56 +02:00
|
|
|
set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
|
2003-03-30 16:59:02 +02:00
|
|
|
|
2001-12-13 14:34:41 +01:00
|
|
|
return gdbarch;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: _initialize_xstormy16_tdep
|
|
|
|
Initializer function for the Sanyo Xstormy16a module.
|
|
|
|
Called by gdb at start-up. */
|
|
|
|
|
2003-06-11 15:16:30 +02:00
|
|
|
extern initialize_file_ftype _initialize_xstormy16_tdep; /* -Wmissing-prototypes */
|
|
|
|
|
2001-12-13 14:34:41 +01:00
|
|
|
void
|
|
|
|
_initialize_xstormy16_tdep (void)
|
|
|
|
{
|
|
|
|
extern int print_insn_xstormy16 ();
|
|
|
|
|
|
|
|
register_gdbarch_init (bfd_arch_xstormy16, xstormy16_gdbarch_init);
|
2003-04-28 18:17:29 +02:00
|
|
|
deprecated_tm_print_insn = print_insn_xstormy16;
|
2001-12-13 14:34:41 +01:00
|
|
|
}
|