Re: [PATCH v3 08/10] gdb: add objfile -> solib backlink

Simon Marchi <[email protected]> Tue, 4 Aug 2026 15:24:08 -0400
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>

On 2026-08-04 13:43, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <[email protected]> writes:
> 
> Simon> I could change it to `const std::vector<solib *> &` or
> Simon> `gdb::array_view<solib *>`.  The latter sounds better, since callers
> Simon> don't need to know they are stored in a vector (we could also return an
> Simon> even more generic "range" type, but I guess that would require more
> Simon> boilerplate (unless we already have a class to accomplish this easily
> Simon> that I forgot about?).
> 
> ...
> 
> Simon> +  if (const auto &solibs = objfile->solibs ();
> Simon> +      !solibs.empty ())
> Simon> +    return solibs.front ();
>>>
>>> I wonder if instead you would consider exposing something like this as a
>>> method on objfile.
> 
> Simon> Like a "first_solib ()" method?  I certainly can do that.
> 
> Either the array_view or the first_solib approach would be totally fine
> by me.  Thanks.

Ok, when I did the change I realized what you mean.  We only ever care
about the first solib, so if there is this first_solib() method, we can
get first of the solibs() method.  I'll do that.

Simon