From: Siva Chandra <sivachandra@google.com>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC - Python scripting] New methods Symtab.global_block and Symtab.static_block (docs included)
Date: Tue, 17 Apr 2012 17:34:00 -0000 [thread overview]
Message-ID: <CAGyQ6gwR5nTB1UJkXc9yeMovv_ybR_sLEm2DNiKLhXN7_Wxdsw@mail.gmail.com> (raw)
In-Reply-To: <4F8D6779.8090906@redhat.com>
Thank Phil, for taking a look. Comments below.
Phil> We already have gdb.Block.is_static and gdb.Block.is_global. I don't
Phil> have an objection to this patch per-se, but wouldn't the user acquire
Phil> the global/static blocks similarly by iterating the blocks in the
Phil> Python code and doing the above tests?
Is there a way to iterate over all blocks of a Symtab right after
loading? If yes, my mistake for having missed it, and this patch is
not necessary. The idea behind most of the patches I am sending is to
have an exploratory path Objfile => Symtab => Block => Symbol. This
part addresses Symtab => Block part but not completely; good enough
for my immediate needs though.
Phil> I don't think GNU Style ChangeLogs allow for a summary line. I don't
Phil> have an issue with it, but, check with maintainers. Just a nit.
There many examples in ChangeLog with a summary line. There are of
course many others without :-)
>> +static PyObject *
>> +stpy_global_block (PyObject *self, PyObject *args)
>> +{
>> + struct symtab *symtab = NULL;
>> > + struct block *block = NULL;
>> +
>> + STPY_REQUIRE_VALID (self, symtab);
>> +
>> + block = symtab->blockvector->block[GLOBAL_BLOCK];
>> + return block_to_block_object (block, symtab->objfile);
Phil> I don't think so, but can block ever be NULL here? Looking at the
Phil> code, I'm not even sure if it would matter as set_block just stores a
Phil> reference to the passed block. However, blpy_get_superblock has a
Phil> NULL block check, so it might be worthwhile checking it out.
As I understand, blpy_get_superblock has a check, as the top most
block will not have a superblock. In which case, returning None is
probably more appropriate (as it is a logically valid situation) than
returning a NULL. However, in the case of this patch, is there a
chance that a symtab->blockvector->nblocks == 0? Similarly, is there
a chance blockvector->nblocks > 0 but blockvector->block[GLOBAL_BLOCK]
(or blockvector->block[STATIC_BLOCK]) is NULL for a logical valid
situation?
Thanks,
Siva Chandra
next prev parent reply other threads:[~2012-04-17 17:27 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-17 8:39 Siva Chandra
2012-04-17 13:00 ` Phil Muldoon
2012-04-17 17:34 ` Siva Chandra [this message]
2012-04-17 17:44 ` Tom Tromey
2012-04-17 17:41 ` Tom Tromey
2012-04-17 17:05 ` Eli Zaretskii
[not found] ` <CAGyQ6gxxEeYeCKw_iHXh74Gg223GHxMoW=gvt9kU+ax396kKBQ@mail.gmail.com>
2012-04-18 9:15 ` Siva Chandra
2012-04-18 20:45 ` Phil Muldoon
2012-04-18 20:48 ` Tom Tromey
2012-04-19 17:33 ` Siva Chandra
2012-04-19 19:18 ` Doug Evans
2012-04-20 6:48 ` Siva Chandra
2012-04-20 12:12 ` Matt Rice
2012-04-20 14:16 ` Doug Evans
2012-04-20 15:21 ` Matt Rice
2012-04-20 19:12 ` Tom Tromey
2012-04-20 19:53 ` Doug Evans
2012-04-20 19:57 ` Siva Chandra
2012-04-23 13:21 ` Tom Tromey
2012-04-23 13:35 ` Phil Muldoon
2012-04-23 14:11 ` Eli Zaretskii
2012-04-23 14:45 ` Phil Muldoon
2012-04-23 16:00 ` Eli Zaretskii
2012-04-24 11:15 ` Siva Chandra
2012-04-24 17:40 ` Eli Zaretskii
2012-04-25 7:11 ` Tom Tromey
2012-04-25 8:19 ` Siva Chandra
2012-04-26 12:35 ` Siva Chandra
2012-04-26 15:21 ` Doug Evans
2012-05-02 17:41 ` Siva Chandra
2012-05-02 18:15 ` Doug Evans
2012-05-03 7:13 ` Siva Chandra
2012-05-04 18:05 ` FAILing new testcase for -fdebug-types-section [Re: [RFC - Python scripting] New methods Symtab.global_block and Symtab.static_block (docs included)] Jan Kratochvil
2012-05-05 7:01 ` Siva Chandra
2012-05-05 7:05 ` Jan Kratochvil
2012-05-05 7:11 ` Siva Chandra
2012-05-05 7:13 ` Jan Kratochvil
2012-05-23 21:38 ` [patch KFAIL] Re: FAILing new testcase for -fdebug-types-section (PR symtab/14148) Jan Kratochvil
2012-04-18 20:48 ` [RFC - Python scripting] New methods Symtab.global_block and Symtab.static_block (docs included) Tom Tromey
2012-04-20 8:13 ` Eli Zaretskii
2012-04-17 17:37 ` Tom Tromey
2012-04-18 18:41 ` Tom Tromey
2012-04-18 19:53 ` Siva Chandra
2012-04-18 20:49 ` Tom Tromey
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=CAGyQ6gwR5nTB1UJkXc9yeMovv_ybR_sLEm2DNiKLhXN7_Wxdsw@mail.gmail.com \
--to=sivachandra@google.com \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@redhat.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