[PATCH] Introduce gdb::byte_vector, add allocator that default-initializes

Simon Marchi simon.marchi@ericsson.com
Sat Sep 9 19:11:00 GMT 2017


On 2017-06-14 12:21 PM, Pedro Alves wrote:
> On 06/14/2017 09:39 AM, Simon Marchi wrote:
> 
>> Thanks for the detailed explanation.  It's all very logical, but it's
>> also full of small details essential to really understand what's happening.
> 
> Yeah...  As custom with "library" code, thankfully uses of the types
> can remain oblivious to how the types work under the hood.
> 
> I've pushed the patch in now, with the trivial adjustments to both
> dwarf2loc.c, after Andreas' series, and to make the new int128_t printing
> code use gdb::byte_vector.

Hi Pedro,

I am looking at Tom's recent patch that uses def_vector, and I am wondering
if there should be a check somewhere to make sure we don't use the
default_init_allocator with non-default-constructible types.  Let's say we use
def_vector with a trivial type, and then we later decide to make that type
non-trivial by defining a constructor.  It looks like it would still build,
but I suppose we shouldn't use that type in a def_vector (for the same reason
that we shouldn't allocate it with malloc).  It could easily go unnoticed for
a while.

Simon



More information about the Gdb-patches mailing list