[PATCH] gdb: Reinitialize objfile::section_offsets during objfile reload

Pedro Alves palves@redhat.com
Mon Jan 27 20:32:00 GMT 2020


On 1/26/20 4:24 PM, Tom Tromey wrote:
> Andrew> When building and testing with '-D_GLIBCXX_DEBUG=1' I noticed that the
> Andrew> test gdb.base/reload.exp was failing.  This turns out to be because
> Andrew> the objfile::section_offsets vector is not reinitialilzed during the
> Andrew> objfile reload process, and in this particular test, GDB ends up
> Andrew> indexing outside the bounds of the vector.
> 
> Tom> Thanks for catching this.
> 
> I wonder if this is a regression due to 
> 
> commit 6a053cb1ff643cec3349d7f2f47ae5573f82d613
> Author: Tom Tromey <tromey@adacore.com>
> Date:   Mon Jan 6 14:34:52 2020 -0700
> 
>     Change section_offsets to a std::vector
> 
> See appended.
> 
> I think at the time I thought removing this code would simply preserve
> the offsets.  But maybe we instead should std::move the offsets out of
> the objfile and then move them back in?

+1.  Losing the user-specified offsets sounds nasty.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list