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] tweak sorting of partial symbols


David Carlton writes:
 > On Sun, 23 Feb 2003 19:40:25 -0500, Elena Zannoni <ezannoni at redhat dot com> said:
 > 
 > > It seems innocuous enough, and intuitively it makes sense, but can you
 > > show me a case where it makes a difference? I.e some set of strings
 > > for which the order would change?
 > 
 > Sure, that's a good question; I should have included such examples
 > with my original message.
 > 
 > Whitespace example:
 > 
 > Partial symtab contains: "foo<char *>", "goo".
 > 
 > Then, if we try to do a search for "foo<char*>", strcmp will locate
 > this after "foo<char *>" and before "goo".  Then lookup_partial_symbol
 > will start looking at strings beginning with "goo", and will never see
 > the correct match of "foo<char *>".
 > 
 > Parenthesis example:
 > 
 > In practice, this is less like to be an issue, but I'll give it a
 > shot.  Let's assume that '$' is a legitimate character to occur in
 > symbols.  (Which may well even be the case on some systems.)  Then say
 > that the partial symbol table contains "foo$" and "foo(int)".  strcmp
 > will put them in this order, since '$' < '('.
 > 
 > Now, if the user searches for "foo", then strcmp will sort "foo"
 > before "foo$".  Then lookup_partial_symbol will notice that
 > strcmp_iw("foo$", "foo") is false, so it won't proceed to the actual
 > match of "foo(int)" with "foo".


Ah, yes. I was trying with some dumber examples, like foo, foo(int).

Ok, approved, but could you find a place to put some of the examples
above in comments?

elena


 > 
 > 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]