[PATCH 5/7] jit: make gdb_object::symtabs a vector of unique_ptr
Simon Marchi
simon.marchi@polymtl.ca
Fri Dec 13 18:51:00 GMT 2019
On 2019-12-13 1:45 p.m., Simon Marchi wrote:
> I don't think so. We return these pointers to the JIT debug readers, which then pass
> it back to the block_open and symtab_close callbacks. It's important that the objects
> don't move during their lifetime. If we had a vector of objects, the pointers we return
> to the user would get invalidated the moment the vector is resized.
Actually, it would be good to document this, so we don't change it to a vector of
objects, out of good intention. I would add this to document the gdb_object::symtabs
field:
/* Symtabs of this object.
This is a vector of pointers, rather than a vector of objects, because the
pointers are returned to the user's debug info reader, so it's important
that the objects don't change location during their lifetime (which would
happen with a vector of objects getting resized. */
I would add a similar comment later in the series to document gdb_symtab::blocks.
Simon
More information about the Gdb-patches
mailing list