Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: replace FRAME_OBSTACK_{C,Z}ALLOC macros with templated functions
Date: Tue, 25 Nov 2025 15:11:50 -0500	[thread overview]
Message-ID: <3cbce19f-53ae-477e-a445-265154c4698c@polymtl.ca> (raw)
In-Reply-To: <20251110052145.1636979-1-simon.marchi@polymtl.ca>

I pushed this patch.

Simon

On 2025-11-10 00:21, simon.marchi@polymtl.ca wrote:
> From: Simon Marchi <simon.marchi@polymtl.ca>
> 
> While reviewing a patch, I saw these macros and thought they could be
> modernized a bit.
> 
> Change-Id: I540edbcfd2e1e3cfd6afa0e911f43c8b89862414
> ---
>  gdb/aarch64-tdep.c        |  8 ++------
>  gdb/alpha-mdebug-tdep.c   |  3 +--
>  gdb/alpha-tdep.c          |  7 ++-----
>  gdb/amd64-tdep.c          |  4 +---
>  gdb/amd64-windows-tdep.c  |  3 +--
>  gdb/amdgpu-tdep.c         |  3 +--
>  gdb/arc-tdep.c            |  5 ++---
>  gdb/arm-tdep.c            | 16 +++++-----------
>  gdb/avr-tdep.c            |  3 +--
>  gdb/bfin-tdep.c           |  3 +--
>  gdb/cris-tdep.c           |  6 ++----
>  gdb/csky-tdep.c           |  7 ++-----
>  gdb/dummy-frame.c         |  4 +---
>  gdb/dwarf2/frame.c        |  8 +++-----
>  gdb/frame.c               |  6 +++---
>  gdb/frame.h               | 22 ++++++++++++++++++----
>  gdb/frv-tdep.c            |  3 +--
>  gdb/ft32-tdep.c           |  3 +--
>  gdb/h8300-tdep.c          |  3 +--
>  gdb/hppa-linux-tdep.c     |  3 +--
>  gdb/hppa-tdep.c           | 10 +++-------
>  gdb/i386-tdep.c           |  3 +--
>  gdb/ia64-libunwind-tdep.c |  3 +--
>  gdb/ia64-tdep.c           |  3 +--
>  gdb/iq2000-tdep.c         |  3 +--
>  gdb/lm32-tdep.c           |  3 +--
>  gdb/loongarch-tdep.c      |  4 +---
>  gdb/m32c-tdep.c           |  2 +-
>  gdb/m32r-linux-tdep.c     |  3 +--
>  gdb/m32r-tdep.c           |  4 +---
>  gdb/m68hc11-tdep.c        |  3 +--
>  gdb/m68k-tdep.c           |  3 +--
>  gdb/mep-tdep.c            |  3 +--
>  gdb/microblaze-tdep.c     |  4 +---
>  gdb/mips-tdep.c           |  9 +++------
>  gdb/mn10300-tdep.c        |  2 +-
>  gdb/moxie-tdep.c          |  3 +--
>  gdb/msp430-tdep.c         |  2 +-
>  gdb/nds32-tdep.c          |  3 +--
>  gdb/record-btrace.c       |  3 +--
>  gdb/riscv-tdep.c          |  3 +--
>  gdb/rl78-tdep.c           |  2 +-
>  gdb/rs6000-tdep.c         |  6 ++----
>  gdb/rx-tdep.c             |  2 +-
>  gdb/s390-linux-tdep.c     |  3 +--
>  gdb/s390-tdep.c           |  7 ++-----
>  gdb/sentinel-frame.c      |  3 +--
>  gdb/sh-tdep.c             |  3 +--
>  gdb/sparc-tdep.c          |  4 +---
>  gdb/tic6x-tdep.c          |  7 ++-----
>  gdb/tilegx-tdep.c         |  3 +--
>  gdb/trad-frame.c          |  7 ++-----
>  gdb/trad-frame.h          |  2 +-
>  gdb/tramp-frame.c         |  3 +--
>  gdb/v850-tdep.c           |  4 +---
>  gdb/vax-tdep.c            |  3 +--
>  gdb/windows-tdep.c        |  2 +-
>  gdb/xstormy16-tdep.c      |  3 +--
>  gdb/xtensa-tdep.c         |  3 +--
>  gdb/z80-tdep.c            |  3 +--
>  60 files changed, 98 insertions(+), 168 deletions(-)
> 
> diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
> index 89142e0a2149..be5928be4c3a 100644
> --- a/gdb/aarch64-tdep.c
> +++ b/gdb/aarch64-tdep.c
> @@ -1102,12 +1102,10 @@ aarch64_make_prologue_cache_1 (const frame_info_ptr &this_frame,
>  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;
>  
> @@ -1236,12 +1234,10 @@ static const frame_unwind_legacy aarch64_prologue_unwind (
>  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;
>  
> diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c
> index b8fe8f653e58..11a6cb1c8bb0 100644
> --- a/gdb/alpha-mdebug-tdep.c
> +++ b/gdb/alpha-mdebug-tdep.c
> @@ -187,7 +187,6 @@ static struct alpha_mdebug_unwind_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;
> @@ -197,7 +196,7 @@ alpha_mdebug_frame_unwind_cache (const frame_info_ptr &this_frame,
>    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);
>  
> diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
> index 0e29889160f7..2fd0317d99a3 100644
> --- a/gdb/alpha-tdep.c
> +++ b/gdb/alpha-tdep.c
> @@ -855,12 +855,10 @@ static struct alpha_sigtramp_unwind_cache *
>  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);
> @@ -1207,7 +1205,6 @@ alpha_heuristic_frame_unwind_cache (const frame_info_ptr &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;
> @@ -1215,7 +1212,7 @@ alpha_heuristic_frame_unwind_cache (const frame_info_ptr &this_frame,
>    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);
>  
> diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
> index 3cbc02242756..f7224ff76e77 100755
> --- a/gdb/amd64-tdep.c
> +++ b/gdb/amd64-tdep.c
> @@ -2155,9 +2155,7 @@ amd64_init_frame_cache (struct amd64_frame_cache *cache)
>  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;
>  }
> diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
> index c7977d29c3f6..875c39d95501 100644
> --- a/gdb/amd64-windows-tdep.c
> +++ b/gdb/amd64-windows-tdep.c
> @@ -1084,7 +1084,6 @@ amd64_windows_frame_cache (const frame_info_ptr &this_frame, void **this_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;
> @@ -1092,7 +1091,7 @@ amd64_windows_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>    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.  */
> diff --git a/gdb/amdgpu-tdep.c b/gdb/amdgpu-tdep.c
> index a2cb7d8984ac..786b5736e4b3 100644
> --- a/gdb/amdgpu-tdep.c
> +++ b/gdb/amdgpu-tdep.c
> @@ -863,8 +863,7 @@ amdgpu_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>    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);
> diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
> index d7c908b1c6cb..e47136196861 100644
> --- a/gdb/arc-tdep.c
> +++ b/gdb/arc-tdep.c
> @@ -1689,8 +1689,7 @@ arc_make_frame_cache (const frame_info_ptr &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);
> +  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);
> @@ -1824,7 +1823,7 @@ arc_make_sigtramp_frame_cache (const frame_info_ptr &this_frame)
>    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.  */
> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index 5b7846f77acd..8845ef27acc8 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -2309,10 +2309,9 @@ static struct arm_prologue_cache *
>  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);
> @@ -2796,8 +2795,7 @@ arm_exidx_fill_cache (const frame_info_ptr &this_frame, gdb_byte *entry)
>    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 (;;)
> @@ -3199,10 +3197,9 @@ struct frame_unwind_legacy arm_exidx_unwind (
>  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.  */
> @@ -3367,9 +3364,7 @@ arm_skip_bx_reg (const frame_info_ptr &frame, CORE_ADDR pc)
>  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
> @@ -3445,9 +3440,8 @@ arm_m_exception_cache (const frame_info_ptr &this_frame)
>  {
>    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"
> diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
> index 35ac952e73e7..4f6d1fc9d00e 100644
> --- a/gdb/avr-tdep.c
> +++ b/gdb/avr-tdep.c
> @@ -985,14 +985,13 @@ avr_frame_unwind_cache (const frame_info_ptr &this_frame,
>    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);
>  
> diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
> index 3a96e9f7908b..e454a4db3c42 100644
> --- a/gdb/bfin-tdep.c
> +++ b/gdb/bfin-tdep.c
> @@ -265,10 +265,9 @@ struct bfin_frame_cache
>  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;
> diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
> index e6925a617ea4..efa1b18e2cd9 100644
> --- a/gdb/cris-tdep.c
> +++ b/gdb/cris-tdep.c
> @@ -315,7 +315,6 @@ cris_sigtramp_frame_unwind_cache (const frame_info_ptr &this_frame,
>    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;
> @@ -323,7 +322,7 @@ cris_sigtramp_frame_unwind_cache (const frame_info_ptr &this_frame,
>    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);
>  
> @@ -697,12 +696,11 @@ cris_frame_unwind_cache (const frame_info_ptr &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);
>  
> diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
> index e6c6e2c6e6d0..2d365a4479c5 100644
> --- a/gdb/csky-tdep.c
> +++ b/gdb/csky-tdep.c
> @@ -2066,7 +2066,6 @@ static struct csky_unwind_cache *
>  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);
> @@ -2075,7 +2074,7 @@ csky_frame_unwind_cache (const frame_info_ptr &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.  */
> @@ -2243,9 +2242,7 @@ csky_stub_unwind_sniffer (const struct frame_unwind *self,
>  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);
>  
> diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
> index 37ee60cb0e05..43345bc52d53 100644
> --- a/gdb/dummy-frame.c
> +++ b/gdb/dummy-frame.c
> @@ -315,9 +315,7 @@ dummy_frame_sniffer (const struct frame_unwind *self,
>  	{
>  	  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;
> diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
> index 1570fd8d7147..11a4e0007dc4 100644
> --- a/gdb/dwarf2/frame.c
> +++ b/gdb/dwarf2/frame.c
> @@ -888,7 +888,6 @@ dwarf2_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>  {
>    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;
> @@ -897,8 +896,8 @@ dwarf2_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>      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.
> @@ -1268,7 +1267,6 @@ void *
>  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);
>  
> @@ -1277,7 +1275,7 @@ dwarf2_frame_allocate_fn_data (const frame_info_ptr &this_frame, void **this_cac
>    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;
> diff --git a/gdb/frame.c b/gdb/frame.c
> index b84e30c23903..f80e40dd4c56 100644
> --- a/gdb/frame.c
> +++ b/gdb/frame.c
> @@ -1623,7 +1623,7 @@ create_sentinel_frame (program_space *pspace, address_space *aspace,
>  		       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;
> @@ -2021,7 +2021,7 @@ create_new_frame (frame_id id)
>    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 (),
> @@ -2537,7 +2537,7 @@ get_prev_frame_raw (const frame_info_ptr &this_frame)
>       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
> diff --git a/gdb/frame.h b/gdb/frame.h
> index 99a79835efaf..086abc86b519 100644
> --- a/gdb/frame.h
> +++ b/gdb/frame.h
> @@ -823,10 +823,24 @@ enum print_what
>     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.  */
> diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
> index e8de8440fb43..b47ae96e1b9d 100644
> --- a/gdb/frv-tdep.c
> +++ b/gdb/frv-tdep.c
> @@ -1088,12 +1088,11 @@ frv_frame_unwind_cache (const frame_info_ptr &this_frame,
>  			 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);
>  
> diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
> index 441364a7e171..b1ebd7209eea 100644
> --- a/gdb/ft32-tdep.c
> +++ b/gdb/ft32-tdep.c
> @@ -437,10 +437,9 @@ ft32_return_value (struct gdbarch *gdbarch, struct value *function,
>  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;
> diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
> index 89907b86d9e2..0db5ee659930 100644
> --- a/gdb/h8300-tdep.c
> +++ b/gdb/h8300-tdep.c
> @@ -407,14 +407,13 @@ static struct h8300_frame_cache *
>  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;
>  
> diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
> index da5559c07abc..16a06cc8e43d 100644
> --- a/gdb/hppa-linux-tdep.c
> +++ b/gdb/hppa-linux-tdep.c
> @@ -198,14 +198,13 @@ hppa_linux_sigtramp_frame_unwind_cache (const frame_info_ptr &this_frame,
>  					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);
>  
> diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
> index 96cb797c0234..ab4ea11dcf7a 100644
> --- a/gdb/hppa-tdep.c
> +++ b/gdb/hppa-tdep.c
> @@ -1854,7 +1854,6 @@ hppa_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>    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;
> @@ -1874,7 +1873,7 @@ hppa_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>  		    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);
>  
> @@ -2306,7 +2305,6 @@ hppa_fallback_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>  {
>    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;
> @@ -2316,7 +2314,7 @@ hppa_fallback_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>  		"{ 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);
>  
> @@ -2417,12 +2415,10 @@ static struct hppa_stub_unwind_cache *
>  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);
>  
> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
> index e00b3337beaf..a6bb7df07031 100644
> --- a/gdb/i386-tdep.c
> +++ b/gdb/i386-tdep.c
> @@ -1031,10 +1031,9 @@ struct i386_frame_cache
>  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;
> diff --git a/gdb/ia64-libunwind-tdep.c b/gdb/ia64-libunwind-tdep.c
> index c17e1aa66d6d..acae3e4796de 100644
> --- a/gdb/ia64-libunwind-tdep.c
> +++ b/gdb/ia64-libunwind-tdep.c
> @@ -158,7 +158,6 @@ libunwind_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>    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;
> @@ -167,7 +166,7 @@ libunwind_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>      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)
> diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
> index 42435d1b48b8..ee3b5120ed5e 100644
> --- a/gdb/ia64-tdep.c
> +++ b/gdb/ia64-tdep.c
> @@ -1336,10 +1336,9 @@ refine_prologue_limit (CORE_ADDR pc, CORE_ADDR lim_pc, int *trust_limit)
>  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;
> diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
> index 1912e9ba7b07..ea566884fe2c 100644
> --- a/gdb/iq2000-tdep.c
> +++ b/gdb/iq2000-tdep.c
> @@ -361,14 +361,13 @@ static struct iq2000_frame_cache *
>  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;
>  
> diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
> index 80411626621e..5f5881ddd11f 100644
> --- a/gdb/lm32-tdep.c
> +++ b/gdb/lm32-tdep.c
> @@ -384,13 +384,12 @@ lm32_frame_cache (const frame_info_ptr &this_frame, void **this_prologue_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);
>  
> diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
> index 21a3e5377934..107a243af70e 100644
> --- a/gdb/loongarch-tdep.c
> +++ b/gdb/loongarch-tdep.c
> @@ -667,12 +667,10 @@ loongarch_frame_cache_1 (const frame_info_ptr &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;
>  
> diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
> index 0b26e407fc6b..62969e90b5a0 100644
> --- a/gdb/m32c-tdep.c
> +++ b/gdb/m32c-tdep.c
> @@ -1867,7 +1867,7 @@ m32c_analyze_frame_prologue (const frame_info_ptr &this_frame,
>        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);
> diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
> index 03000cc99da0..71bd0d9c3d9d 100644
> --- a/gdb/m32r-linux-tdep.c
> +++ b/gdb/m32r-linux-tdep.c
> @@ -227,13 +227,12 @@ static struct m32r_frame_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);
>  
> diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
> index bc5f05ed505f..7ef6dad96ea0 100644
> --- a/gdb/m32r-tdep.c
> +++ b/gdb/m32r-tdep.c
> @@ -524,13 +524,11 @@ m32r_frame_unwind_cache (const frame_info_ptr &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);
>  
> diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
> index 83a57edae00b..55b26f9bf993 100644
> --- a/gdb/m68hc11-tdep.c
> +++ b/gdb/m68hc11-tdep.c
> @@ -780,14 +780,13 @@ m68hc11_frame_unwind_cache (const frame_info_ptr &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);
>  
> diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
> index 3fa158a0338a..98d314649936 100644
> --- a/gdb/m68k-tdep.c
> +++ b/gdb/m68k-tdep.c
> @@ -634,10 +634,9 @@ struct m68k_frame_cache
>  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;
> diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
> index 1821cba7e5fe..04b02d892689 100644
> --- a/gdb/mep-tdep.c
> +++ b/gdb/mep-tdep.c
> @@ -1920,8 +1920,7 @@ mep_analyze_frame_prologue (const frame_info_ptr &this_frame,
>      {
>        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);
> diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
> index 72233444f34d..f4ab2ec595fb 100644
> --- a/gdb/microblaze-tdep.c
> +++ b/gdb/microblaze-tdep.c
> @@ -135,9 +135,7 @@ typedef BP_MANIPULATION (microblaze_break_insn) microblaze_breakpoint;
>  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;
> diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
> index d072b9a4d339..59a4a0c86d78 100644
> --- a/gdb/mips-tdep.c
> +++ b/gdb/mips-tdep.c
> @@ -2866,11 +2866,10 @@ static struct mips_frame_cache *
>  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);
>  
> @@ -3300,12 +3299,11 @@ static struct mips_frame_cache *
>  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);
>  
> @@ -3681,12 +3679,11 @@ static struct mips_frame_cache *
>  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);
>  
> diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
> index 3749c65f6cf3..e6e7f3df2473 100644
> --- a/gdb/mn10300-tdep.c
> +++ b/gdb/mn10300-tdep.c
> @@ -1049,7 +1049,7 @@ mn10300_analyze_frame_prologue (const frame_info_ptr &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);
> diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
> index 831c95e0fa12..17007a04e38e 100644
> --- a/gdb/moxie-tdep.c
> +++ b/gdb/moxie-tdep.c
> @@ -496,10 +496,9 @@ moxie_return_value (struct gdbarch *gdbarch, struct value *function,
>  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;
> diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
> index 7ac26b958c32..310cbeeeaf04 100644
> --- a/gdb/msp430-tdep.c
> +++ b/gdb/msp430-tdep.c
> @@ -465,7 +465,7 @@ msp430_analyze_frame_prologue (const frame_info_ptr &this_frame,
>      {
>        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);
> diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
> index 9180cd0c6d18..f0a0b338931b 100644
> --- a/gdb/nds32-tdep.c
> +++ b/gdb/nds32-tdep.c
> @@ -551,10 +551,9 @@ struct nds32_frame_cache
>  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;
> diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
> index a47907aab577..b29e213139bf 100644
> --- a/gdb/record-btrace.c
> +++ b/gdb/record-btrace.c
> @@ -1702,10 +1702,9 @@ bfcache_eq (const void *arg1, const void *arg2)
>  static struct btrace_frame_cache *
>  bfcache_new (const frame_info_ptr &frame)
>  {
> -  struct btrace_frame_cache *cache;
>    void **slot;
>  
> -  cache = FRAME_OBSTACK_ZALLOC (struct btrace_frame_cache);
> +  auto *cache = frame_obstack_zalloc<btrace_frame_cache> ();
>    cache->frame = frame.get ();
>  
>    slot = htab_find_slot (bfcache, cache, INSERT);
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index 76d10a3b2989..0c86fcd7196a 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -3828,14 +3828,13 @@ static struct riscv_unwind_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;
>  
> diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
> index 846064cc3d86..b310a620e1fd 100644
> --- a/gdb/rl78-tdep.c
> +++ b/gdb/rl78-tdep.c
> @@ -1099,7 +1099,7 @@ rl78_analyze_frame_prologue (const frame_info_ptr &this_frame,
>      {
>        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);
> diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
> index fc64e3ee69e6..b73ab87b6991 100644
> --- a/gdb/rs6000-tdep.c
> +++ b/gdb/rs6000-tdep.c
> @@ -3618,7 +3618,6 @@ struct rs6000_frame_cache
>  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);
> @@ -3628,7 +3627,7 @@ rs6000_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>  
>    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);
> @@ -3854,7 +3853,6 @@ static const struct frame_unwind_legacy rs6000_frame_unwind (
>  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;
> @@ -3863,7 +3861,7 @@ rs6000_epilogue_frame_cache (const frame_info_ptr &this_frame, void **this_cache
>    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);
>  
> diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
> index d11d1d26811c..c7b1dfa6ae7e 100644
> --- a/gdb/rx-tdep.c
> +++ b/gdb/rx-tdep.c
> @@ -391,7 +391,7 @@ rx_analyze_frame_prologue (const frame_info_ptr &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);
> diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
> index 66e571d47dd3..593befb495a9 100644
> --- a/gdb/s390-linux-tdep.c
> +++ b/gdb/s390-linux-tdep.c
> @@ -396,7 +396,6 @@ s390_sigtramp_frame_unwind_cache (const frame_info_ptr &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;
> @@ -404,7 +403,7 @@ s390_sigtramp_frame_unwind_cache (const frame_info_ptr &this_frame,
>    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);
>  
> diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
> index 0cef5f4645d0..c78eccbe4ca2 100644
> --- a/gdb/s390-tdep.c
> +++ b/gdb/s390-tdep.c
> @@ -2720,12 +2720,10 @@ static struct s390_unwind_cache *
>  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;
> @@ -2812,13 +2810,12 @@ s390_stub_frame_unwind_cache (const frame_info_ptr &this_frame,
>  {
>    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);
>  
> diff --git a/gdb/sentinel-frame.c b/gdb/sentinel-frame.c
> index 950588e9a3a0..983ff4666451 100644
> --- a/gdb/sentinel-frame.c
> +++ b/gdb/sentinel-frame.c
> @@ -31,8 +31,7 @@ struct frame_unwind_cache
>  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;
> diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
> index e7ab41f051fb..d70188d0dc79 100644
> --- a/gdb/sh-tdep.c
> +++ b/gdb/sh-tdep.c
> @@ -1821,10 +1821,9 @@ sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
>  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;
> diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
> index 926afa3b9303..2ee508b6b8b1 100644
> --- a/gdb/sparc-tdep.c
> +++ b/gdb/sparc-tdep.c
> @@ -751,9 +751,7 @@ typedef BP_MANIPULATION (sparc_break_insn) sparc_breakpoint;
>  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;
> diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
> index 56d309871ea2..499cc0685b0e 100644
> --- a/gdb/tic6x-tdep.c
> +++ b/gdb/tic6x-tdep.c
> @@ -381,12 +381,11 @@ tic6x_frame_unwind_cache (const frame_info_ptr &this_frame,
>  {
>    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;
> @@ -475,9 +474,7 @@ static const struct frame_base tic6x_frame_base =
>  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;
>  
> diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
> index c525644017d2..4ec14b96033d 100644
> --- a/gdb/tilegx-tdep.c
> +++ b/gdb/tilegx-tdep.c
> @@ -836,13 +836,12 @@ static struct tilegx_frame_cache *
>  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;
> diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
> index 470f31d4b97b..c38b578f0fa1 100644
> --- a/gdb/trad-frame.c
> +++ b/gdb/trad-frame.c
> @@ -38,9 +38,7 @@ struct trad_frame_cache
>  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;
> @@ -64,8 +62,7 @@ trad_frame_alloc_saved_regs (struct gdbarch *gdbarch)
>    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
> diff --git a/gdb/trad-frame.h b/gdb/trad-frame.h
> index 9039e8b2a800..02f1c8c9bd44 100644
> --- a/gdb/trad-frame.h
> +++ b/gdb/trad-frame.h
> @@ -117,7 +117,7 @@ struct trad_frame_saved_reg
>    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;
> diff --git a/gdb/tramp-frame.c b/gdb/tramp-frame.c
> index 5fea5bbbd696..562feab7cc3f 100644
> --- a/gdb/tramp-frame.c
> +++ b/gdb/tramp-frame.c
> @@ -157,7 +157,6 @@ frame_unwind_trampoline::sniff (const frame_info_ptr &this_frame,
>    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
> @@ -166,7 +165,7 @@ frame_unwind_trampoline::sniff (const frame_info_ptr &this_frame,
>    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;
> diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
> index c544fe18ff2f..cd0635b5b2c0 100644
> --- a/gdb/v850-tdep.c
> +++ b/gdb/v850-tdep.c
> @@ -1214,9 +1214,7 @@ v850_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
>  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.  */
> diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
> index 0a83f4f914cd..a6af8831c3c5 100644
> --- a/gdb/vax-tdep.c
> +++ b/gdb/vax-tdep.c
> @@ -305,7 +305,6 @@ struct vax_frame_cache
>  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;
> @@ -314,7 +313,7 @@ vax_frame_cache (const frame_info_ptr &this_frame, void **this_cache)
>      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.  */
> diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
> index f77b21cef93f..68d40b8373af 100644
> --- a/gdb/windows-tdep.c
> +++ b/gdb/windows-tdep.c
> @@ -1387,7 +1387,7 @@ cygwin_sigwrapper_frame_unwind::sniff (const frame_info_ptr &this_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;
> diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
> index 819c54ba4ba8..d75e10428e13 100644
> --- a/gdb/xstormy16-tdep.c
> +++ b/gdb/xstormy16-tdep.c
> @@ -636,10 +636,9 @@ xstormy16_address_to_pointer (struct gdbarch *gdbarch,
>  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;
> diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
> index 88ad81511c6c..48ca4bd9eece 100644
> --- a/gdb/xtensa-tdep.c
> +++ b/gdb/xtensa-tdep.c
> @@ -975,12 +975,11 @@ typedef struct xtensa_frame_cache
>  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;
> diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
> index 31d319392ddb..6a099cd6e74a 100644
> --- a/gdb/z80-tdep.c
> +++ b/gdb/z80-tdep.c
> @@ -562,7 +562,6 @@ z80_frame_unwind_cache (const frame_info_ptr &this_frame,
>    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;
> @@ -570,7 +569,7 @@ z80_frame_unwind_cache (const frame_info_ptr &this_frame,
>    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;
> 
> base-commit: 15a7adca5d9b32a6e2b963092e3514fe40a093fb


      parent reply	other threads:[~2025-11-25 20:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10  5:21 [PATCH] gdb: replace FRAME_OBSTACK_{C, Z}ALLOC " simon.marchi
2025-11-10 21:14 ` Thiago Jung Bauermann
2025-11-10 21:24   ` Simon Marchi
2025-11-25 20:11 ` Simon Marchi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3cbce19f-53ae-477e-a445-265154c4698c@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox