#include "regcache.h"
#include "value.h"
#include "gdb_assert.h"
-
+#include "dis-asm.h"
CORE_ADDR sig_fixed_saved_pc_valid;
CORE_ADDR sig_fixed_saved_pc;
CORE_ADDR frame_pointer_saved_pc; /* frame pointer needed for alloca */
+ CORE_ADDR stack_bought_valid;
CORE_ADDR stack_bought; /* amount we decrement the stack pointer by */
CORE_ADDR sigcontext;
};
static CORE_ADDR s390_frame_saved_pc_nofix (struct frame_info *fi);
static int
-s390_readinstruction (bfd_byte instr[], CORE_ADDR at,
- struct disassemble_info *info)
+s390_readinstruction (bfd_byte instr[], CORE_ADDR at)
{
int instrlen;
4,
6
};
- if ((*info->read_memory_func) (at, &instr[0], 2, info))
+ if (target_read_memory (at, &instr[0], 2))
return -1;
instrlen = s390_instrlen[instr[0] >> 6];
if (instrlen > 2)
{
- if ((*info->read_memory_func) (at + 2, &instr[2], instrlen - 2, info))
+ if (target_read_memory (at + 2, &instr[2], instrlen - 2))
return -1;
}
return instrlen;
&& get_frame_extra_info (next_frame)->sigcontext)
{
/* We're definitely backtracing from a signal handler. */
- CORE_ADDR *saved_regs = get_frame_saved_regs (fi);
+ CORE_ADDR *saved_regs = deprecated_get_frame_saved_regs (fi);
CORE_ADDR save_reg_addr = (get_frame_extra_info (next_frame)->sigcontext
- + REGISTER_BYTE (S390_GP0_REGNUM));
+ + DEPRECATED_REGISTER_BYTE (S390_GP0_REGNUM));
int reg;
for (reg = 0; reg < S390_NUM_GPRS; reg++)
-1 if we got an error trying to read memory. */
int result = 0;
- /* We just use this for reading instructions. */
- disassemble_info info;
-
/* The current PC for our abstract interpretation. */
CORE_ADDR pc;
the SP, FP, or back chain. */
CORE_ADDR after_last_frame_setup_insn = start_pc;
- info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
-
/* Set up everything's initial value. */
{
int i;
for (pc = start_pc; ; pc = next_pc)
{
bfd_byte insn[S390_MAX_INSTR_SIZE];
- int insn_len = s390_readinstruction (insn, pc, &info);
+ int insn_len = s390_readinstruction (insn, pc);
/* Fields for various kinds of instructions. */
unsigned int b2, r1, r2, d2, x2, r3;
if (frame_size != -1)
{
+ fextra_info->stack_bought_valid = 1;
fextra_info->stack_bought = frame_size;
}
- the analysis gave us enough information to actually figure it
out. */
if (fi
- && get_frame_saved_regs (fi)
+ && deprecated_get_frame_saved_regs (fi)
&& original_sp != -1)
{
int slot_num;
CORE_ADDR slot_addr;
- CORE_ADDR *saved_regs = get_frame_saved_regs (fi);
+ CORE_ADDR *saved_regs = deprecated_get_frame_saved_regs (fi);
/* Scan the spill array; if a spill slot says it holds the
original value of some register, then record that slot's
s390_check_function_end (CORE_ADDR pc)
{
bfd_byte instr[S390_MAX_INSTR_SIZE];
- disassemble_info info;
int regidx, instrlen;
- info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
- instrlen = s390_readinstruction (instr, pc, &info);
+ instrlen = s390_readinstruction (instr, pc);
if (instrlen < 0)
return -1;
/* check for BR */
regidx = instr[1] & 0xf;
/* Check for LMG or LG */
instrlen =
- s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 6 : 4), &info);
+ s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 6 : 4));
if (instrlen < 0)
return -1;
if (GDB_TARGET_IS_ESAME)
return 0;
if (regidx == 14)
return 1;
- instrlen = s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 12 : 8),
- &info);
+ instrlen = s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 12 : 8));
if (instrlen < 0)
return -1;
if (GDB_TARGET_IS_ESAME)
s390_get_frame_info (s390_sniff_pc_function_start (get_frame_pc (fi), fi),
fextra_info_ptr, fi, 1);
}
- frameless = ((fextra_info_ptr->stack_bought == 0));
+ frameless = (fextra_info_ptr->stack_bought_valid
+ && fextra_info_ptr->stack_bought == 0);
}
return frameless;
CORE_ADDR *sregs, CORE_ADDR *sigcaller_pc)
{
bfd_byte instr[S390_MAX_INSTR_SIZE];
- disassemble_info info;
int instrlen;
CORE_ADDR scontext;
int retval = 0;
scontext = temp_sregs = 0;
- info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
- instrlen = s390_readinstruction (instr, pc, &info);
+ instrlen = s390_readinstruction (instr, pc);
if (sigcaller_pc)
*sigcaller_pc = 0;
if (((instrlen == S390_SYSCALL_SIZE) &&
*sigcaller_pc =
ADDR_BITS_REMOVE ((CORE_ADDR)
read_memory_integer (temp_sregs +
- REGISTER_BYTE
- (S390_PC_REGNUM),
+ DEPRECATED_REGISTER_BYTE (S390_PC_REGNUM),
S390_PSW_ADDR_SIZE));
}
}
int quick;
- if (get_frame_saved_regs (fi) == NULL)
+ if (deprecated_get_frame_saved_regs (fi) == NULL)
{
/* zalloc memsets the saved regs */
frame_saved_regs_zalloc (fi);
{
get_frame_extra_info (fi)->saved_pc_valid = 1;
if (get_frame_extra_info (fi)->good_prologue
- && get_frame_saved_regs (fi)[S390_RETADDR_REGNUM])
+ && deprecated_get_frame_saved_regs (fi)[S390_RETADDR_REGNUM])
get_frame_extra_info (fi)->saved_pc
= ADDR_BITS_REMOVE (read_memory_integer
- (get_frame_saved_regs (fi)[S390_RETADDR_REGNUM],
+ (deprecated_get_frame_saved_regs (fi)[S390_RETADDR_REGNUM],
S390_GPR_SIZE));
else
get_frame_extra_info (fi)->saved_pc
{
/* read sigregs,regs.gprs[11 or 15] */
prev_fp = read_memory_integer (sregs +
- REGISTER_BYTE (S390_GP0_REGNUM +
+ DEPRECATED_REGISTER_BYTE (S390_GP0_REGNUM +
(prev_fextra_info.
frame_pointer_saved_pc
? 11 : 15)),
}
else
{
- if (get_frame_saved_regs (thisframe))
+ if (deprecated_get_frame_saved_regs (thisframe))
{
int regno;
if (prev_fextra_info.frame_pointer_saved_pc
- && get_frame_saved_regs (thisframe)[S390_FRAME_REGNUM])
+ && deprecated_get_frame_saved_regs (thisframe)[S390_FRAME_REGNUM])
regno = S390_FRAME_REGNUM;
else
regno = S390_SP_REGNUM;
- if (get_frame_saved_regs (thisframe)[regno])
+ if (deprecated_get_frame_saved_regs (thisframe)[regno])
{
/* The SP's entry of `saved_regs' is special. */
if (regno == S390_SP_REGNUM)
- prev_fp = get_frame_saved_regs (thisframe)[regno];
+ prev_fp = deprecated_get_frame_saved_regs (thisframe)[regno];
else
prev_fp =
- read_memory_integer (get_frame_saved_regs (thisframe)[regno],
+ read_memory_integer (deprecated_get_frame_saved_regs (thisframe)[regno],
S390_GPR_SIZE);
}
}
+/* NOTE: cagney/2003-10-31: "return_value" makes
+ "extract_struct_value_address", "extract_return_value", and
+ "use_struct_convention" redundant. */
+static CORE_ADDR
+s390_cannot_extract_struct_value_address (struct regcache *regcache)
+{
+ return 0;
+}
+
/* a given return value in `regbuf' with a type `valtype', extract and copy its
value into `valbuf' */
static void
int len = TYPE_LENGTH (valtype);
if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
- memcpy (valbuf, ®buf[REGISTER_BYTE (S390_FP0_REGNUM)], len);
+ memcpy (valbuf, ®buf[DEPRECATED_REGISTER_BYTE (S390_FP0_REGNUM)], len);
else
{
int offset = 0;
if (TYPE_LENGTH (valtype) < S390_GPR_SIZE)
offset = S390_GPR_SIZE - TYPE_LENGTH (valtype);
memcpy (valbuf,
- regbuf + REGISTER_BYTE (S390_GP0_REGNUM + 2) + offset,
+ regbuf + DEPRECATED_REGISTER_BYTE (S390_GP0_REGNUM + 2) + offset,
TYPE_LENGTH (valtype));
}
}
{
if (TYPE_LENGTH (valtype) == 4
|| TYPE_LENGTH (valtype) == 8)
- deprecated_write_register_bytes (REGISTER_BYTE (S390_FP0_REGNUM),
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (S390_FP0_REGNUM),
valbuf, TYPE_LENGTH (valtype));
else
error ("GDB is unable to return `long double' values "
value =
s390_promote_integer_argument (valtype, valbuf, reg_buff, &arglen);
/* Everything else is returned in GPR2 and up. */
- deprecated_write_register_bytes (REGISTER_BYTE (S390_GP0_REGNUM + 2),
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (S390_GP0_REGNUM + 2),
value, arglen);
}
}
-static int
-gdb_print_insn_s390 (bfd_vma memaddr, disassemble_info * info)
-{
- bfd_byte instrbuff[S390_MAX_INSTR_SIZE];
- int instrlen, cnt;
-
- instrlen = s390_readinstruction (instrbuff, (CORE_ADDR) memaddr, info);
- if (instrlen < 0)
- {
- (*info->memory_error_func) (instrlen, memaddr, info);
- return -1;
- }
- for (cnt = 0; cnt < instrlen; cnt++)
- info->fprintf_func (info->stream, "%02X ", instrbuff[cnt]);
- for (cnt = instrlen; cnt < S390_MAX_INSTR_SIZE; cnt++)
- info->fprintf_func (info->stream, " ");
- instrlen = print_insn_s390 (memaddr, info);
- return instrlen;
-}
-
/* Not the most efficent code in the world */
write_register (S390_PC_REGNUM, DEPRECATED_FRAME_SAVED_PC (frame));
/* Restore any saved registers. */
- if (get_frame_saved_regs (frame))
+ if (deprecated_get_frame_saved_regs (frame))
{
for (regnum = 0; regnum < NUM_REGS; regnum++)
- if (get_frame_saved_regs (frame)[regnum] != 0)
+ if (deprecated_get_frame_saved_regs (frame)[regnum] != 0)
{
ULONGEST value;
- value = read_memory_unsigned_integer (get_frame_saved_regs (frame)[regnum],
- REGISTER_RAW_SIZE (regnum));
+ value = read_memory_unsigned_integer (deprecated_get_frame_saved_regs (frame)[regnum],
+ DEPRECATED_REGISTER_RAW_SIZE (regnum));
write_register (regnum, value);
}
/* Actually cut back the stack. Remember that the SP's element of
saved_regs is the old SP itself, not the address at which it is
saved. */
- write_register (S390_SP_REGNUM, get_frame_saved_regs (frame)[S390_SP_REGNUM]);
+ write_register (S390_SP_REGNUM, deprecated_get_frame_saved_regs (frame)[S390_SP_REGNUM]);
}
/* Throw away any cached frame information. */
}
-/* Round ADDR up to the next N-byte boundary. N must be a power of
- two. */
-static CORE_ADDR
-round_up (CORE_ADDR addr, int n)
-{
- /* Check that N is really a power of two. */
- gdb_assert (n && (n & (n-1)) == 0);
- return ((addr + n - 1) & -n);
-}
-
-
-/* Round ADDR down to the next N-byte boundary. N must be a power of
- two. */
-static CORE_ADDR
-round_down (CORE_ADDR addr, int n)
-{
- /* Check that N is really a power of two. */
- gdb_assert (n && (n & (n-1)) == 0);
- return (addr & -n);
-}
-
-
/* Return the alignment required by TYPE. */
static int
alignment_of (struct type *type)
&& pass_by_copy_ref (type))
{
sp -= length;
- sp = round_down (sp, alignment_of (type));
+ sp = align_down (sp, alignment_of (type));
write_memory (sp, VALUE_CONTENTS (arg), length);
copy_addr[i] = sp;
num_copies++;
struct type *type = VALUE_TYPE (arg);
int length = TYPE_LENGTH (type);
- sp = round_down (sp, alignment_of (type));
+ sp = align_down (sp, alignment_of (type));
/* SIMPLE_ARG values get extended to DEPRECATED_REGISTER_SIZE bytes.
Assume every argument is. */
}
/* Include space for any reference-to-copy pointers. */
- sp = round_down (sp, pointer_size);
+ sp = align_down (sp, pointer_size);
sp -= num_copies * pointer_size;
/* After all that, make sure it's still aligned on an eight-byte
boundary. */
- sp = round_down (sp, 8);
+ sp = align_down (sp, 8);
/* Finally, place the actual parameters, working from SP towards
higher addresses. The code above is supposed to reserve enough
{
/* When we store a single-precision value in an FP register,
it occupies the leftmost bits. */
- deprecated_write_register_bytes (REGISTER_BYTE (S390_FP0_REGNUM + fr),
+ deprecated_write_register_bytes (DEPRECATED_REGISTER_BYTE (S390_FP0_REGNUM + fr),
VALUE_CONTENTS (arg),
TYPE_LENGTH (type));
fr += 2;
{
/* Simple args are always extended to
DEPRECATED_REGISTER_SIZE bytes. */
- starg = round_up (starg, DEPRECATED_REGISTER_SIZE);
+ starg = align_up (starg, DEPRECATED_REGISTER_SIZE);
/* Do we need to pass a pointer to our copy of this
argument? */
else
{
/* You'd think we should say:
- starg = round_up (starg, alignment_of (type));
+ starg = align_up (starg, alignment_of (type));
Unfortunately, GCC seems to simply align the stack on
a four/eight-byte boundary, even when passing doubles. */
- starg = round_up (starg, S390_STACK_PARAMETER_ALIGNMENT);
+ starg = align_up (starg, S390_STACK_PARAMETER_ALIGNMENT);
write_memory (starg, VALUE_CONTENTS (arg), length);
starg += length;
}
static CORE_ADDR
s390_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
{
- write_register (S390_RETADDR_REGNUM, CALL_DUMMY_ADDRESS ());
+ write_register (S390_RETADDR_REGNUM, entry_point_address ());
return sp;
}
/* 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);
+ set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default);
set_gdbarch_believe_pcc_promotion (gdbarch, 0);
set_gdbarch_char_signed (gdbarch, 0);
set_gdbarch_stab_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
set_gdbarch_dwarf_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_stab_reg_to_regnum);
- set_gdbarch_deprecated_extract_struct_value_address
- (gdbarch, generic_cannot_extract_struct_value_address);
+ set_gdbarch_extract_struct_value_address (gdbarch, s390_cannot_extract_struct_value_address);
/* Parameters for inferior function calls. */
set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point);
/* Should be using push_dummy_call. */
set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
+ set_gdbarch_print_insn (gdbarch, print_insn_s390);
+
return gdbarch;
}
/* Hook us into the gdbarch mechanism. */
register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init);
- if (!deprecated_tm_print_insn) /* Someone may have already set it */
- deprecated_tm_print_insn = gdb_print_insn_s390;
}