Fixes related to handling of C++ methods (handle destructors
authorPer Bothner <per@bothner.com>
Tue, 12 Nov 1991 22:20:02 +0000 (22:20 +0000)
committerPer Bothner <per@bothner.com>
Tue, 12 Nov 1991 22:20:02 +0000 (22:20 +0000)
and parameters that are functions).

gdb/ChangeLog
gdb/buildsym.c
gdb/c-exp.y
gdb/symtab.c
gdb/values.c

index d857fcfbe7807fe19ef4cc1238b20c23fea07c87..620e5b2e5b8d0a0039366d927952c7133ec847d4 100644 (file)
@@ -1,3 +1,27 @@
+Tue Nov 12 13:43:26 1991  Per Bothner  (bothner at cygnus.com)
+
+       * symtab.c (decode_line_1):  Remove spurious call to operator_chars.
+
+       Allow setting breakpoints on C++ destructors.
+       * valops.c (destructor_name_p):  Don't check TYPE_HAS_DESTRUCTOR,
+       since it lies.  Rely on callers to catch missing destructors.
+       * symtab.c (decode_line_1):  For example (see above), here.
+       * buildsym.c, symtab.h:  Remove TYPE_FLAGS_HAS{CON,DE}STRUCTOR
+       flags since they are no longer used.
+
+       Fixes to support C++ methods with functional parameters.
+       * c-exp.y (func_mod rule):  Allow (and ignore) list of parameter
+       types in a function type.
+       * eval.c (parse_and_eval_type), value.h:  New function,
+       parse_and_eval_type, is based on old code from check_stub_method.
+       But don't actually evaluate the cast, since that calls
+       value_cast(), whcih may fail.  Just extract the type
+       from the parsed expression.
+       * values.c (check_stub_method):  While looping through the
+       arguments, adjust depth *after* parameter has been handled.
+       Replace call and setup of parse_and_eval with new function
+       parse_and_eval_type.
+
 Tue Nov 12 09:40:07 1991  Fred Fish  (fnf at cygnus.com)
 
        * utils.c, rem-multi.shar:  Remove fixed arg count version of
index 3e573f1b38fb5df50da5e71146ddcd9e1733b416..1c55a68f15973cce8c7a949c19654ad91536e8c4 100644 (file)
@@ -2383,20 +2383,10 @@ read_struct_type (pp, type)
     {
       *pp += 1;
 
-      if (**pp == '=')
+      if (**pp == '=' || **pp == '+' || **pp == '-')
        {
-         TYPE_FLAGS (type)
-           |= TYPE_FLAG_HAS_CONSTRUCTOR | TYPE_FLAG_HAS_DESTRUCTOR;
-         *pp += 1;
-       }
-      else if (**pp == '+')
-       {
-         TYPE_FLAGS (type) |= TYPE_FLAG_HAS_CONSTRUCTOR;
-         *pp += 1;
-       }
-      else if (**pp == '-')
-       {
-         TYPE_FLAGS (type) |= TYPE_FLAG_HAS_DESTRUCTOR;
+         /* Obsolete flags that used to indicate the presence
+            of constructors and/or destructors. */
          *pp += 1;
        }
 
index 3e318fee87036f09575859c4810137dab1f2b9b2..0c51cd2f34cecf8ba58b5c4e6bf538fc4aa5f452 100644 (file)
@@ -771,6 +771,8 @@ array_mod:  '[' ']'
 
 func_mod:      '(' ')'
                        { $$ = 0; }
+       |       '(' nonempty_typelist ')'
+                       { free ($2); $$ = 0; }
        ;
 
 type   :       ptype
index 709559c25236898268caedd096b39326ccfca1d2..9d4db8f2b2a7073f664f4afa8b1adf0051aca55b 100644 (file)
@@ -1270,6 +1270,18 @@ lookup_partial_symbol (pst, name, global, namespace)
   return (struct partial_symbol *) 0;
 }
 
+/* Find the psymtab containing main(). */
+
+struct partial_symtab *
+find_main_psymtab ()
+{
+  register struct partial_symtab *pst;
+  for (pst = partial_symtab_list; pst; pst = pst->next)
+    if (lookup_partial_symbol (pst, "main", 1, VAR_NAMESPACE))
+       return pst;
+  return NULL;
+}
+
 /* Look for a symbol in block BLOCK.  */
 
 struct symbol *
@@ -1930,7 +1942,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
     }
   while (p[0] == ' ' || p[0] == '\t') p++;
 
-  q = operator_chars (*argptr, &q1);
   if (p[0] == ':')
     {
 
@@ -2043,7 +2054,12 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
                    }
                  else
                    tmp = copy;
-                 error ("that class does not have any method named %s", tmp);
+                 if (tmp[0] == '~')
+                   error ("The class `%s' does not have destructor defined",
+                          sym_class->name);
+                 else
+                   error ("The class %s does not have any method named %s",
+                          sym_class->name, tmp);
                }
            }
          else
index eac4d59096eb0b6ab4579777f841af85dad4edaf..810e00b41a867c7421f7d4c469dc18648d4e2fdd 100644 (file)
@@ -1284,27 +1284,22 @@ check_stub_method (type, i, j)
 
   if (*p != ')')                       /* () means no args, skip while */
     {
+      depth = 0;
       while (*p)
        {
-         if (*p == '(')
-           depth += 1;
-         else if (*p == ')')
-           depth -= 1;
-
          if (depth <= 0 && (*p == ',' || *p == ')'))
            {
-             char *tmp = (char *)alloca (p - argtypetext + 4);
-             value val;
-             tmp[0] = '(';
-             bcopy (argtypetext, tmp+1, p - argtypetext);
-             tmp[p-argtypetext+1] = ')';
-             tmp[p-argtypetext+2] = '0';
-             tmp[p-argtypetext+3] = '\0';
-             val = parse_and_eval (tmp);
-             argtypes[argcount] = VALUE_TYPE (val);
+             argtypes[argcount] =
+                 parse_and_eval_type (argtypetext, p - argtypetext);
              argcount += 1;
              argtypetext = p + 1;
            }
+
+         if (*p == '(')
+           depth += 1;
+         else if (*p == ')')
+           depth -= 1;
+
          p += 1;
        }
     }
This page took 0.033868 seconds and 4 git commands to generate.