This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] gdbserver: Use std::list for all_dlls


On 10/09/2017 03:30 PM, Simon Marchi wrote:

> diff --git a/gdb/gdbserver/dll.h b/gdb/gdbserver/dll.h
> index 39e5eb0653..52f924bc85 100644
> --- a/gdb/gdbserver/dll.h
> +++ b/gdb/gdbserver/dll.h
> @@ -18,17 +18,15 @@
>  #ifndef DLL_H
>  #define DLL_H
>  
> +#include <list>
> +
>  struct dll_info
>  {
> -  /* This must appear first.  See inferiors.h.
> -     The list iterator functions assume it.  */
> -  struct inferior_list_entry entry;
> -
>    char *name;
>    CORE_ADDR base_addr;
>  };
>  
> -extern struct inferior_list all_dlls;
> +extern std::list<dll_info *> all_dlls;

Is there a reason for making this a list of dll_info pointers
instead of a list of dll_info objects?  If you make this a list of
objects, then each list node + dll_info is allocated in one go,
very much like the current code.  With a list of pointers, you
have an extra allocation/indirection for each dll_info (one for
node + pointer, another for the dll_info pointee).

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]