This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC - Python scripting] New methods Symtab.global_block and Symtab.static_block (docs included)


On Thu, Apr 19, 2012 at 9:57 PM, Siva Chandra <sivachandra@google.com> wrote:

> ?Similarly, if my
> understanding is correct, static functions and static variables
> defined in a source file should always be present in a static block.
> Hence, we again document saying that the user rely only on this
> information being constant. ?Does this sound reasonable?

I personally don't know a lot about this area, but I do recall seeing
some comments which hint at the unreliability in this.

I can't find the specific comment I went looking for,
which I recall as saying that sometimes it is a 'best guess'.  could
be a figment of my imagination

the following from (possibly outdated) symtab.c stuff is what i did
find, i believe there is other uncommented occurrences, anyhow given
the fudge and lack of errors I wouldn't be suprised to weirdness here
go unnoticed.



      int other_kind = kind == GLOBAL_BLOCK ? STATIC_BLOCK : GLOBAL_BLOCK;

      /* This shouldn't be necessary, but as a last resort
       * try looking in the 'other kind' even though the psymtab
       * claimed the symbol was one thing.  It's possible that
       * the psymtab gets it wrong in some cases.
       */
      block = BLOCKVECTOR_BLOCK (bv, other_kind);
      sym = lookup_block_symbol (block, name, STRUCT_DOMAIN);

....

      /* This shouldn't be necessary, but as a last resort try
         looking in the statics even though the psymtab claimed
         the symbol was global, or vice-versa.  It's possible
         that the psymtab gets it wrong in some cases.  */

      /* FIXME: carlton/2002-09-30: Should we really do that?
         If that happens, isn't it likely to be a GDB error, in
         which case we should fix the GDB error rather than
         silently dealing with it here?  So I'd vote for
         removing the check for the symbol in the other
         block.  */
      block = BLOCKVECTOR_BLOCK (bv,
                                 kind == GLOBAL_BLOCK ?
                                 STATIC_BLOCK : GLOBAL_BLOCK);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]