This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 07/40] objfile_per_bfd_storage non-POD
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 27 Jun 2017 16:30:27 +0100
- Subject: Re: [PATCH 07/40] objfile_per_bfd_storage non-POD
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7D08D4A544
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7D08D4A544
- References: <1496406158-12663-1-git-send-email-palves@redhat.com> <1496406158-12663-8-git-send-email-palves@redhat.com> <867ezxfxng.fsf@gmail.com>
On 06/27/2017 01:00 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
>> A following patch will want to add a std::vector to
>> objfile_per_bfd_storage. That makes it non-trivially
>> constructible/destructible. Since objfile_per_bfd_storage objects are
>> allocated on an obstack, we need to call their ctors/dtors manually.
>> This is what this patch does. And then since we can now rely on
>> ctors/dtors being run, make objfile_per_bfd_storage::storage_obstack
>> be an auto_obstack.
>
> It is good trick to class-fy some structures which are allocated on
> obstack.
>
>>
>> gdb/ChangeLog:
>> yyyy-mm-dd Pedro Alves <palves@redhat.com>
>>
>> * objfiles.c (get_objfile_bfd_data): Call bfd_alloc instead of
>> bfd_zalloc. Call objfile_per_bfd_storage's ctor.
>> (free_objfile_per_bfd_storage): Call objfile_per_bfd_storage's
>> dtor.
>> * objfiles.h (objfile_per_bfd_storage): Add ctor. Make
>> 'storage_obstack' field an auto_obstack. In-class initialize all
>> non-bitfield fields. Make minsyms_read bool.
>> * symfile.c (read_symbols): Adjust.
>
> Patch is good to me.
>
Thanks, pushed it in.
Thanks,
Pedro Alves