This is the mail archive of the gdb@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: question about expand_symtabs_matching()


Am Freitag, 1. März 2019, 19:30:56 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> Personally I'd be fine with changing the syntax of the more obscure
> linespecs ("function:label" is probably not used much in practice) in
> order to make the parsing more sane, if it had a performance benefit
> here.  But that's just me.

I didn't even know before I started looking into this that function:label
is possible.


> Also, a negative result is still a parse result; so if a linespec
> understood which objfiles had been searched, it could still easily skip
> this work on dlopen or dlclose.

If you mean that it should only search the newly loaded shared library,
then yes, I agree.


> Hannes> Similar, for the case of a simple function name as pending breakpoint,
> Hannes> it's cp_canonicalize_string_no_typedefs() called by find_linespec_symbols(),
> Hannes> that's taking most of the time.
> Hannes> And I'm wondering if this call is necessary if you only use the function name
> Hannes> without arguments (like 'function' or Class::member_function).
> 
> I doubt it's needed but on the other hand it may not really save much.
> Maybe one way to do the experiment is check the string for
> non-identifier characters before trying to canonicalize it.

For the case of 'b some_function', with the application I'm testing:
- startup time with the call of cp_canonicalize_string_no_typedefs(): 1m 25s
- startup time without this call: 27s


> Hannes> If you are interested, I could also send you the profiling flamegraphs.
> 
> It's an area I'm interested in but I'm not actively working there right
> now.  If you're interested at all in gdb development ... on the one hand
> tackling linespec caching is maybe a difficult project, but on the other
> hand it seems fun :-)

In my personal build I've changed this:
- only call cp_canonicalize_string_no_typedefs() if it's not a simple function
  name (like 'function_name' or 'Class::member_function')
- only call expand_symtabs_matching() if the lookup_name doesn't contain a '.'

I admit that I don't fully understand what could break with these changes,
but the speedup makes it worth for me right now.


Regards
Hannes Domani


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