From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Berlin To: Daniel Berlin Cc: Jason Molenda , Michael Snyder , gdb-patches@sources.redhat.com Subject: Re: [RFA] bug in symtab.c:lookup_block_symbol()'s search method Date: Mon, 10 Sep 2001 11:52:00 -0000 Message-id: <87vgiqswsl.fsf@cgsoftware.com> References: <20010909074800.A8112@shell17.ba.best.com> <3B9D054A.4C3CC2B1@cygnus.com> <20010910113226.A23487@shell17.ba.best.com> <87zo82swwa.fsf@cgsoftware.com> X-SW-Source: 2001-09/msg00143.html Daniel Berlin writes: > Jason Molenda writes: > >> On Mon, Sep 10, 2001 at 11:24:10AM -0700, Michael Snyder wrote: >> >>> > + if (SYMBOL_SOURCE_NAME (sym)[0] > name[0]) >>> > + { >>> > + break; >>> > + } >>> >>> If this test works, then wouldn't some sort of strcmp test work too? >> >> It is comparing unmangled names, so there may be space chars which >> are not significant. I don't know enough about mangling to be >> confident that I could put a strcmp in here safely. > You could if they were always mangled, but they aren't. > The unmangled names need to be strcmp_iw'd. > > We use demangled names when doing symbol lookups because it is easier > to demangle whatever you type in, and look that up, than it is to take > what you type in, mangle it, and look that up. > > *Much* easier. > >> out later today and see if the testsuite happens to trip up on it. >> The SYMBOL_MATCHES_NAME() call used for the actual comparison uses >> util.c:strcmp_iw, which skips over whitespace. > Right. > >> >> (On the good news side, when I first started working on this loop, >> I found that using strcmp() to detect matches produced a number of >> testsuite regressions, helping to Show Me The Light.) > > 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. Oh, and in case it's not clear, the problem with the first char being space is that in strcmp_iw, we'd ignore that. > >> >> Jason > > -- > "One time the power went out in my house and I had to use the > flash on my camera to see my way around. I made a sandwich and > took fifty pictures of my face. The neighbors thought there was > lightning in my house. > "-Steven Wright -- ""-Steven Wright