static struct aarch64_prologue_cache *
aarch64_make_prologue_cache (const frame_info_ptr &this_frame, void **this_cache)
{
- struct aarch64_prologue_cache *cache;
-
if (*this_cache != NULL)
return (struct aarch64_prologue_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct aarch64_prologue_cache);
+ auto *cache = frame_obstack_zalloc<aarch64_prologue_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
*this_cache = cache;
static struct aarch64_prologue_cache *
aarch64_make_stub_cache (const frame_info_ptr &this_frame, void **this_cache)
{
- struct aarch64_prologue_cache *cache;
-
if (*this_cache != NULL)
return (struct aarch64_prologue_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct aarch64_prologue_cache);
+ auto *cache = frame_obstack_zalloc<aarch64_prologue_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
*this_cache = cache;
alpha_mdebug_frame_unwind_cache (const frame_info_ptr &this_frame,
void **this_prologue_cache)
{
- struct alpha_mdebug_unwind_cache *info;
struct mdebug_extra_func_info *proc_desc;
ULONGEST vfp;
CORE_ADDR pc, reg_position;
if (*this_prologue_cache)
return (struct alpha_mdebug_unwind_cache *) *this_prologue_cache;
- info = FRAME_OBSTACK_ZALLOC (struct alpha_mdebug_unwind_cache);
+ auto *info = frame_obstack_zalloc<alpha_mdebug_unwind_cache> ();
*this_prologue_cache = info;
pc = get_frame_address_in_block (this_frame);
alpha_sigtramp_frame_unwind_cache (const frame_info_ptr &this_frame,
void **this_prologue_cache)
{
- struct alpha_sigtramp_unwind_cache *info;
-
if (*this_prologue_cache)
return (struct alpha_sigtramp_unwind_cache *) *this_prologue_cache;
- info = FRAME_OBSTACK_ZALLOC (struct alpha_sigtramp_unwind_cache);
+ auto *info = frame_obstack_zalloc<alpha_sigtramp_unwind_cache> ();
*this_prologue_cache = info;
gdbarch *arch = get_frame_arch (this_frame);
CORE_ADDR start_pc)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct alpha_heuristic_unwind_cache *info;
ULONGEST val;
CORE_ADDR limit_pc, cur_pc;
int frame_reg, frame_size, return_reg, reg;
if (*this_prologue_cache)
return (struct alpha_heuristic_unwind_cache *) *this_prologue_cache;
- info = FRAME_OBSTACK_ZALLOC (struct alpha_heuristic_unwind_cache);
+ auto *info = frame_obstack_zalloc<alpha_heuristic_unwind_cache> ();
*this_prologue_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
static struct amd64_frame_cache *
amd64_alloc_frame_cache (void)
{
- struct amd64_frame_cache *cache;
-
- cache = FRAME_OBSTACK_ZALLOC (struct amd64_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct amd64_frame_cache> ();
amd64_init_frame_cache (cache);
return cache;
}
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct amd64_windows_frame_cache *cache;
std::array<gdb_byte, 8> buf;
CORE_ADDR pc;
CORE_ADDR unwind_info = 0;
if (*this_cache)
return (struct amd64_windows_frame_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct amd64_windows_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct amd64_windows_frame_cache> ();
*this_cache = cache;
/* Get current PC and SP. */
if (*this_cache != nullptr)
return (struct amdgpu_frame_cache *) *this_cache;
- struct amdgpu_frame_cache *cache
- = FRAME_OBSTACK_ZALLOC (struct amdgpu_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct amdgpu_frame_cache> ();
(*this_cache) = cache;
cache->pc = get_frame_func (this_frame);
}
/* Allocate new frame cache instance and space for saved register info.
- FRAME_OBSTACK_ZALLOC will initialize fields to zeroes. */
- struct arc_frame_cache *cache
- = FRAME_OBSTACK_ZALLOC (struct arc_frame_cache);
+ frame_obstack_zalloc will initialize fields to zeroes. */
+ auto *cache = frame_obstack_zalloc<arc_frame_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
arc_analyze_prologue (gdbarch, entrypoint, prologue_end, cache);
arc_gdbarch_tdep *tdep = gdbarch_tdep<arc_gdbarch_tdep> (arch);
/* Allocate new frame cache instance and space for saved register info. */
- struct arc_frame_cache *cache = FRAME_OBSTACK_ZALLOC (struct arc_frame_cache);
+ auto *cache = frame_obstack_zalloc<arc_frame_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
/* Get the stack pointer and use it as the frame base. */
arm_make_prologue_cache (const frame_info_ptr &this_frame)
{
int reg;
- struct arm_prologue_cache *cache;
CORE_ADDR unwound_fp, prev_sp;
- cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
+ auto *cache = frame_obstack_zalloc<arm_prologue_cache> ();
arm_cache_init (cache, this_frame);
arm_scan_prologue (this_frame, cache);
CORE_ADDR vsp = 0;
int vsp_valid = 0;
- struct arm_prologue_cache *cache;
- cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
+ auto *cache = frame_obstack_zalloc<arm_prologue_cache> ();
arm_cache_init (cache, this_frame);
for (;;)
static struct arm_prologue_cache *
arm_make_epilogue_frame_cache (const frame_info_ptr &this_frame)
{
- struct arm_prologue_cache *cache;
int reg;
- cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
+ auto *cache = frame_obstack_zalloc<arm_prologue_cache> ();
arm_cache_init (cache, this_frame);
/* Still rely on the offset calculated from prologue. */
static struct arm_prologue_cache *
arm_make_stub_cache (const frame_info_ptr &this_frame)
{
- struct arm_prologue_cache *cache;
-
- cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
+ auto *cache = frame_obstack_zalloc<arm_prologue_cache> ();
arm_cache_init (cache, this_frame);
arm_gdbarch_tdep *tdep
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
arm_gdbarch_tdep *tdep = gdbarch_tdep<arm_gdbarch_tdep> (gdbarch);
- struct arm_prologue_cache *cache;
- cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
+ auto *cache = frame_obstack_zalloc<arm_prologue_cache> ();
arm_cache_init (cache, this_frame);
/* ARMv7-M Architecture Reference "B1.5.6 Exception entry behavior"
CORE_ADDR start_pc, current_pc;
ULONGEST prev_sp;
ULONGEST this_base;
- struct avr_unwind_cache *info;
struct gdbarch *gdbarch;
int i;
if (*this_prologue_cache)
return (struct avr_unwind_cache *) *this_prologue_cache;
- info = FRAME_OBSTACK_ZALLOC (struct avr_unwind_cache);
+ auto *info = frame_obstack_zalloc<avr_unwind_cache> ();
*this_prologue_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
static struct bfin_frame_cache *
bfin_alloc_frame_cache (void)
{
- struct bfin_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct bfin_frame_cache);
+ auto *cache = frame_obstack_zalloc<bfin_frame_cache> ();
/* Base address. */
cache->base = 0;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
cris_gdbarch_tdep *tdep = gdbarch_tdep<cris_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct cris_unwind_cache *info;
CORE_ADDR addr;
gdb_byte buf[4];
int i;
if ((*this_cache))
return (struct cris_unwind_cache *) (*this_cache);
- info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
+ auto *info = frame_obstack_zalloc<cris_unwind_cache> ();
(*this_cache) = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
cris_gdbarch_tdep *tdep = gdbarch_tdep<cris_gdbarch_tdep> (gdbarch);
- struct cris_unwind_cache *info;
if ((*this_prologue_cache))
return (struct cris_unwind_cache *) (*this_prologue_cache);
- info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
+ auto *info = frame_obstack_zalloc<cris_unwind_cache> ();
(*this_prologue_cache) = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
csky_frame_unwind_cache (const frame_info_ptr &this_frame)
{
CORE_ADDR prologue_start, prologue_end, func_end, prev_pc, block_addr;
- struct csky_unwind_cache *cache;
const struct block *bl;
unsigned long func_size = 0;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
/* Default lr type is r15. */
lr_type_t lr_type = LR_TYPE_R15;
- cache = FRAME_OBSTACK_ZALLOC (struct csky_unwind_cache);
+ auto *cache = frame_obstack_zalloc<csky_unwind_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
/* Assume there is no frame until proven otherwise. */
static struct csky_unwind_cache *
csky_make_stub_cache (const frame_info_ptr &this_frame)
{
- struct csky_unwind_cache *cache;
-
- cache = FRAME_OBSTACK_ZALLOC (struct csky_unwind_cache);
+ auto *cache = frame_obstack_zalloc<struct csky_unwind_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
cache->prev_sp = get_frame_register_unsigned (this_frame, CSKY_SP_REGNUM);
{
if (dummy_frame_id_eq (&dummyframe->id, &dummy_id))
{
- struct dummy_frame_cache *cache;
-
- cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache);
+ auto *cache = frame_obstack_zalloc<dummy_frame_cache> ();
cache->prev_regcache = get_infcall_suspend_state_regcache
(dummyframe->caller_state);
cache->this_id = this_id;
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
const int num_regs = gdbarch_num_cooked_regs (gdbarch);
- struct dwarf2_frame_cache *cache;
struct dwarf2_fde *fde;
CORE_ADDR entry_pc;
const gdb_byte *instr;
return (struct dwarf2_frame_cache *) *this_cache;
/* Allocate a new cache. */
- cache = FRAME_OBSTACK_ZALLOC (struct dwarf2_frame_cache);
- cache->reg = FRAME_OBSTACK_CALLOC (num_regs, struct dwarf2_frame_state_reg);
+ auto *cache = frame_obstack_zalloc<struct dwarf2_frame_cache> ();
+ cache->reg = frame_obstack_calloc<dwarf2_frame_state_reg> (num_regs);
*this_cache = cache;
/* Unwind the PC.
dwarf2_frame_allocate_fn_data (const frame_info_ptr &this_frame, void **this_cache,
fn_prev_register cookie, unsigned long size)
{
- struct dwarf2_frame_fn_data *fn_data = nullptr;
struct dwarf2_frame_cache *cache
= dwarf2_frame_cache (this_frame, this_cache);
gdb_assert (data == nullptr);
/* No object found, lets create a new instance. */
- fn_data = FRAME_OBSTACK_ZALLOC (struct dwarf2_frame_fn_data);
+ auto *fn_data = frame_obstack_zalloc<dwarf2_frame_fn_data> ();
fn_data->cookie = cookie;
fn_data->data = frame_obstack_zalloc (size);
fn_data->next = cache->fn_data;
THIS_PROLOGUE_CACHE can be used to share any prolog analysis data
with the other unwind methods. Memory for that cache should be
- allocated using FRAME_OBSTACK_ZALLOC(). */
+ allocated using frame_obstack_zalloc. */
typedef void (frame_this_id_ftype) (const frame_info_ptr &this_frame,
void **this_prologue_cache,
THIS_PROLOGUE_CACHE can be used to share any prolog analysis data
with the other unwind methods. Memory for that cache should be
- allocated using FRAME_OBSTACK_ZALLOC(). */
+ allocated using frame_obstack_zalloc. */
typedef value *(frame_prev_register_ftype) (const frame_info_ptr &this_frame,
void **this_prologue_cache,
regcache *regcache, CORE_ADDR stack_addr,
CORE_ADDR code_addr)
{
- frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
+ frame_info *frame = frame_obstack_zalloc<frame_info> ();
frame->level = -1;
frame->pspace = pspace;
if (frame != nullptr)
return frame;
- frame_info *fi = FRAME_OBSTACK_ZALLOC (struct frame_info);
+ frame_info *fi = frame_obstack_zalloc<frame_info> ();
fi->next = create_sentinel_frame (current_program_space,
current_inferior ()->aspace.get (),
quickly reclaimed when the frame cache is flushed, and the `we've
been here before' check above will stop repeated memory
allocation calls. */
- prev_frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
+ prev_frame = frame_obstack_zalloc<frame_info> ();
prev_frame->level = this_frame->level + 1;
/* For now, assume we don't have frame chains crossing address
allocate memory using this method. */
extern void *frame_obstack_zalloc (unsigned long size);
-#define FRAME_OBSTACK_ZALLOC(TYPE) \
- ((TYPE *) frame_obstack_zalloc (sizeof (TYPE)))
-#define FRAME_OBSTACK_CALLOC(NUMBER,TYPE) \
- ((TYPE *) frame_obstack_zalloc ((NUMBER) * sizeof (TYPE)))
+
+/* Allocate one instance of T using frame_obstack_zalloc. */
+
+template <typename T>
+T *
+frame_obstack_zalloc ()
+{
+ return static_cast<T *> (frame_obstack_zalloc (sizeof (T)));
+}
+
+/* Allocate N instances of T using frame_obstack_zalloc. */
+
+template <typename T>
+T *
+frame_obstack_calloc (int n)
+{
+ return static_cast<T *> (frame_obstack_zalloc (n * sizeof (T)));
+}
class readonly_detached_regcache;
/* Create a regcache, and copy the frame's registers into it. */
void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct frv_unwind_cache *info;
if ((*this_prologue_cache))
return (struct frv_unwind_cache *) (*this_prologue_cache);
- info = FRAME_OBSTACK_ZALLOC (struct frv_unwind_cache);
+ auto *info = frame_obstack_zalloc<frv_unwind_cache> ();
(*this_prologue_cache) = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
static struct ft32_frame_cache *
ft32_alloc_frame_cache (void)
{
- struct ft32_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct ft32_frame_cache);
+ auto *cache = frame_obstack_zalloc<ft32_frame_cache> ();
for (i = 0; i < FT32_NUM_REGS; ++i)
cache->saved_regs[i] = REG_UNAVAIL;
h8300_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct h8300_frame_cache *cache;
int i;
CORE_ADDR current_pc;
if (*this_cache)
return (struct h8300_frame_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct h8300_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct h8300_frame_cache> ();
h8300_init_frame_cache (gdbarch, cache);
*this_cache = cache;
void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct hppa_linux_sigtramp_unwind_cache *info;
CORE_ADDR pc, scptr;
int i;
if (*this_cache)
return (struct hppa_linux_sigtramp_unwind_cache *) *this_cache;
- info = FRAME_OBSTACK_ZALLOC (struct hppa_linux_sigtramp_unwind_cache);
+ auto *info = frame_obstack_zalloc<hppa_linux_sigtramp_unwind_cache> ();
*this_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
- struct hppa_frame_cache *cache;
long saved_gr_mask;
long saved_fr_mask;
long frame_size;
paddress (gdbarch, ((struct hppa_frame_cache *)*this_cache)->base));
return (struct hppa_frame_cache *) (*this_cache);
}
- cache = FRAME_OBSTACK_ZALLOC (struct hppa_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct hppa_frame_cache> ();
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct hppa_frame_cache *cache;
unsigned int frame_size = 0;
int found_rp = 0;
CORE_ADDR start_pc;
"{ hppa_fallback_frame_cache (frame=%d) -> ",
frame_relative_level (this_frame));
- cache = FRAME_OBSTACK_ZALLOC (struct hppa_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct hppa_frame_cache> ();
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
hppa_stub_frame_unwind_cache (const frame_info_ptr &this_frame,
void **this_cache)
{
- struct hppa_stub_unwind_cache *info;
-
if (*this_cache)
return (struct hppa_stub_unwind_cache *) *this_cache;
- info = FRAME_OBSTACK_ZALLOC (struct hppa_stub_unwind_cache);
+ auto *info = frame_obstack_zalloc<hppa_stub_unwind_cache> ();
*this_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
static struct i386_frame_cache *
i386_alloc_frame_cache (void)
{
- struct i386_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct i386_frame_cache);
+ auto *cache = frame_obstack_zalloc<i386_frame_cache> ();
/* Base address. */
cache->base_p = 0;
unw_addr_space_t as;
unw_word_t fp;
unw_regnum_t uw_sp_regnum;
- struct libunwind_frame_cache *cache;
struct libunwind_descr *descr;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int ret;
return (struct libunwind_frame_cache *) *this_cache;
/* Allocate a new cache. */
- cache = FRAME_OBSTACK_ZALLOC (struct libunwind_frame_cache);
+ auto *cache = frame_obstack_zalloc<libunwind_frame_cache> ();
cache->func_addr = get_frame_func (this_frame);
if (cache->func_addr == 0)
static struct ia64_frame_cache *
ia64_alloc_frame_cache (void)
{
- struct ia64_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct ia64_frame_cache);
+ auto *cache = frame_obstack_zalloc<ia64_frame_cache> ();
/* Base address. */
cache->base = 0;
iq2000_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct iq2000_frame_cache *cache;
CORE_ADDR current_pc;
int i;
if (*this_cache)
return (struct iq2000_frame_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct iq2000_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct iq2000_frame_cache> ();
iq2000_init_frame_cache (cache);
*this_cache = cache;
CORE_ADDR current_pc;
ULONGEST prev_sp;
ULONGEST this_base;
- struct lm32_frame_cache *info;
int i;
if ((*this_prologue_cache))
return (struct lm32_frame_cache *) (*this_prologue_cache);
- info = FRAME_OBSTACK_ZALLOC (struct lm32_frame_cache);
+ auto *info = frame_obstack_zalloc<struct lm32_frame_cache> ();
(*this_prologue_cache) = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
static struct loongarch_frame_cache *
loongarch_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
- struct loongarch_frame_cache *cache;
-
if (*this_cache != NULL)
return (struct loongarch_frame_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct loongarch_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct loongarch_frame_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
*this_cache = cache;
if (! func_start)
stop_addr = func_start;
- *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct m32c_prologue);
+ *this_prologue_cache = frame_obstack_zalloc<m32c_prologue> ();
m32c_analyze_prologue (get_frame_arch (this_frame),
func_start, stop_addr,
(struct m32c_prologue *) *this_prologue_cache);
m32r_linux_sigtramp_frame_cache (const frame_info_ptr &this_frame,
void **this_cache)
{
- struct m32r_frame_cache *cache;
CORE_ADDR sigcontext_addr, addr;
int regnum;
if ((*this_cache) != NULL)
return (struct m32r_frame_cache *) (*this_cache);
- cache = FRAME_OBSTACK_ZALLOC (struct m32r_frame_cache);
+ auto *cache = frame_obstack_zalloc<m32r_frame_cache> ();
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
ULONGEST this_base;
unsigned long op;
int i;
- struct m32r_unwind_cache *info;
-
if ((*this_prologue_cache))
return (struct m32r_unwind_cache *) (*this_prologue_cache);
- info = FRAME_OBSTACK_ZALLOC (struct m32r_unwind_cache);
+ auto *info = frame_obstack_zalloc<m32r_unwind_cache> ();
(*this_prologue_cache) = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
struct gdbarch *gdbarch = get_frame_arch (this_frame);
ULONGEST prev_sp;
ULONGEST this_base;
- struct m68hc11_unwind_cache *info;
CORE_ADDR current_pc;
int i;
if ((*this_prologue_cache))
return (struct m68hc11_unwind_cache *) (*this_prologue_cache);
- info = FRAME_OBSTACK_ZALLOC (struct m68hc11_unwind_cache);
+ auto *info = frame_obstack_zalloc<m68hc11_unwind_cache> ();
(*this_prologue_cache) = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
static struct m68k_frame_cache *
m68k_alloc_frame_cache (void)
{
- struct m68k_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct m68k_frame_cache);
+ auto *cache = frame_obstack_zalloc<m68k_frame_cache> ();
/* Base address. */
cache->base = 0;
{
CORE_ADDR func_start, stop_addr;
- *this_prologue_cache
- = FRAME_OBSTACK_ZALLOC (struct mep_prologue);
+ *this_prologue_cache = frame_obstack_zalloc<mep_prologue> ();
func_start = get_frame_func (this_frame);
stop_addr = get_frame_pc (this_frame);
static struct microblaze_frame_cache *
microblaze_alloc_frame_cache (void)
{
- struct microblaze_frame_cache *cache;
-
- cache = FRAME_OBSTACK_ZALLOC (struct microblaze_frame_cache);
+ auto *cache = frame_obstack_zalloc<microblaze_frame_cache> ();
/* Base address. */
cache->base = 0;
mips_insn16_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct mips_frame_cache *cache;
if ((*this_cache) != NULL)
return (struct mips_frame_cache *) (*this_cache);
- cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache);
+ auto *cache = frame_obstack_zalloc<mips_frame_cache> ();
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
mips_micro_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct mips_frame_cache *cache;
if ((*this_cache) != NULL)
return (struct mips_frame_cache *) (*this_cache);
- cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache);
+ auto *cache = frame_obstack_zalloc<mips_frame_cache> ();
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
mips_insn32_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct mips_frame_cache *cache;
if ((*this_cache) != NULL)
return (struct mips_frame_cache *) (*this_cache);
- cache = FRAME_OBSTACK_ZALLOC (struct mips_frame_cache);
+ auto *cache = frame_obstack_zalloc<mips_frame_cache> ();
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
{
CORE_ADDR func_start, stop_addr;
- *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct mn10300_prologue);
+ *this_prologue_cache = frame_obstack_zalloc<mn10300_prologue> ();
func_start = get_frame_func (this_frame);
stop_addr = get_frame_pc (this_frame);
static struct moxie_frame_cache *
moxie_alloc_frame_cache (void)
{
- struct moxie_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct moxie_frame_cache);
+ auto *cache = frame_obstack_zalloc<moxie_frame_cache> ();
cache->base = 0;
cache->saved_sp = 0;
{
CORE_ADDR func_start, stop_addr;
- *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct msp430_prologue);
+ *this_prologue_cache = frame_obstack_zalloc<msp430_prologue> ();
func_start = get_frame_func (this_frame);
stop_addr = get_frame_pc (this_frame);
static struct nds32_frame_cache *
nds32_alloc_frame_cache (void)
{
- struct nds32_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct nds32_frame_cache);
+ auto *cache = frame_obstack_zalloc<nds32_frame_cache> ();
/* Initialize fp_offset to check if FP is set in prologue. */
cache->fp_offset = INVALID_OFFSET;
static struct btrace_frame_cache *
bfcache_new (const frame_info_ptr &frame)
{
- struct btrace_frame_cache *cache
- = FRAME_OBSTACK_ZALLOC (struct btrace_frame_cache);
+ auto *cache = frame_obstack_zalloc<btrace_frame_cache> ();
bfcache.emplace (frame.get (), cache);
-
return cache;
}
riscv_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
CORE_ADDR pc, start_addr;
- struct riscv_unwind_cache *cache;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int numregs, regno;
if ((*this_cache) != NULL)
return (struct riscv_unwind_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct riscv_unwind_cache);
+ auto *cache = frame_obstack_zalloc<riscv_unwind_cache> ();
cache->regs = trad_frame_alloc_saved_regs (this_frame);
(*this_cache) = cache;
{
CORE_ADDR func_start, stop_addr;
- *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct rl78_prologue);
+ *this_prologue_cache = frame_obstack_zalloc<rl78_prologue> ();
func_start = get_frame_func (this_frame);
stop_addr = get_frame_pc (this_frame);
static struct rs6000_frame_cache *
rs6000_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
- struct rs6000_frame_cache *cache;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if ((*this_cache) != NULL)
return (struct rs6000_frame_cache *) (*this_cache);
- cache = FRAME_OBSTACK_ZALLOC (struct rs6000_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct rs6000_frame_cache> ();
(*this_cache) = cache;
cache->pc = 0;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
static struct rs6000_frame_cache *
rs6000_epilogue_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
- struct rs6000_frame_cache *cache;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
struct rs6000_framedata fdata;
if (*this_cache)
return (struct rs6000_frame_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct rs6000_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct rs6000_frame_cache> ();
(*this_cache) = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
{
CORE_ADDR func_start, stop_addr;
- *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct rx_prologue);
+ *this_prologue_cache = frame_obstack_zalloc<rx_prologue> ();
func_start = get_frame_func (this_frame);
stop_addr = get_frame_pc (this_frame);
s390_gdbarch_tdep *tdep = gdbarch_tdep<s390_gdbarch_tdep> (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- struct s390_sigtramp_unwind_cache *info;
ULONGEST this_sp, prev_sp;
CORE_ADDR next_ra, next_cfa, sigreg_ptr, sigreg_high_off;
int i;
if (*this_prologue_cache)
return (struct s390_sigtramp_unwind_cache *) *this_prologue_cache;
- info = FRAME_OBSTACK_ZALLOC (struct s390_sigtramp_unwind_cache);
+ auto *info = frame_obstack_zalloc<s390_sigtramp_unwind_cache> ();
*this_prologue_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
s390_frame_unwind_cache (const frame_info_ptr &this_frame,
void **this_prologue_cache)
{
- struct s390_unwind_cache *info;
-
if (*this_prologue_cache)
return (struct s390_unwind_cache *) *this_prologue_cache;
- info = FRAME_OBSTACK_ZALLOC (struct s390_unwind_cache);
+ auto *info = frame_obstack_zalloc<s390_unwind_cache> ();
*this_prologue_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
info->func = -1;
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
- struct s390_stub_unwind_cache *info;
ULONGEST reg;
if (*this_prologue_cache)
return (struct s390_stub_unwind_cache *) *this_prologue_cache;
- info = FRAME_OBSTACK_ZALLOC (struct s390_stub_unwind_cache);
+ auto *info = frame_obstack_zalloc<s390_stub_unwind_cache> ();
*this_prologue_cache = info;
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
void *
sentinel_frame_cache (struct regcache *regcache)
{
- struct frame_unwind_cache *cache =
- FRAME_OBSTACK_ZALLOC (struct frame_unwind_cache);
+ auto *cache = frame_obstack_zalloc<frame_unwind_cache> ();
cache->regcache = regcache;
return cache;
static struct sh_frame_cache *
sh_alloc_frame_cache (void)
{
- struct sh_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct sh_frame_cache);
+ auto *cache = frame_obstack_zalloc<sh_frame_cache> ();
/* Base address. */
cache->base = 0;
static struct sparc_frame_cache *
sparc_alloc_frame_cache (void)
{
- struct sparc_frame_cache *cache;
-
- cache = FRAME_OBSTACK_ZALLOC (struct sparc_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct sparc_frame_cache> ();
/* Base address. */
cache->base = 0;
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR current_pc;
- struct tic6x_unwind_cache *cache;
if (*this_prologue_cache)
return (struct tic6x_unwind_cache *) *this_prologue_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct tic6x_unwind_cache);
+ auto *cache = frame_obstack_zalloc<tic6x_unwind_cache> ();
(*this_prologue_cache) = cache;
cache->return_regnum = TIC6X_RA_REGNUM;
static struct tic6x_unwind_cache *
tic6x_make_stub_cache (const frame_info_ptr &this_frame)
{
- struct tic6x_unwind_cache *cache;
-
- cache = FRAME_OBSTACK_ZALLOC (struct tic6x_unwind_cache);
+ auto *cache = frame_obstack_zalloc<tic6x_unwind_cache> ();
cache->return_regnum = TIC6X_RA_REGNUM;
tilegx_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct tilegx_frame_cache *cache;
CORE_ADDR current_pc;
if (*this_cache)
return (struct tilegx_frame_cache *) *this_cache;
- cache = FRAME_OBSTACK_ZALLOC (struct tilegx_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct tilegx_frame_cache> ();
*this_cache = cache;
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
cache->base = 0;
struct trad_frame_cache *
trad_frame_cache_zalloc (const frame_info_ptr &this_frame)
{
- struct trad_frame_cache *this_trad_cache;
-
- this_trad_cache = FRAME_OBSTACK_ZALLOC (struct trad_frame_cache);
+ auto *this_trad_cache = frame_obstack_zalloc<trad_frame_cache> ();
this_trad_cache->prev_regs = trad_frame_alloc_saved_regs (this_frame);
this_trad_cache->this_frame = this_frame;
return this_trad_cache;
static_assert (std::is_trivially_constructible<trad_frame_saved_reg>::value);
int numregs = gdbarch_num_cooked_regs (gdbarch);
- trad_frame_saved_reg *this_saved_regs
- = FRAME_OBSTACK_CALLOC (numregs, trad_frame_saved_reg);
+ auto *this_saved_regs = frame_obstack_calloc<trad_frame_saved_reg> (numregs);
/* For backwards compatibility, initialize all the register values to
REALREG, with register 0 stored in 0, register 1 stored in 1 and so
void set_value_bytes (gdb::array_view<const gdb_byte> bytes)
{
/* Allocate the space and copy the data bytes. */
- gdb_byte *data = FRAME_OBSTACK_CALLOC (bytes.size (), gdb_byte);
+ auto *data = frame_obstack_calloc<gdb_byte> (bytes.size ());
memcpy (data, bytes.data (), bytes.size ());
m_kind = trad_frame_saved_reg_kind::VALUE_BYTES;
const struct tramp_frame *tramp = unwind_data ()->tramp_frame;
CORE_ADDR pc = get_frame_pc (this_frame);
CORE_ADDR func;
- struct tramp_frame_cache *tramp_cache;
/* tausq/2004-12-12: We used to assume if pc has a name or is in a valid
section, then this is not a trampoline. However, this assumption is
func = tramp_frame_start (tramp, this_frame, pc);
if (func == 0)
return 0;
- tramp_cache = FRAME_OBSTACK_ZALLOC (struct tramp_frame_cache);
+ auto *tramp_cache = frame_obstack_zalloc<struct tramp_frame_cache> ();
tramp_cache->func = func;
tramp_cache->tramp_frame = tramp;
(*this_cache) = tramp_cache;
static struct v850_frame_cache *
v850_alloc_frame_cache (const frame_info_ptr &this_frame)
{
- struct v850_frame_cache *cache;
-
- cache = FRAME_OBSTACK_ZALLOC (struct v850_frame_cache);
+ auto *cache = frame_obstack_zalloc<v850_frame_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
/* Base address. */
static struct vax_frame_cache *
vax_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
{
- struct vax_frame_cache *cache;
CORE_ADDR addr;
ULONGEST mask;
int regnum;
return (struct vax_frame_cache *) *this_cache;
/* Allocate a new cache. */
- cache = FRAME_OBSTACK_ZALLOC (struct vax_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct vax_frame_cache> ();
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
/* The frame pointer is used as the base for the frame. */
frame_debug_printf ("sigstackptroffset=%x", tlsoffset);
- auto *cache = FRAME_OBSTACK_ZALLOC (struct cygwin_sigwrapper_frame_cache);
+ auto *cache = frame_obstack_zalloc<struct cygwin_sigwrapper_frame_cache> ();
cache->tlsoffset = tlsoffset;
*this_cache = cache;
static struct xstormy16_frame_cache *
xstormy16_alloc_frame_cache (void)
{
- struct xstormy16_frame_cache *cache;
int i;
- cache = FRAME_OBSTACK_ZALLOC (struct xstormy16_frame_cache);
+ auto *cache = frame_obstack_zalloc<xstormy16_frame_cache> ();
cache->base = 0;
cache->saved_sp = 0;
static struct xtensa_frame_cache *
xtensa_alloc_frame_cache (int windowed)
{
- xtensa_frame_cache_t *cache;
int i;
DEBUGTRACE ("xtensa_alloc_frame_cache ()\n");
- cache = FRAME_OBSTACK_ZALLOC (xtensa_frame_cache_t);
+ auto *cache = frame_obstack_zalloc<xtensa_frame_cache_t> ();
cache->base = 0;
cache->pc = 0;
ULONGEST this_base;
int i;
gdb_byte buf[sizeof(void*)];
- struct z80_unwind_cache *info;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
z80_gdbarch_tdep *tdep = gdbarch_tdep<z80_gdbarch_tdep> (gdbarch);
int addr_len = tdep->addr_length;
if (*this_prologue_cache)
return (struct z80_unwind_cache *) *this_prologue_cache;
- info = FRAME_OBSTACK_ZALLOC (struct z80_unwind_cache);
+ auto *info = frame_obstack_zalloc<z80_unwind_cache> ();
memset (info, 0, sizeof (*info));
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
*this_prologue_cache = info;