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]

Re: [RFA] bug in symtab.c:lookup_block_symbol()'s search method


On Mon, Sep 10, 2001 at 02:50:29PM -0400, Daniel Berlin wrote:

> Your test above isn't quite correct, actually.
> There is a corner case of the first character being a space. I don't
> think this can ever occur in c or C++, no clue about other languages.

The initial binary search in lookup_block_symbol() isn't correct
for the same reason - it uses individual character comparisons to
determine less-than/greater-than relationships on the first character
of the symbol, and then uses the stock strcmp to narrow in on the
rest of the symbol.  Nevertheless, it all generally works.  The
binary search gets us to the beginning of the valid matches; the
follow-up linear search finds the right symbol.

My instinct is to change strcmp_iw() to streq_iw() (as well as all
the callers) and add a new strcmp_iw() function which returns a
less-than/greater-than relationship instead of just match/not-match.
That would be the best way to deal with all of this.


IMNSHO gdb 5.1 can not be released with the symbol binary search
lookup broken as it has been for the last year.  The patch I sent
is a conservative one which brings the lookup cost near the original
gdb search time.  I believe a more correct patch would be to change
the behavior of strcmp_iw() so that it can be used here, but that's
a slightly more pervasive change.

Jason


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