This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] gdbserver: Use std::list for all_dlls
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>, gdb-patches at sourceware dot org
- Date: Mon, 9 Oct 2017 15:44:18 +0100
- Subject: Re: [PATCH 1/3] gdbserver: Use std::list for all_dlls
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1132C552F1
- References: <20171009143036.10215-1-simon.marchi@polymtl.ca> <20171009143036.10215-2-simon.marchi@polymtl.ca>
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