2003-03-03 David Carlton <carlton@math.stanford.edu>
authorDavid Carlton <carlton@bactrian.org>
Mon, 3 Mar 2003 18:34:12 +0000 (18:34 +0000)
committerDavid Carlton <carlton@bactrian.org>
Mon, 3 Mar 2003 18:34:12 +0000 (18:34 +0000)
* symtab.h (DEPRECATED_SYMBOL_MATCHES_NAME): Rename from
SYMBOL_MATCHES_NAME, add comment.
(SYMBOL_MATCHES_NATURAL_NAME): New.
* minsyms.c (lookup_minimal_symbol_solib_trampoline): Replace
SYMBOL_MATCHES_NAME with DEPRECATED_SYMBOL_MATCHES_NAME.
(lookup_minimal_symbol, lookup_minimal_symbol_text): Ditto.
* symtab.c (lookup_partial_symbol): Use
SYMBOL_MATCHES_NATURAL_NAME, not SYMBOL_MATCHES_NAME.  Delete
unhelpful comment.
(lookup_block_symbol): Use SYMBOL_MATCHES_NATURAL_NAME, not
SYMBOL_MATCHES_NAME.
Fix for PR c++/33.

gdb/ChangeLog
gdb/minsyms.c
gdb/symtab.c
gdb/symtab.h

index b79b9d12640055e859fd4cbf548c40c037b10c42..3a544ea0aff74e52ec31c3d2eb87df7d66289f3a 100644 (file)
@@ -1,3 +1,18 @@
+2003-03-03  David Carlton  <carlton@math.stanford.edu>
+
+       * symtab.h (DEPRECATED_SYMBOL_MATCHES_NAME): Rename from
+       SYMBOL_MATCHES_NAME, add comment.
+       (SYMBOL_MATCHES_NATURAL_NAME): New.
+       * minsyms.c (lookup_minimal_symbol_solib_trampoline): Replace
+       SYMBOL_MATCHES_NAME with DEPRECATED_SYMBOL_MATCHES_NAME.
+       (lookup_minimal_symbol, lookup_minimal_symbol_text): Ditto.
+       * symtab.c (lookup_partial_symbol): Use
+       SYMBOL_MATCHES_NATURAL_NAME, not SYMBOL_MATCHES_NAME.  Delete
+       unhelpful comment.
+       (lookup_block_symbol): Use SYMBOL_MATCHES_NATURAL_NAME, not
+       SYMBOL_MATCHES_NAME.
+       Fix for PR c++/33.
+
 2003-03-03  David Carlton  <carlton@math.stanford.edu>
 
        * symtab.h (SYMBOL_MATCHES_REGEXP): Delete.
