[PATCH] Simplify get_frame_unwind_table

Guinevere Larsen guinevere@redhat.com
Fri Jan 17 19:14:01 GMT 2025


On 1/17/25 4:04 PM, Tom Tromey wrote:
> This simplifies get_frame_unwind_table, changing it to use the
> registry 'emplace' method and to pass the initialization iterators to
> the constructor.  This fixes a build problem on x86 -- reported by the
> auto-builder -- as a side effect.

I've tested this on buildbot and it fix the build. I encourage you to 
push it!

Tested-By: Guinevere Larsen <guinevere@redhat.com>

-- 
Cheers,
Guinevere Larsen
She/Her/Hers

> ---
>   gdb/frame-unwind.c | 13 ++++---------
>   1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/gdb/frame-unwind.c b/gdb/frame-unwind.c
> index fab9b3c981a..33b23f91feb 100644
> --- a/gdb/frame-unwind.c
> +++ b/gdb/frame-unwind.c
> @@ -73,15 +73,10 @@ static std::vector<const frame_unwind *> &
>   get_frame_unwind_table (struct gdbarch *gdbarch)
>   {
>     std::vector<const frame_unwind *> *table = frame_unwind_data.get (gdbarch);
> -  if (table != nullptr)
> -    return *table;
> -
> -  table = new std::vector<const frame_unwind *>;
> -  table->insert (table->begin (), standard_unwinders.begin (),
> -		 standard_unwinders.end ());
> -
> -  frame_unwind_data.set (gdbarch, table);
> -
> +  if (table == nullptr)
> +    table = frame_unwind_data.emplace (gdbarch,
> +				       standard_unwinders.begin (),
> +				       standard_unwinders.end ());
>     return *table;
>   }
>   




More information about the Gdb-patches mailing list