This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gdb/python: Introduce gdb.lookup_all_static_symbols


On 2019-10-23 3:13 p.m., Andrew Burgess wrote:
>>> I see two use cases here:
>>>
>>> 1. I want to get all static symbols named `foo`.  In which case, I'd use the
>>>    function Andrew proposes in this patch.
>>> 2. I want to get the static symbol named `foo` that's visible from a certain
>>>    point, perhaps a given block or where my program is currently stopped at.
>>>    Ideally, we would have a "CompilationUnit" object type in Python, such that
>>>    I could use
>>>
>>>     block.compunit.lookup_static_symbol('foo')
>>>
>>>   or
>>>
>>>     gdb.current_compunit().lookup_static_symbol('foo')
>> So technically, those don't give you "the static symbol named `foo`
>> that's visible from [this] point", because there could be static
>> variable in the function.
>>
>> Since we already have block objects, should this new function
>> optionally take a block to start the lookup in?
> When you say "new function", I assume you mean
> 'gdb.lookup_static_symbol' not 'gdb.lookup_static_symbols', as the
> second one always returns all symbols.
> 
> Anyway, I took a stab at adding a block parameter to the first of
> these functions - is this what you were thinking?
> 
> Thanks,
> Andrew

I'm confused, I don't gdb.lookup_static_symbol(s) only look through
static symbols, as in file-level static variables?

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]