/* Target-dependent code for the ALPHA architecture, for GDB, the GNU Debugger.
- Copyright (C) 1993-2014 Free Software Foundation, Inc.
+ Copyright (C) 1993-2016 Free Software Foundation, Inc.
This file is part of GDB.
#include "dis-asm.h"
#include "symfile.h"
#include "objfiles.h"
-#include <string.h>
#include "linespec.h"
#include "regcache.h"
#include "reggroups.h"
#include "elf-bfd.h"
#include "alpha-tdep.h"
+#include <algorithm>
/* Instruction decoding. The notations for registers, immediates and
opcodes are the same as the one used in Compaq's Alpha architecture
alpha_lds (struct gdbarch *gdbarch, void *out, const void *in)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- ULONGEST mem = extract_unsigned_integer (in, 4, byte_order);
+ ULONGEST mem
+ = extract_unsigned_integer ((const gdb_byte *) in, 4, byte_order);
ULONGEST frac = (mem >> 0) & 0x7fffff;
ULONGEST sign = (mem >> 31) & 1;
ULONGEST exp_msb = (mem >> 30) & 1;
}
reg = (sign << 63) | (exp << 52) | (frac << 29);
- store_unsigned_integer (out, 8, byte_order, reg);
+ store_unsigned_integer ((gdb_byte *) out, 8, byte_order, reg);
}
/* Similarly, this represents exactly the conversion performed by
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST reg, mem;
- reg = extract_unsigned_integer (in, 8, byte_order);
+ reg = extract_unsigned_integer ((const gdb_byte *) in, 8, byte_order);
mem = ((reg >> 32) & 0xc0000000) | ((reg >> 29) & 0x3fffffff);
- store_unsigned_integer (out, 4, byte_order, mem);
+ store_unsigned_integer ((gdb_byte *) out, 4, byte_order, mem);
}
/* The alpha needs a conversion between register and memory format if the
int len;
int offset;
};
- struct alpha_arg *alpha_args
- = (struct alpha_arg *) alloca (nargs * sizeof (struct alpha_arg));
+ struct alpha_arg *alpha_args = XALLOCAVEC (struct alpha_arg, nargs);
struct alpha_arg *m_arg;
gdb_byte arg_reg_buffer[ALPHA_REGISTER_SIZE * ALPHA_NUM_ARG_REGS];
int required_arg_regs;
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[ALPHA_INSN_SIZE];
- int status;
+ int res;
- status = target_read_memory (pc, buf, sizeof (buf));
- if (status)
- memory_error (status, pc);
+ res = target_read_memory (pc, buf, sizeof (buf));
+ if (res != 0)
+ memory_error (TARGET_XFER_E_IO, pc);
return extract_unsigned_integer (buf, sizeof (buf), byte_order);
}
post_prologue_pc = alpha_after_prologue (pc);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
/* Can't determine prologue from the symbol table, need to examine
instructions. */
struct gdbarch_tdep *tdep;
if (*this_prologue_cache)
- return *this_prologue_cache;
+ return (struct alpha_sigtramp_unwind_cache *) *this_prologue_cache;
info = FRAME_OBSTACK_ZALLOC (struct alpha_sigtramp_unwind_cache);
*this_prologue_cache = info;
int frame_reg, frame_size, return_reg, reg;
if (*this_prologue_cache)
- return *this_prologue_cache;
+ return (struct alpha_heuristic_unwind_cache *) *this_prologue_cache;
info = FRAME_OBSTACK_ZALLOC (struct alpha_heuristic_unwind_cache);
*this_prologue_cache = info;
alpha_supply_int_regs (struct regcache *regcache, int regno,
const void *r0_r30, const void *pc, const void *unique)
{
- const gdb_byte *regs = r0_r30;
+ const gdb_byte *regs = (const gdb_byte *) r0_r30;
int i;
for (i = 0; i < 31; ++i)
alpha_fill_int_regs (const struct regcache *regcache,
int regno, void *r0_r30, void *pc, void *unique)
{
- gdb_byte *regs = r0_r30;
+ gdb_byte *regs = (gdb_byte *) r0_r30;
int i;
for (i = 0; i < 31; ++i)
alpha_supply_fp_regs (struct regcache *regcache, int regno,
const void *f0_f30, const void *fpcr)
{
- const gdb_byte *regs = f0_f30;
+ const gdb_byte *regs = (const gdb_byte *) f0_f30;
int i;
for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; ++i)
alpha_fill_fp_regs (const struct regcache *regcache,
int regno, void *f0_f30, void *fpcr)
{
- gdb_byte *regs = f0_f30;
+ gdb_byte *regs = (gdb_byte *) f0_f30;
int i;
for (i = ALPHA_FP0_REGNUM; i < ALPHA_FP0_REGNUM + 31; ++i)
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
- /* Try to determine the ABI of the object we are loading. */
- if (info.abfd != NULL && info.osabi == GDB_OSABI_UNKNOWN)
- {
- /* If it's an ECOFF file, assume it's OSF/1. */
- if (bfd_get_flavour (info.abfd) == bfd_target_ecoff_flavour)
- info.osabi = GDB_OSABI_OSF1;
- }
-
/* Find a candidate among extant architectures. */
arches = gdbarch_list_lookup_by_info (arches, &info);
if (arches != NULL)
return arches->gdbarch;
- tdep = xmalloc (sizeof (struct gdbarch_tdep));
+ tdep = XNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
/* Lowest text address. This is used by heuristic_proc_start()
void
_initialize_alpha_tdep (void)
{
- struct cmd_list_element *c;
gdbarch_register (bfd_arch_alpha, alpha_gdbarch_init, NULL);