Re: [PATCH 1/4] gdb: make gdbarch store a vector of frame unwinders

Tom Tromey
2024-03-11T18:02:16Z

> I guess you're right, but would it make any real difference to have
> the gdbarch store a vector out right, or to store a vector in an
> obfuscated way?

I'm not really sure how I feel about it. In this case it's probably
harmless.

>> FWIW I think the real issue with obstack allocation isn't constructors
>> but destruction. See https://sourceware.org/pipermail/gdb-patches/2024-February/206888.html

> I see what you mean (though I don't necessarily understand why). I
> would prefer if we could not restrict the destructors, but since GDB
> doesn't ever dealloc gdbarches to begin with, I don't think that would
> be a big issue either way.

That's true for things that happen to be allocated on the gdbarch
obstack right now, but not other obstacks, and perhaps not in the future
if we ever decide a gdbarch should be deleted.

FWIW the issue with non-trivial destructors is that when the obstack
itself is destroyed, there's no mechanism for calling any of these.
This could introduce leaks or whatever else.

Tom