This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC - Python scripting] New methods Symtab.global_block and Symtab.static_block (docs included)
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
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?
He wants to be able to iterate over the blocks in a symtab.
Right now there is no way to do this, since there's no way to get a
good starting point.
So, these methods provide that access. They are complementary to the
methods on Block.
Phil> gdb.python/ prefix to filenames here.
Oh yeah, I missed that one.
Thanks.
>> + 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?
I don't think so.
Phil> However, blpy_get_superblock has a NULL block check, so it might
Phil> be worthwhile checking it out.
I think that is different because the global block's superblock is NULL.
>> + block = symtab->blockvector->block[STATIC_BLOCK];
>> + return block_to_block_object (block, symtab->objfile);
Phil> Same as above.
Ditto.
Tom