Re: [PATCH 13/24] gdb: make solib-rocm not use so_list internally

Lancelot SIX
2023-10-13T18:35:26Z

Hi Simon,

When applying this patch, I have:

Applying: gdb: make solib-rocm not use so_list internally
.git/rebase-apply/patch:171: indent with spaces.
= string_printf ("code_object_%ld", code_object_list[i].handle);
warning: 1 line adds whitespace errors.

On Tue, Oct 10, 2023 at 04:40:08PM -0400, Simon Marchi wrote:
> Same rationale as the previous patch, but for solib-rocm.
>
> - Introduce rocm_so, which is a name a unique_name (see comment in
> rocm_update_solib_list for that) and a unique_ptr to the
> lm_info_svr4.
> - Change the internal lists from so_list lists to vectors of rocm_so.
> - Remove rocm_free_solib_list, as everything is automatic now.
> - Replace rocm_solib_copy_list with so_list_from_rocm_sos.
>
> Change-Id: I71e06e3ea22d6420c9e4e500501c06e9a13398a8
> ---
> gdb/solib-rocm.c | 92 ++++++++++++++++++++++--------------------------
> 1 file changed, 42 insertions(+), 50 deletions(-)
>
> diff --git a/gdb/solib-rocm.c b/gdb/solib-rocm.c
> index 403173ecc998..5016c383a807 100644
> --- a/gdb/solib-rocm.c
> +++ b/gdb/solib-rocm.c
> @@ -243,21 +240,21 @@ rocm_solib_current_sos ()
> so_list *head = svr4_so_ops.current_sos ();
>
> /* Then, the device-side shared library list. */
> - so_list *list = get_solib_info (current_inferior ())->solib_list;
> + std::vector<rocm_so> &dev_sos = get_solib_info (current_inferior ())->solib_list;

There should be a line break (it gets over the line limit), and I think
this dev_sos can be marked const.

Best,
Lancelot.

>
> - if (list == nullptr)
> + if (dev_sos.empty ())
> return head;
>
> - list = rocm_solib_copy_list (list);
> + so_list *dev_so_list = so_list_from_rocm_sos (dev_sos);
>
> if (head == nullptr)
> - return list;
> + return dev_so_list;
>
> /* Append our libraries to the end of the list. */
> so_list *tail;
> for (tail = head; tail->next; tail = tail->next)
> /* Nothing. */;
> - tail->next = list;
> + tail->next = dev_so_list;
>
> return head;
> }