2000-10-12 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Thu, 12 Oct 2000 19:34:27 +0000 (19:34 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Thu, 12 Oct 2000 19:34:27 +0000 (19:34 +0000)
From Daniel Berlin <dberlin@redhat.com> :

* symtab.h (SYMBOL_INIT_DEMANGLED_NAME): Initialize the symbol
  language to auto instead of unknown, so it will try to demangle
  the symbol.
* symtab.h (OPNAME_PREFIX_P): Change operator prefix to correct value.
* symtab.c (gdb_mangle_name): Properly handle C++ operators.

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

index dd1f8aae26f867a9924adcf4124eaffcae1de5af..0f59014e9209d3cdabdee33e93e1ed4680266e80 100644 (file)
@@ -1,3 +1,13 @@
+2000-10-12  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
+
+       From Daniel Berlin <dberlin@redhat.com> :
+
+       * symtab.h (SYMBOL_INIT_DEMANGLED_NAME): Initialize the symbol
+       language to auto instead of unknown, so it will try to demangle
+       the symbol.
+       * symtab.h (OPNAME_PREFIX_P): Change operator prefix to correct value.
+       * symtab.c (gdb_mangle_name): Properly handle C++ operators.
+       
 2000-10-12  Elena Zannoni  <ezannoni@kwikemart.cygnus.com>
 
        From Daniel Berlin <dberlin@redhat.com> :
index 3a97e10281b8d72cbf0339ed9735a9e7071afa24..56a179514bc2623847cce9941a2bad0ef12d5164 100644 (file)
@@ -303,6 +303,9 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
   char buf[20];
   int len = (newname == NULL ? 0 : strlen (newname));
 
+  if (OPNAME_PREFIX_P (field_name))
+    return xstrdup (physname);
+
   is_full_physname_constructor =
     ((physname[0] == '_' && physname[1] == '_' &&
       (isdigit (physname[2]) || physname[2] == 'Q' || physname[2] == 't'))
@@ -338,25 +341,8 @@ gdb_mangle_name (struct type *type, int method_id, int signature_id)
       sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
     }
   mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
-                     + strlen (buf) + len
-                     + strlen (physname)
-                     + 1);
-
-  /* Only needed for GNU-mangled names.  ANSI-mangled names
-     work with the normal mechanisms.  */
-  if (OPNAME_PREFIX_P (field_name))
-    {
-      const char *opname = cplus_mangle_opname (field_name + 3, 0);
-      if (opname == NULL)
-       error ("No mangling for \"%s\"", field_name);
-      mangled_name_len += strlen (opname);
-      mangled_name = (char *) xmalloc (mangled_name_len);
+                     + strlen (buf) + len + strlen (physname) + 1);
 
-      strncpy (mangled_name, field_name, 3);
-      mangled_name[3] = '\0';
-      strcat (mangled_name, opname);
-    }
-  else
     {
       mangled_name = (char *) xmalloc (mangled_name_len);
       if (is_constructor)
index 55db0f82a9d486086e058bf9a0798b6b9dea789a..d76df87c2532a3f6c152c8755becf6ca369bee2b 100644 (file)
@@ -170,6 +170,8 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
 #define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack)                     \
   do {                                                                 \
     char *demangled = NULL;                                            \
+    if (SYMBOL_LANGUAGE (symbol) == language_unknown)                 \
+          SYMBOL_LANGUAGE (symbol) = language_auto;                    \
     if (SYMBOL_LANGUAGE (symbol) == language_cplus                     \
        || SYMBOL_LANGUAGE (symbol) == language_auto)                   \
       {                                                                        \
@@ -222,10 +224,6 @@ extern CORE_ADDR symbol_overlayed_address (CORE_ADDR, asection *);
            SYMBOL_CHILL_DEMANGLED_NAME (symbol) = NULL;                \
          }                                                             \
       }                                                                        \
-    if (SYMBOL_LANGUAGE (symbol) == language_auto)                     \
-      {                                                                        \
-       SYMBOL_LANGUAGE (symbol) = language_unknown;                    \
-      }                                                                        \
   } while (0)
 
 /* Macro that returns the demangled name for a symbol based on the language
@@ -1047,13 +1045,9 @@ struct partial_symtab
 #define VTBL_FNADDR_OFFSET 2
 
 /* Macro that yields non-zero value iff NAME is the prefix for C++ operator
-   names.  If you leave out the parenthesis here you will lose!
-   Currently 'o' 'p' CPLUS_MARKER is used for both the symbol in the
-   symbol-file and the names in gdb's symbol table.
-   Note that this macro is g++ specific (FIXME). */
-
+   names.  If you leave out the parenthesis here you will lose!  */
 #define OPNAME_PREFIX_P(NAME) \
-  ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2]))
+  (!strncmp (NAME, "operator", 8))
 
 /* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
    names.  Note that this macro is g++ specific (FIXME).
This page took 0.031708 seconds and 4 git commands to generate.