index 057bd8fd04838e20ecefae1b8db92965da4c2ddc..e3f649e02896ae9f36983d2d013bd5e1741457a5 100644 (file)
@@ -188,7 +188,7 @@ lookup_minimal_symbol (register const char *name, const char *sfile,
 
             while (msymbol != NULL && found_symbol == NULL)
                {
-                if (SYMBOL_MATCHES_NAME (msymbol, name))
+                if (DEPRECATED_SYMBOL_MATCHES_NAME (msymbol, name))
                    {
                     switch (MSYMBOL_TYPE (msymbol))
                       {
@@ -288,7 +288,7 @@ lookup_minimal_symbol_text (register const char *name, const char *sfile,
               msymbol != NULL && found_symbol == NULL;
               msymbol = msymbol->hash_next)
            {
-             if (SYMBOL_MATCHES_NAME (msymbol, name) &&
+             if (DEPRECATED_SYMBOL_MATCHES_NAME (msymbol, name) &&
                  (MSYMBOL_TYPE (msymbol) == mst_text ||
                   MSYMBOL_TYPE (msymbol) == mst_file_text))
                {
@@ -364,7 +364,7 @@ lookup_minimal_symbol_solib_trampoline (register const char *name,
               msymbol != NULL && found_symbol == NULL;
               msymbol = msymbol->hash_next)
            {
-             if (SYMBOL_MATCHES_NAME (msymbol, name) &&
+             if (DEPRECATED_SYMBOL_MATCHES_NAME (msymbol, name) &&
                  MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
                return msymbol;
            }
index af07d77e47f66eb0005a2eece8d70c1d3db6c5fe..9ecbd54e10f495160ad9be7128c60381bd724c5b 100644 (file)
@@ -1423,10 +1423,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
       if (!(top == bottom))
        internal_error (__FILE__, __LINE__, "failed internal consistency check");
 
-      /* 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 (top <= real_top && SYMBOL_MATCHES_NAME (*top,name))
+      while (top <= real_top && SYMBOL_MATCHES_NATURAL_NAME (*top,name))
        {
          if (SYMBOL_NAMESPACE (*top) == namespace)
            {
@@ -1445,7 +1442,7 @@ lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
        {
          if (namespace == SYMBOL_NAMESPACE (*psym))
            {
-             if (SYMBOL_MATCHES_NAME (*psym, name))
+             if (SYMBOL_MATCHES_NATURAL_NAME (*psym, name))
                {
                  return (*psym);
                }
@@ -1623,7 +1620,7 @@ lookup_block_symbol (register const struct block *block, const char *name,
          if (SYMBOL_NAMESPACE (sym) == namespace 
              && (mangled_name
                  ? strcmp (DEPRECATED_SYMBOL_NAME (sym), mangled_name) == 0
-                 : SYMBOL_MATCHES_NAME (sym, name)))
+                 : SYMBOL_MATCHES_NATURAL_NAME (sym, name)))
            return sym;
        }
       return NULL;
@@ -1693,7 +1690,7 @@ lookup_block_symbol (register const struct block *block, const char *name,
          if (SYMBOL_NAMESPACE (sym) == namespace
              && (mangled_name
                  ? strcmp (DEPRECATED_SYMBOL_NAME (sym), mangled_name) == 0
-                 : SYMBOL_MATCHES_NAME (sym, name)))
+                 : SYMBOL_MATCHES_NATURAL_NAME (sym, name)))
            {
              return sym;
            }
@@ -1728,7 +1725,7 @@ lookup_block_symbol (register const struct block *block, const char *name,
          if (SYMBOL_NAMESPACE (sym) == namespace
              && (mangled_name
                  ? strcmp (DEPRECATED_SYMBOL_NAME (sym), mangled_name) == 0
-                 : SYMBOL_MATCHES_NAME (sym, name)))
+                 : SYMBOL_MATCHES_NATURAL_NAME (sym, name)))
            {
              /* If SYM has aliases, then use any alias that is active
                 at the current PC.  If no alias is active at the current
index 9e515de9321f62df1d5ad45a351c5de7bf43fb9c..79705fec06d431c1d9f699aa74e949c30c9d214c 100644 (file)
@@ -217,11 +217,24 @@ extern char *symbol_demangled_name (struct general_symbol_info *symbol);
    "foo :: bar (int, long)".
    Evaluates to zero if the match fails, or nonzero if it succeeds. */
 
-#define SYMBOL_MATCHES_NAME(symbol, name)                              \
+/* FIXME: carlton/2003-02-27: This is an unholy mixture of linkage
+   names and natural names.  If you want to test the linkage names
+   with strcmp, do that.  If you want to test the natural names with
+   strcmp_iw, use SYMBOL_MATCHES_NATURAL_NAME.  */
+
+#define DEPRECATED_SYMBOL_MATCHES_NAME(symbol, name)                   \
   (STREQ (DEPRECATED_SYMBOL_NAME (symbol), (name))                     \
    || (SYMBOL_DEMANGLED_NAME (symbol) != NULL                          \
        && strcmp_iw (SYMBOL_DEMANGLED_NAME (symbol), (name)) == 0))
 
+/* Macro that tests a symbol for a match against a specified name
+   string.  It tests against SYMBOL_NATURAL_NAME, and it ignores
+   whitespace and trailing parentheses.  (See strcmp_iw for details
+   about its behavior.)  */
+
+#define SYMBOL_MATCHES_NATURAL_NAME(symbol, name)                      \
+  (strcmp_iw (SYMBOL_NATURAL_NAME (symbol), (name)) == 0)
+
 /* Define a simple structure used to hold some very basic information about
    all defined global symbols (text, data, bss, abs, etc).  The only required
    information is the general_symbol_info.