This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC - Python Scripting] New method Objfile.symtabs () - docs included
On Thu, Apr 5, 2012 at 12:56 PM, <Paul_Koning@dell.com> wrote:
> In this patch, you have an iterator that walks over the symtabs for an objfile, but that is only used internally in the symtabs() method which is written to return a list.
>
> How about having symtabs() return the iterator instead? ?An iterator is usually just as good as a list (and more efficient); in the rare cases where you actually need the list, simply doing list(objfile.symtabs()) will do that.
There is a lower fundamental problem that needs to be addressed.
In a nutshell: If "list (objfile.symtabs())" can increase gdb's memory
usage by gigabytes, then it's a non-starter (IMO).
Before we provide anything along these lines, we need to fix the
underlying problem.
I can think of a simple(quick) solution: create the symtab object when
the psymtab object is created (suitably modified to clean up anything
obvious), but not expand it. [btw, Psymtabs at the moment aren't as
much of an implementation detail as we want them to be (IMO).] It's
not perfect: Depending on what you want from the symtab you may
ultimately end up expanding everything anyway. But it's a step. One
way to go would be to build into gdb the ability to discard the
expansion say when memory gets tight. I think there's room for
improvement before we get to that though.