2002-12-17 David Carlton <carlton@math.stanford.edu>
authorDavid Carlton <carlton@bactrian.org>
Tue, 17 Dec 2002 18:34:06 +0000 (18:34 +0000)
committerDavid Carlton <carlton@bactrian.org>
Tue, 17 Dec 2002 18:34:06 +0000 (18:34 +0000)
* symtab.c (lookup_partial_symbol): Don't search past the end of
the partial symbols.

gdb/ChangeLog
gdb/symtab.c

index 95ec1d1ccc0bde637a722841d14fbfeea4e7a77e..bbcfee9dd2de83d5f5a8a389a766a4c3773f0b9f 100644 (file)
@@ -1,3 +1,8 @@
+2002-12-17  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.c (lookup_partial_symbol): Don't search past the end of
+       the partial symbols.
+
 2002-12-17  Andrew Cagney  <ac131313@redhat.com>
 
        * stack.c (frame_info): Use get_frame_saved_regs.
index d7a0b63e85e36f048a6ca53c33ed89a19c0e167d..badda47c733126bce6b47618c8a193f3956cc301 100644 (file)
@@ -1300,7 +1300,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
 {
   struct partial_symbol *temp;
   struct partial_symbol **start, **psym;
-  struct partial_symbol **top, **bottom, **center;
+  struct partial_symbol **top, **real_top, **bottom, **center;
   int length = (global ? pst->n_global_syms : pst->n_static_syms);
   int do_linear_search = 1;
   
@@ -1323,6 +1323,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
 
       bottom = start;
       top = start + length - 1;
+      real_top = top;
       while (top > bottom)
        {
          center = bottom + (top - bottom) / 2;
@@ -1348,7 +1349,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
       /* djb - 2000-06-03 - Use SYMBOL_MATCHES_NAME, not a strcmp, so
         we don't have to force a linear search on C++. Probably holds true
         for JAVA as well, no way to check.*/
-      while (SYMBOL_MATCHES_NAME (*top,name))
+      while (top <= real_top && SYMBOL_MATCHES_NAME (*top,name))
        {
          if (SYMBOL_NAMESPACE (*top) == namespace)
            {