Re: [PATCH 21/24] gdb: link so_list using intrusive_list

Pedro Alves
2023-10-17T19:14:51Z

On 2023-10-10 21:40, Simon Marchi wrote:

> diff --git a/gdb/solist.h b/gdb/solist.h
> index 9320acb7fd3e..31b823a3a482 100644
> --- a/gdb/solist.h
> +++ b/gdb/solist.h
> @@ -36,7 +36,7 @@ struct lm_info
>
> using lm_info_up = std::unique_ptr<lm_info>;
>
> -struct so_list
> +struct so_list : intrusive_list_node<so_list>

I noticed this in patch #24:

> @@ -52,7 +52,7 @@ struct so_list : intrusive_list_node<so_list>
> dynamic linker's tables in the inferior, and are initialized by
> current_sos. */
>
> - struct so_list *next = nullptr; /* next structure in linked list */
> + so *next = nullptr; /* next structure in linked list */

Err, what "next" still doing there? :-) This patch should have deleted it.

Pedro Alves

> {
> /* Free symbol-file related contents of SO and reset for possible reloading
> of SO. If we have opened a BFD for SO, close it. If we have placed SO's
> @@ -121,7 +121,7 @@ struct target_so_ops
> inferior --- we don't examine any of the shared library files
> themselves. The declaration of `struct so_list' says which fields
> we provide values for. */
> - struct so_list *(*current_sos) (void);
> + intrusive_list<so_list> (*current_sos) ();
>
> /* Find, open, and read the symbols for the main executable. If
> FROM_TTY is non-zero, allow messages to be printed. */
> @@ -171,8 +171,6 @@ struct target_so_ops
> void (*handle_event) (void);
> };
>
> -using so_list_range = next_range<so_list>;
> -
> /* Free the memory associated with a (so_list *). */
> void free_so (so_list &so);
>