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: remove the symtab "last resort" hack


On 01/15/2013 04:51 PM, Tom Tromey wrote:
> Two functions in symtab.c have long had a "last resort" branch where
> they extend a search "just in case".  That is, if the search was
> requested for STATIC_BLOCK, and fails, then the functions will search
> GLOBAL_BLOCK; and vice versa.
> 
> From what I can tell, this code doesn't serve any purpose.  It is there
> to defend against imagined gdb bugs elsewhere.

I don't have any other explanation either.  The went in in gdb-4.18/1998...

...
        * symtab.c (lookup_symbol): Ifdef the searching of symbol in the
        minimal symbol tables, for hpux we move this check at the end
        of the function.
        Before we error out if symbol is not found in the symtab, look
        in the statics.
        Before erroring out if static symbol not found look in the globals.
...

I couldn't find any mention of it in the 1998 ml archives.

> 
> Removing this code causes no test suite regressions on x86-64 Fedora 16.
> I ran the test suite both with DWARF and -gstabs+, to test the main
> symbol readers.
> 
> This patch removes the last resort hacks and fixes a FIXME comment in
> the process.
> 
> My view is that if such a bug actually arises in the future, we should
> fix it at the source rather than having a hack in the symbol table
> lookup functions.
> 
> Comments?

I agree with your rationale.

-- 
Pedro Alves


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