This is the mail archive of the gdb-patches@sources.redhat.com 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: [rfa] delete lookup_symbol_aux_minsyms


On Mon, 24 Feb 2003 13:21:55 -0500, Elena Zannoni <ezannoni at redhat dot com> said:

> Actually, I did some gcov on that function last night, running make check,
> here is what I got.

> About deleting the function. I think I would prefer if we delete the
> 'else' part first. Then comment out the function.

> But I am still not convinced that we should delete it yet.

I'm not an expert on 'gcov': does the data you presented mean that, in
some situation where lookup_symbol_aux_minsyms was called 1442 times,
the else block was called 2 times?  So you're worried about those 2
times, that they produced correct information that wouldn't have been
reached if we deleted the 'else' clause?

If so, here's the situation with the 'else' clause.  That clause calls
lookup_symbol_aux with a mangled name as the 'name' argument.  But the
'name' argument to lookup_symbol_aux should never be mangled: calls to
lookup_symbol_aux always ultimately boil down to a call to
lookup_block_symbol.  And lookup_block_symbol needs a demangled name
as its 'name' argument, not a mangled name: blocks are hashed by their
demangled names, so passing in a mangled name is likely to result in
searching in the wrong bucket.  There might be times when
lookup_block_symbol returns the correct value when you pass in a
mangled name as the 'name' argument, but, if so, that's purely
accidental; and, in those situations, the same symbol would have been
found in the psymtab search that follows the call to
lookup_symbol_aux_minsyms.

Here's the current control flow, more or less:

* Search symtabs.

* Search minsyms.

** Maybe then call lookup_symbol_aux with a demangled name as the
   'name' argument, in which case we:

** Search symtabs again, with mangled name.

** Search minsyms again, with mangled name.

** Search psymtabs, with mangled name.

* Search psymtabs (with demangled name).


The 'else' clause is the stuff that I've labeled with two asterisks.
I don't see how the 'search symtabs again' or 'search minsyms again'
parts could ever return anything useful.  And the 'search psymtabs,
with mangled name', might accidentally sometimes find the variable
we're looking for; if so, however, the outer 'search psymtabs (with
demangled name)' would have found it as well, and would do so much
more reliably.

David Carlton
carlton at math dot stanford dot edu


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