[PATCH][PR/24474] Make gdb.lookup_static_symbol also check the STATIC_SCOPE

Christian Biesinger via gdb-patches gdb-patches@sourceware.org
Thu Aug 1 19:05:00 GMT 2019


On Mon, Jul 15, 2019 at 10:28 PM Simon Marchi <simark@simark.ca> wrote:
> I am not sure this is the right thing to do, or at least some things need to be
> clarified.  Global symbols are visible through the entire program (there can only
> be one of that name), whereas there can be many static symbols with the same name.
> What should the user expect if there are multiple static symbols with the same name?
> I suppose we'll return the first one that matches, without any particular guarantee
> about which one.

By the way, to follow up on that comment-- the symbol cache (or, for
that matter, symtab.c:lookup_static_symbol) does not take that into
account at all, it will only ever have one cache entry for one static
symbol name. In fact it does not even differentiate by objfile, unlike
for global symbols (??). Should maybe be fixed someday...

Christian



More information about the Gdb-patches mailing list