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
On 2017-10-09 10:44 AM, Pedro Alves wrote:
> 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).
No reason, except that I thought this was a reasonnable intermediary step.
I'll try doing as you say, it's probably not too long.
Simon