#include "gdbcore.h"
#include "gdbcmd.h"
#include "objfiles.h"
-#include "floatformat.h"
#include "regcache.h"
#include "trad-frame.h"
#include "frame-base.h"
static void
s390_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
regcache_cooked_write_unsigned (regcache, tdep->pc_regnum, pc);
static std::vector<CORE_ADDR>
s390_software_single_step (struct regcache *regcache)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
CORE_ADDR loc = regcache_read_pc (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len;
/* Check whether we are storing a register into the stack. */
- if (!pv_area_store_would_trash (data->stack, addr))
- pv_area_store (data->stack, addr, size, value);
+ if (!data->stack->store_would_trash (addr))
+ data->stack->store (addr, size, value);
/* Note: If this is some store we cannot identify, you might think we
}
/* Check whether we are accessing one of our save slots. */
- return pv_area_fetch (data->stack, addr, size);
+ return data->stack->fetch (addr, size);
}
/* Function for finding saved registers in a 'struct pv_area'; we pass
- this to pv_area_scan.
+ this to pv_area::scan.
If VALUE is a saved register, ADDR says it was saved at a constant
offset from the frame base, and SIZE indicates that the whole
/* The address of the next instruction after that. */
CORE_ADDR next_pc;
+ pv_area stack (S390_SP_REGNUM, gdbarch_addr_bit (gdbarch));
+ scoped_restore restore_stack = make_scoped_restore (&data->stack, &stack);
+
/* Set up everything's initial value. */
{
int i;
- data->stack = make_pv_area (S390_SP_REGNUM, gdbarch_addr_bit (gdbarch));
-
/* For the purpose of prologue tracking, we consider the GPR size to
be equal to the ABI word size, even if it is actually larger
(i.e. when running a 32-bit binary under a 64-bit kernel). */
}
/* Record where all the registers were saved. */
- pv_area_scan (data->stack, s390_check_for_saved, data);
-
- free_pv_area (data->stack);
- data->stack = NULL;
+ data->stack->scan (s390_check_for_saved, data);
return result;
}
return 0;
}
+typedef buf_displaced_step_closure s390_displaced_step_closure;
+
/* Implementation of gdbarch_displaced_step_copy_insn. */
static struct displaced_step_closure *
struct regcache *regs)
{
size_t len = gdbarch_max_insn_length (gdbarch);
- gdb_byte *buf = (gdb_byte *) xmalloc (len);
- struct cleanup *old_chain = make_cleanup (xfree, buf);
+ std::unique_ptr<s390_displaced_step_closure> closure
+ (new s390_displaced_step_closure (len));
+ gdb_byte *buf = closure->buf.data ();
read_memory (from, buf, len);
"RIL instruction: offset %s out of range\n",
plongest (offset));
}
- do_cleanups (old_chain);
+
return NULL;
}
displaced_step_dump_bytes (gdb_stdlog, buf, len);
}
- discard_cleanups (old_chain);
- return (struct displaced_step_closure *) buf;
+ return closure.release ();
}
/* Fix up the state of registers and memory after having single-stepped
a displaced instruction. */
static void
s390_displaced_step_fixup (struct gdbarch *gdbarch,
- struct displaced_step_closure *closure,
+ struct displaced_step_closure *closure_,
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs)
{
/* Our closure is a copy of the instruction. */
- gdb_byte *insn = (gdb_byte *) closure;
+ s390_displaced_step_closure *closure
+ = (s390_displaced_step_closure *) closure_;
+ gdb_byte *insn = closure->buf.data ();
static int s390_instrlen[] = { 2, 4, 4, 6 };
int insnlen = s390_instrlen[insn[0] >> 6];
static int
s390_all_but_pc_registers_record (struct regcache *regcache)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int i;
static int
s390_linux_syscall_record (struct regcache *regcache, LONGEST syscall_native)
{
- struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int ret;
enum gdb_syscall syscall_gdb;