Re: [PATCH] gdb/solib-frv: remove manual memory management

Kevin Buettner
2026-02-17T23:33:34Z

On Tue, 17 Feb 2026 16:16:44 -0500
simon.marchi@polymtl.ca wrote:

> From: Simon Marchi <simon.marchi@efficios.com>
>
> - Make fetch_loadmap return a unique pointer, adjust callers
> - Make fetch_loadmap use a unique pointer for ext_ldmbuf
> - Replace some fields of lm_info_frv to be unique pointers
> - Make main_executable_lm_info a unique pointer
>
> I can only build-test this.

I haven't had access to an FR-V machine in a long, long time, so I can't
properly test it either.

I found a comment that should be updated...

> @@ -102,19 +105,20 @@ struct int_elf32_fdpic_loadmap {
> struct int_elf32_fdpic_loadseg segs[1 /* nsegs, actually */];
> };
>
> +using int_elf32_fdpic_loadmap_up
> + = gdb::unique_xmalloc_ptr<int_elf32_fdpic_loadmap>;
> +
> /* Given address LDMADDR, fetch and decode the loadmap at that address.
> Return NULL if there is a problem reading the target memory or if
> there doesn't appear to be a loadmap at the given address. The
> allocated space (representing the loadmap) returned by this
> function may be freed via a single call to xfree(). */

The remark about xfree should be removed and NULL should be replaced
with nullptr.

> -static struct int_elf32_fdpic_loadmap *
> +static int_elf32_fdpic_loadmap_up
> fetch_loadmap (CORE_ADDR ldmaddr)

[Above lines included for context.]

Okay with that comment fixed...

Approved-by: Kevin Buettner <kevinb@redhat.com>