On Jun 17, 2013, at 20:16 , Greg Clayton <[email protected]> wrote:
> Types are parsed lazily in modules so you will only get what types have been > parsed up to the time you make the function call. My issue with trying to > enumerate types in a module are: > 1 - it isn't always easy to ask a large DWARF object "get me the number of > unique types you contain". Often DWARF has duplicate type info that we > realize can be coalesced when we parse a type. > 2 - it is hard to force each symbol file parser to support "get type at index" > Watching the result I got made me realise that (some obscure duplicates). > The best we can probably do is to add a > > SBTypeList > SBModule::GetAllTypes() > > Then lldb_private::SymbolVendor and lldb_private::SymboFile would need to > have a new virtual functions added to them: > > > virtual size_t > lldb_private::SymbolVendor::GetAllTypes(lldb_private::TypeList &type_list); > > virtual size_t > lldb_private::SymboFile::GetAllTypes(lldb_private::TypeList &type_list); > Ok. Adding new method was the easy part :-). > > Then each symbol file parser would be responsible for parsing all types and > returning a uniqued type list. > > As for the performance issue you solved with your std::vector, I would change > this patch to do the following: > > 1 - modify lldb_private::TypeListImpl to have a new Append function that > takes a "const lldb_private::TypeList &type_list". You then might need to add > a function to lldb_private::TypeList like: > > void > lldb_private::TypeList (std::function <bool(lldb::TypeSP &type_sp)> const > &callback); > > We use this trick in the "BreakpointSiteList::ForEach" to provide an > efficient way to iterate over a collection. An example of using a lambda > function to iterate over the breakpoint site list can be seen in > Process::DisableAllBreakpointSites(). The bool return value for the callback > function indicates whether to continue iterating over the list. > I did that but don't I need to change SBTypeList to add some way to construct it from an existing TypeListImpl (or to access its TypeListImpl member? Or at least make SBModule a friend of SBTypeList? > The trickiest part of this will be the SymbolFileDWARF::GetAllTypes(). If you > need help with this let me know. > Ok, indeed that's the scary part for a newbie. What is the best place to look in order to get some ideas of how to implement that? Many thanks for your very helpful answers again! S. _______________________________________________ lldb-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
