From: Doug Evans <dje@google.com>
To: Siva Chandra <sivachandra@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC - Python Scripting] New method Objfile.symtabs () - docs included
Date: Tue, 03 Apr 2012 00:04:00 -0000 [thread overview]
Message-ID: <CADPb22SLyHU2NUXuOWSOdqUHDA0NeFgiCZX-GWC5aqwhFvZn0w@mail.gmail.com> (raw)
In-Reply-To: <CAGyQ6gxzmufX7CyKpCw=81EM-4m=jaN5LZGf1kmPBAHnGpFX6A@mail.gmail.com>
On Sun, Apr 1, 2012 at 11:17 PM, Siva Chandra <sivachandra@google.com> wrote:
> Hi all,
>
> Attached is a patch which adds a new method Objfile.symtabs to
> gdb.Objfile. This new method returns a list of gdb.Symtab objects
> associated with the underlying object file.
>
> Code ChangeLog:
>
> 2012-04-02 Siva Chandra Reddy <sivachandra@google.com>
>
> Python Scripting: New method Objfile.symtabs which returns
> the list of obj.Symtab objects associated with the underlying
> objfile.
> * NEWS: Add entery under 'Python scripting' about the new
spelling: "entry"
> Objfile.symtabs method.
> * python/py-objfile.c (stpy_iterator_object): New iterator
> object type to iterate over a list of obj.Symtab objects.
> (stpy_node): New struct to aid the iterator.
> (stpy_iterator_free_symtab_list, new_stpy_iterator,
> objfpy_symtabs, stpy_iterator_dealloc, stpy_iterator_iter,
> stpy_iterator_iternext): New functions which manage the new
> iterator object type.
> (objfpy_dealloc, objfpy_new, objfile_to_objfile_object,
> gdbpy_initialize_objfile): Add initializations and reference
> management for the new iterator object and type.
Hi.
You're touching on one of the more troublesome areas of gdb (symbol
handling), I salute your courage. :-)
I didn't read the entire patch but one thing stood out:
+ /* If the symtabs are not yet read, then read them. */
+ ALL_OBJFILE_PSYMTABS (objfile, psymtab)
+ {
+ if (psymtab->readin)
+ continue;
+
+ if (psymtab->read_symtab)
+ psymtab->read_symtab (psymtab);
+ }
This code is doing something we want to try really hard to avoid.
In a large program this will push gdb's memory usage far beyond
anything the user will find acceptable (not to mention taking a long
time).
We want to do the expansion as lazily as possible.
[We also, IMO, want to expose as little of the symbol table
implementation details in the Python API as possible, at least
initially.]
The current code may not make that easy (or even possible, absent
changes), but if a simple and innocent looking my_objfile.symtabs() in
Python can push gdb's memory usage to several 10s of gigabytes
(assuming you have enough memory and swap :-)), then I think we need
to avoid that.
Assuming we want to provide the ability to iterate over all the symbol
tables, we want to be able to do that without first expanding them.
So I think the first question is what will the user want to do with
this feature?
next prev parent reply other threads:[~2012-04-03 0:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-02 6:17 Siva Chandra
2012-04-02 17:08 ` Eli Zaretskii
2012-04-03 0:04 ` Doug Evans [this message]
2012-04-03 5:54 ` Siva Chandra
2012-04-05 16:30 ` Paul_Koning
2012-04-05 18:41 ` Tom Tromey
2012-04-05 18:37 ` Tom Tromey
2012-04-05 19:56 ` Paul_Koning
2012-04-05 20:26 ` Doug Evans
2012-04-06 16:42 ` Siva Chandra
2012-04-09 17:56 ` Tom Tromey
2012-04-09 17:59 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADPb22SLyHU2NUXuOWSOdqUHDA0NeFgiCZX-GWC5aqwhFvZn0w@mail.gmail.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=sivachandra@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox